1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #ifndef _cmDocumentationSection_h
13 #define _cmDocumentationSection_h
15 #include "cmStandardIncludes.h"
16 #include "cmDocumentationFormatter.h"
18 // Low-level interface for custom documents:
19 /** Internal class representing a section of the documentation.
20 * Cares e.g. for the different section titles in the different
23 class cmDocumentationSection
26 /** Create a cmSection, with a special name for man-output mode. */
27 cmDocumentationSection(const char* name, const char* manName)
28 :Name(name), ManName(manName) {}
30 /** Has any content been added to this section or is it empty ? */
31 bool IsEmpty() const { return this->Entries.empty(); }
33 /** Clear contents. */
34 void Clear() { this->Entries.clear(); }
36 /** Return the name of this section for the given output form. */
37 const char* GetName(cmDocumentationEnums::Form form) const
38 { return (form==cmDocumentationEnums::ManForm ?
39 this->ManName.c_str() : this->Name.c_str()); }
41 /** Return a pointer to the first entry of this section. */
42 const std::vector<cmDocumentationEntry> &GetEntries() const
43 { return this->Entries; }
45 /** Append an entry to this section. */
46 void Append(const cmDocumentationEntry& entry)
47 { this->Entries.push_back(entry); }
48 void Append(const std::vector<cmDocumentationEntry> &entries)
49 { this->Entries.insert(this->Entries.end(),entries.begin(),entries.end()); }
51 /** Append an entry to this section using NULL terminated chars */
52 void Append(const char *[][3]);
53 void Append(const char *n, const char *b, const char *f);
55 /** prepend some documentation to this section */
56 void Prepend(const char *[][3]);
57 void Prepend(const std::vector<cmDocumentationEntry> &entries)
58 { this->Entries.insert(this->Entries.begin(),
59 entries.begin(),entries.end()); }
65 std::vector<cmDocumentationEntry> Entries;