ENH: Return utility target after creation
[cmake.git] / Source / cmDocumentationFormatterUsage.cxx
blob7ddaf21a51f2abadb9098aefa8ddfed3ed6c9eac
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDocumentationFormatterUsage.cxx,v $
5 Language: C++
6 Date: $Date: 2007-10-22 16:48:39 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #include "cmDocumentationFormatterUsage.h"
19 #include "cmDocumentationSection.h"
21 cmDocumentationFormatterUsage::cmDocumentationFormatterUsage()
22 :cmDocumentationFormatterText()
26 void cmDocumentationFormatterUsage
27 ::PrintSection(std::ostream& os,
28 const cmDocumentationSection &section,
29 const char* name)
31 if(name)
33 os << name << "\n";
36 const std::vector<cmDocumentationEntry> &entries =
37 section.GetEntries();
38 for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
39 op != entries.end(); ++op)
41 if(op->Name.size())
43 os << " " << op->Name;
44 this->TextIndent = " ";
45 int align = static_cast<int>(strlen(this->TextIndent))-4;
46 for(int i = static_cast<int>(op->Name.size()); i < align; ++i)
48 os << " ";
50 if (op->Name.size() > strlen(this->TextIndent)-4 )
52 os << "\n";
53 os.write(this->TextIndent, strlen(this->TextIndent)-2);
55 os << "= ";
56 this->PrintColumn(os, op->Brief.c_str());
57 os << "\n";
59 else
61 os << "\n";
62 this->TextIndent = "";
63 this->PrintFormatted(os, op->Brief.c_str());
66 os << "\n";