COMP: fix some warnings and add some doc strings back in

This commit is contained in:
Ken Martin 2007-10-22 15:33:19 -04:00
parent 5765fbbb88
commit 44cce51a1a
5 changed files with 109 additions and 74 deletions

View File

@ -103,71 +103,6 @@ static const char *cmCompatCommandsDocumentationDescription[][3] =
{0,0,0} {0,0,0}
}; };
//----------------------------------------------------------------------------
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] = static const char *cmDocumentationModulesHeader[][3] =
{ {
@ -288,6 +223,18 @@ cmDocumentation::cmDocumentation()
sec = new cmDocumentationSection("See Also","SEE ALSO"); sec = new cmDocumentationSection("See Also","SEE ALSO");
sec->Append(cmDocumentationStandardSeeAlso); sec->Append(cmDocumentationStandardSeeAlso);
this->AllSections["Standard See Also"] = sec; 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; 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"); this->PrintDocumentationList(os,"Modules");
return true; return true;
case cmDocumentation::PropertyList: case cmDocumentation::PropertyList:
this->PrintDocumentationList(os,"Properties Description");
this->PrintDocumentationList(os,"Properties of Global Scope"); this->PrintDocumentationList(os,"Properties of Global Scope");
this->PrintDocumentationList(os,"Properties on Directories"); this->PrintDocumentationList(os,"Properties on Directories");
this->PrintDocumentationList(os,"Properties on Targets"); this->PrintDocumentationList(os,"Properties on Targets");
@ -414,7 +368,8 @@ bool cmDocumentation::CreateModulesSection()
dir.Load(cmakeModules.c_str()); dir.Load(cmakeModules.c_str());
if (dir.GetNumberOfFiles() > 0) if (dir.GetNumberOfFiles() > 0)
{ {
this->AllSections["Modules"]->Append(cmDocumentationModulesHeader[0]); sec->Append(cmDocumentationModulesHeader[0]);
sec->Append(cmModulesDocumentationDescription);
this->CreateModuleDocsForDir(dir, *this->AllSections["Modules"]); this->CreateModuleDocsForDir(dir, *this->AllSections["Modules"]);
} }
return true; return true;
@ -442,6 +397,7 @@ bool cmDocumentation::CreateCustomModulesSection()
new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES"); new cmDocumentationSection("Custom CMake Modules","CUSTOM MODULES");
this->AllSections["Custom CMake Modules"] = sec; this->AllSections["Custom CMake Modules"] = sec;
sec->Append(cmDocumentationCustomModulesHeader[0]); sec->Append(cmDocumentationCustomModulesHeader[0]);
sec->Append(cmCustomModulesDocumentationDescription);
sectionHasHeader = true; sectionHasHeader = true;
} }
this->CreateModuleDocsForDir this->CreateModuleDocsForDir
@ -855,6 +811,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]) void cmDocumentation::SetSeeAlsoList(const char *data[][3])
{ {

View File

@ -73,6 +73,14 @@ public:
void SetSections(std::map<std::string,cmDocumentationSection *> void SetSections(std::map<std::string,cmDocumentationSection *>
&sections); &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 * Print documentation in the given form. All previously added
* sections will be generated. * sections will be generated.

View File

@ -30,6 +30,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, void cmDocumentationSection::Append(const char *n, const char *b,
const char *f) const char *f)

View File

@ -56,11 +56,10 @@ public:
/** Append an entry to this section using NULL terminated chars */ /** Append an entry to this section using NULL terminated chars */
void Append(const char *[][3]); void Append(const char *[][3]);
void Append(const char *n, const char *b, const char *f); void Append(const char *n, const char *b, const char *f);
/** Set the contents of this section. */ /** prepend some documentation to this section */
// void Set(const std::vector<cmDocumentationEntry> header, void Prepend(const char *[][3]);
// const std::vector<cmDocumentationEntry> section,
// const std::vector<cmDocumentationEntry> footer);
private: private:
std::string Name; std::string Name;

View File

@ -300,9 +300,9 @@ int do_cmake(int ac, char** av)
std::vector<cmDocumentationEntry> commands; std::vector<cmDocumentationEntry> commands;
std::vector<cmDocumentationEntry> compatCommands; std::vector<cmDocumentationEntry> compatCommands;
std::vector<cmDocumentationEntry> generators;
std::map<std::string,cmDocumentationSection *> propDocs; std::map<std::string,cmDocumentationSection *> propDocs;
std::vector<cmDocumentationEntry> generators;
hcm.GetCommandDocumentation(commands, true, false); hcm.GetCommandDocumentation(commands, true, false);
hcm.GetCommandDocumentation(compatCommands, false, true); hcm.GetCommandDocumentation(compatCommands, false, true);
hcm.GetPropertiesDocumentation(propDocs); hcm.GetPropertiesDocumentation(propDocs);
@ -312,8 +312,8 @@ int do_cmake(int ac, char** av)
doc.SetSection("Name",cmDocumentationName); doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage); doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription); doc.SetSection("Description",cmDocumentationDescription);
doc.SetSection("Generators",generators); doc.AppendSection("Generators",generators);
doc.SetSection("Options",cmDocumentationOptions); doc.PrependSection("Options",cmDocumentationOptions);
doc.SetSection("Commands",commands); doc.SetSection("Commands",commands);
doc.SetSection("Compatibility Commands",compatCommands); doc.SetSection("Compatibility Commands",compatCommands);
doc.SetSections(propDocs); doc.SetSections(propDocs);