summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-10-22 19:33:19 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-10-22 19:33:19 (GMT)
commit44cce51a1a36973344a0bc1bb99f39410fd678e6 (patch)
tree29b3d0e23e07e3a6b8356396f15bcdcb488e2261
parent5765fbbb8803047850194d1498e573b78bcf50eb (diff)
downloadCMake-44cce51a1a36973344a0bc1bb99f39410fd678e6.zip
CMake-44cce51a1a36973344a0bc1bb99f39410fd678e6.tar.gz
CMake-44cce51a1a36973344a0bc1bb99f39410fd678e6.tar.bz2
COMP: fix some warnings and add some doc strings back in
-rw-r--r--Source/cmDocumentation.cxx145
-rw-r--r--Source/cmDocumentation.h8
-rw-r--r--Source/cmDocumentationSection.cxx15
-rw-r--r--Source/cmDocumentationSection.h9
-rw-r--r--Source/cmakemain.cxx6
5 files changed, 109 insertions, 74 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 6c50c40..1565c59 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -104,71 +104,6 @@ static const char *cmCompatCommandsDocumentationDescription[][3] =
};
//----------------------------------------------------------------------------
-static const char *cmDocumentationCommandsHeader[][3] =
-{
- {0,
- "The following commands are available in CMakeLists.txt code:", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationGlobalPropertiesHeader[][3] =
-{
- {0,
- "The following global properties are available in CMakeLists.txt code:", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationDirectoryPropertiesHeader[][3] =
-{
- {0
- ,"The following directory properties are available in CMakeLists.txt code:"
- ,0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationTargetPropertiesHeader[][3] =
-{
- {0,
- "The following target properties are available in CMakeLists.txt code:", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationTestPropertiesHeader[][3] =
-{
- {0
- ,"The following properties for tests are available in CMakeLists.txt code:"
- ,0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationSourceFilePropertiesHeader[][3] =
-{
- {0
- ,"The following source file properties are available in CMakeLists.txt code:"
- , 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationVariablePropertiesHeader[][3] =
-{
- {0, "The following variables are available in CMakeLists.txt code:", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
-static const char *cmDocumentationCachedVariablePropertiesHeader[][3] =
-{
- {0,"The following cache variables are available in CMakeLists.txt code:", 0},
- {0,0,0}
-};
-
-//----------------------------------------------------------------------------
static const char *cmDocumentationModulesHeader[][3] =
{
{0,
@@ -288,6 +223,18 @@ cmDocumentation::cmDocumentation()
sec = new cmDocumentationSection("See Also","SEE ALSO");
sec->Append(cmDocumentationStandardSeeAlso);
this->AllSections["Standard See Also"] = sec;
+
+ sec = new cmDocumentationSection("Options","OPTIONS");
+ sec->Append(cmDocumentationStandardOptions);
+ this->AllSections["Options"] = sec;
+
+ sec = new cmDocumentationSection("Properties","PROPERTIES");
+ sec->Append(cmPropertiesDocumentationDescription);
+ this->AllSections["Properties Description"] = sec;
+
+ sec = new cmDocumentationSection("Generators","GENERATORS");
+ sec->Append(cmDocumentationGeneratorsHeader);
+ this->AllSections["Generators"] = sec;
}
//----------------------------------------------------------------------------
@@ -298,6 +245,12 @@ cmDocumentation::~cmDocumentation()
{
delete [] *i;
}
+ for(std::map<std::string,cmDocumentationSection *>::iterator i =
+ this->AllSections.begin();
+ i != this->AllSections.end(); ++i)
+ {
+ delete i->second;
+ }
}
//----------------------------------------------------------------------------
@@ -375,6 +328,7 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
this->PrintDocumentationList(os,"Modules");
return true;
case cmDocumentation::PropertyList:
+ this->PrintDocumentationList(os,"Properties Description");
this->PrintDocumentationList(os,"Properties of Global Scope");
this->PrintDocumentationList(os,"Properties on Directories");
this->PrintDocumentationList(os,"Properties on Targets");
@@ -414,7 +368,8 @@ bool cmDocumentation::CreateModulesSection()
dir.Load(cmakeModules.c_str());
if (dir.GetNumberOfFiles() > 0)
{
- this->AllSections["Modules"]->Append(cmDocumentationModulesHeader[0]);
+ sec->Append(cmDocumentationModulesHeader[0]);
+ sec->Append(cmModulesDocumentationDescription);
this->CreateModuleDocsForDir(dir, *this->AllSections["Modules"]);
}
return true;
@@ -442,6 +397,7 @@ bool cmDocumentation::CreateCustomModulesSection()
new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES");
this->AllSections["Custom CMake Modules"] = sec;
sec->Append(cmDocumentationCustomModulesHeader[0]);
+ sec->Append(cmCustomModulesDocumentationDescription);
sectionHasHeader = true;
}
this->CreateModuleDocsForDir
@@ -856,6 +812,63 @@ void cmDocumentation
}
//----------------------------------------------------------------------------
+void cmDocumentation::PrependSection(const char *name,
+ const char *docs[][3])
+{
+ cmDocumentationSection *sec = 0;
+ if (this->AllSections.find(name) == this->AllSections.end())
+ {
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
+ cmSystemTools::UpperCase(name).c_str());
+ this->SetSection(name,sec);
+ }
+ else
+ {
+ sec = this->AllSections[name];
+ }
+ sec->Prepend(docs);
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::AppendSection(const char *name,
+ const char *docs[][3])
+{
+ cmDocumentationSection *sec = 0;
+ if (this->AllSections.find(name) == this->AllSections.end())
+ {
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
+ cmSystemTools::UpperCase(name).c_str());
+ this->SetSection(name,sec);
+ }
+ else
+ {
+ sec = this->AllSections[name];
+ }
+ sec->Append(docs);
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::AppendSection(const char *name,
+ std::vector<cmDocumentationEntry> &docs)
+{
+ cmDocumentationSection *sec = 0;
+ if (this->AllSections.find(name) == this->AllSections.end())
+ {
+ cmDocumentationSection *sec =
+ new cmDocumentationSection(name,
+ cmSystemTools::UpperCase(name).c_str());
+ this->SetSection(name,sec);
+ }
+ else
+ {
+ sec = this->AllSections[name];
+ }
+ sec->Append(docs);
+}
+
+//----------------------------------------------------------------------------
void cmDocumentation::SetSeeAlsoList(const char *data[][3])
{
cmDocumentationSection *sec =
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 0de0fa2..99000ee 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -73,6 +73,14 @@ public:
void SetSections(std::map<std::string,cmDocumentationSection *>
&sections);
+ /** Add the documentation to the beginning/end of the section */
+ void PrependSection(const char *sectionName,
+ const char *docs[][3]);
+ void AppendSection(const char *sectionName,
+ const char *docs[][3]);
+ void AppendSection(const char *sectionName,
+ std::vector<cmDocumentationEntry> &docs);
+
/**
* Print documentation in the given form. All previously added
* sections will be generated.
diff --git a/Source/cmDocumentationSection.cxx b/Source/cmDocumentationSection.cxx
index c4a4edf..88b9eeb 100644
--- a/Source/cmDocumentationSection.cxx
+++ b/Source/cmDocumentationSection.cxx
@@ -31,6 +31,21 @@ void cmDocumentationSection::Append(const char *data[][3])
}
//----------------------------------------------------------------------------
+void cmDocumentationSection::Prepend(const char *data[][3])
+{
+ std::vector<cmDocumentationEntry> tmp;
+ int i = 0;
+ while(data[i][1])
+ {
+ tmp.push_back(cmDocumentationEntry(data[i][0],
+ data[i][1],
+ data[i][2]));
+ data += 1;
+ }
+ this->Entries.insert(this->Entries.begin(),tmp.begin(),tmp.end());
+}
+
+//----------------------------------------------------------------------------
void cmDocumentationSection::Append(const char *n, const char *b,
const char *f)
{
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
index 60e735b..97a15af 100644
--- a/Source/cmDocumentationSection.h
+++ b/Source/cmDocumentationSection.h
@@ -56,11 +56,10 @@ public:
/** Append an entry to this section using NULL terminated chars */
void Append(const char *[][3]);
void Append(const char *n, const char *b, const char *f);
-
- /** Set the contents of this section. */
-// void Set(const std::vector<cmDocumentationEntry> header,
-// const std::vector<cmDocumentationEntry> section,
-// const std::vector<cmDocumentationEntry> footer);
+
+ /** prepend some documentation to this section */
+ void Prepend(const char *[][3]);
+
private:
std::string Name;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e7a850c..df5f37b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -300,9 +300,9 @@ int do_cmake(int ac, char** av)
std::vector<cmDocumentationEntry> commands;
std::vector<cmDocumentationEntry> compatCommands;
+ std::vector<cmDocumentationEntry> generators;
std::map<std::string,cmDocumentationSection *> propDocs;
- std::vector<cmDocumentationEntry> generators;
hcm.GetCommandDocumentation(commands, true, false);
hcm.GetCommandDocumentation(compatCommands, false, true);
hcm.GetPropertiesDocumentation(propDocs);
@@ -312,8 +312,8 @@ int do_cmake(int ac, char** av)
doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
- doc.SetSection("Generators",generators);
- doc.SetSection("Options",cmDocumentationOptions);
+ doc.AppendSection("Generators",generators);
+ doc.PrependSection("Options",cmDocumentationOptions);
doc.SetSection("Commands",commands);
doc.SetSection("Compatibility Commands",compatCommands);
doc.SetSections(propDocs);