2009-10-02 01:21: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-10-02 01:21: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-10-02 01:21: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
|
|
|
|
|
|
|
const std::vector<cmDocumentationEntry> &entries =
|
|
|
|
section.GetEntries();
|
|
|
|
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
|