2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2007-09-19 17:05:28 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2007-09-19 17:05:28 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2007-09-19 17:05:28 +04:00
|
|
|
|
|
|
|
#include "cmDocumentationFormatterUsage.h"
|
2007-10-22 20:49:09 +04:00
|
|
|
#include "cmDocumentationSection.h"
|
2007-09-19 17:05:28 +04:00
|
|
|
|
|
|
|
cmDocumentationFormatterUsage::cmDocumentationFormatterUsage()
|
|
|
|
:cmDocumentationFormatterText()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-22 20:49:09 +04:00
|
|
|
void cmDocumentationFormatterUsage
|
|
|
|
::PrintSection(std::ostream& os,
|
|
|
|
const cmDocumentationSection §ion,
|
|
|
|
const char* name)
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
os << name << "\n";
|
|
|
|
}
|
2007-10-22 20:49:09 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
const std::vector<cmDocumentationEntry> &entries =
|
2007-10-22 20:49:09 +04:00
|
|
|
section.GetEntries();
|
2012-08-13 21:42:58 +04:00
|
|
|
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
|
2007-10-22 20:49:09 +04:00
|
|
|
op != entries.end(); ++op)
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
2007-10-22 20:49:09 +04:00
|
|
|
if(op->Name.size())
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
2007-10-22 20:49:09 +04:00
|
|
|
os << " " << op->Name;
|
2007-09-19 17:05:28 +04:00
|
|
|
this->TextIndent = " ";
|
|
|
|
int align = static_cast<int>(strlen(this->TextIndent))-4;
|
2007-10-22 20:49:09 +04:00
|
|
|
for(int i = static_cast<int>(op->Name.size()); i < align; ++i)
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
|
|
|
os << " ";
|
|
|
|
}
|
2007-10-22 20:49:09 +04:00
|
|
|
if (op->Name.size() > strlen(this->TextIndent)-4 )
|
2007-09-19 17:05:28 +04:00
|
|
|
{
|
|
|
|
os << "\n";
|
|
|
|
os.write(this->TextIndent, strlen(this->TextIndent)-2);
|
|
|
|
}
|
|
|
|
os << "= ";
|
2007-10-22 20:49:09 +04:00
|
|
|
this->PrintColumn(os, op->Brief.c_str());
|
2007-09-19 17:05:28 +04:00
|
|
|
os << "\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
os << "\n";
|
|
|
|
this->TextIndent = "";
|
2007-10-22 20:49:09 +04:00
|
|
|
this->PrintFormatted(os, op->Brief.c_str());
|
2007-09-19 17:05:28 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
os << "\n";
|
|
|
|
}
|
|
|
|
|