/src/CMake/Source/cmDocumentationSection.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <iterator> |
8 | | #include <string> |
9 | | #include <vector> |
10 | | |
11 | | #include "cmDocumentationEntry.h" |
12 | | |
13 | | // Low-level interface for custom documents: |
14 | | /** Internal class representing a section of the documentation. |
15 | | * Cares e.g. for the different section titles in the different |
16 | | * output formats. |
17 | | */ |
18 | | class cmDocumentationSection |
19 | | { |
20 | | public: |
21 | | /** Create a cmSection, with a special name for man-output mode. */ |
22 | | explicit cmDocumentationSection(char const* name) |
23 | 0 | : Name(name) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | /** Has any content been added to this section or is it empty ? */ |
28 | 0 | bool IsEmpty() const { return this->Entries.empty(); } |
29 | | |
30 | | /** Clear contents. */ |
31 | 0 | void Clear() { this->Entries.clear(); } |
32 | | |
33 | | /** Return the name of this section. */ |
34 | 0 | std::string GetName() const { return this->Name; } |
35 | | |
36 | | /** Return a pointer to the first entry of this section. */ |
37 | | std::vector<cmDocumentationEntry> const& GetEntries() const |
38 | 0 | { |
39 | 0 | return this->Entries; |
40 | 0 | } |
41 | | |
42 | | /** Append an entry to this section. */ |
43 | | void Append(cmDocumentationEntry const& entry) |
44 | 0 | { |
45 | 0 | this->Entries.push_back(entry); |
46 | 0 | } |
47 | | |
48 | | template <typename Iterable> |
49 | | void Append(Iterable const& entries) |
50 | 0 | { |
51 | 0 | this->Entries.insert(std::end(this->Entries), std::begin(entries), |
52 | 0 | std::end(entries)); |
53 | 0 | } Unexecuted instantiation: void cmDocumentationSection::Append<std::__1::vector<cmDocumentationEntry, std::__1::allocator<cmDocumentationEntry> > >(std::__1::vector<cmDocumentationEntry, std::__1::allocator<cmDocumentationEntry> > const&) Unexecuted instantiation: void cmDocumentationSection::Append<cmDocumentationEntry [21]>(cmDocumentationEntry const (&) [21]) |
54 | | |
55 | | /** prepend some documentation to this section */ |
56 | | template <typename Iterable> |
57 | | void Prepend(Iterable const& entries) |
58 | 0 | { |
59 | 0 | this->Entries.insert(std::begin(this->Entries), std::begin(entries), |
60 | 0 | std::end(entries)); |
61 | 0 | } |
62 | | |
63 | | private: |
64 | | std::string Name; |
65 | | std::vector<cmDocumentationEntry> Entries; |
66 | | }; |