The QhpSectionTree
Class Reference
Declaration
class QhpSectionTree { ... }
Public Member Functions Index
void | addSection (const QCString &title, const QCString &ref) |
void | incLevel () |
void | decLevel () |
void | writeToc (TextStream &t) const |
Private Member Functions Index
void | traverse (const Node &root, TextStream &t, int indent) const |
Private Member Attributes Index
Node | m_root |
Node * | m_current = &m_root |
Definition at line 45 of file qhp.cpp.
Public Member Functions
addSection()
decLevel()
| inline |
incLevel()
| inline |
writeToc()
| inline |
Definition at line 141 of file qhp.cpp.
141 void writeToc(TextStream &t) const
142 {
143 writeIndent(t,2);
144 t << "<toc>\n";
146 writeIndent(t,2);
147 t << "</toc>\n";
148 }
References m_root, traverse and writeIndent.
Private Member Functions
traverse()
| inline |
Definition at line 68 of file qhp.cpp.
68 void traverse(const Node &root,TextStream &t,int indent) const
69 {
70 /* Input: Output:
71 * =================================================
72 * Section1 <section title=".." ref="..">
73 * Dir1
74 * Section2 <section title=".." ref="..">
75 * Dir2
76 * Section3 <section title=".." ref=".."/>
77 * </section>
78 * </section>
79 * Section4 <section title=".." ref="..>
80 * Dir3
81 * Dir4
82 * Section5 <section title=.." ref=.."/>
83 * </section>
84 * Section6 <section title=".." ref=".."/>
85 */
86 size_t numChildren = root.children.size();
87 size_t i=0;
88 while (i<numChildren)
89 {
90 if (root.children[i]->type==Node::Type::Section)
91 {
92 i++;
93 if (i<numChildren && root.children[i]->type==Node::Type::Dir)
94 {
95 // we have a dir node
96 writeIndent(t,indent);
97 t << "<section title=\"" << convertToXML(root.children[i-1]->title) << "\""
98 << " ref=\"" << convertToXML(root.children[i-1]->ref) << "\">\n";
99 while (i<numChildren && root.children[i]->type==Node::Type::Dir)
100 {
102 i++;
103 }
104 writeIndent(t,indent);
105 t << "</section>\n";
106 }
107 else // we have a leaf section node
108 {
109 writeIndent(t,indent);
110 t << "<section title=\"" << convertToXML(root.children[i-1]->title) << "\""
111 << " ref=\"" << convertToXML(root.children[i-1]->ref) << "\"/>\n";
112 }
113 }
114 else // dir without preceding section (no extra indent)
115 {
117 i++;
118 }
119 }
120 }
References QhpSectionTree::Node::children, convertToXML, QhpSectionTree::Node::Dir, QhpSectionTree::Node::Section, traverse and writeIndent.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus by Doxygen 1.14.0.