2007-09-19 17:05:28 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#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";
|
|
|
|
}
|
|
|
|
|