|
70 | 70 | #define DB_GEN_C2a(x,y)
|
71 | 71 | #endif
|
72 | 72 |
|
73 |
| - |
74 |
| -// helper defines for opening / closing sections |
75 |
| -// currently only closing. possible also usage for debug. |
76 |
| - |
77 |
| -#define OPEN_SECTION(mt) \ |
78 |
| - { \ |
79 |
| - mt << "<section>\n"; \ |
80 |
| - m_openSection++; \ |
81 |
| - } |
82 |
| -#define OPEN_SECTION1(mt,txt) \ |
83 |
| - { \ |
84 |
| - mt << "<section " << txt <<">\n"; \ |
85 |
| - m_openSection++; \ |
86 |
| - } |
87 |
| -#define CLOSE_SECTION(mt) \ |
88 |
| - { \ |
89 |
| - mt << "</section>\n"; \ |
90 |
| - m_openSection--; \ |
91 |
| - } |
92 | 73 | //------------------
|
93 | 74 |
|
94 | 75 | inline void writeDocbookString(TextStream &t,const QCString &s)
|
@@ -374,10 +355,7 @@ DB_GEN_C
|
374 | 355 | void DocbookGenerator::endFile()
|
375 | 356 | {
|
376 | 357 | DB_GEN_C
|
377 |
| - while (m_openSection > 0) |
378 |
| - { |
379 |
| - CLOSE_SECTION(m_t); |
380 |
| - } |
| 358 | + closeAllSections(); |
381 | 359 | m_inLevel = -1;
|
382 | 360 | m_inGroup = FALSE;
|
383 | 361 |
|
@@ -769,16 +747,16 @@ DB_GEN_C2("extraIndentLevel " << extraIndentLevel)
|
769 | 747 | if (m_inSimpleSect[m_levelListItem]) m_t << "</simplesect>\n";
|
770 | 748 | m_inSimpleSect[m_levelListItem] = FALSE;
|
771 | 749 | if (m_inLevel != -1) m_inGroup = TRUE;
|
772 |
| - if (m_inLevel == extraIndentLevel) CLOSE_SECTION(m_t); |
| 750 | + if (m_inLevel == extraIndentLevel) closeSection(); |
773 | 751 | m_inLevel = extraIndentLevel;
|
774 |
| - OPEN_SECTION(m_t); |
| 752 | + openSection(); |
775 | 753 | m_t << "<title>";
|
776 | 754 | }
|
777 | 755 | void DocbookGenerator::writeRuler()
|
778 | 756 | {
|
779 | 757 | DB_GEN_C2("m_inLevel " << m_inLevel)
|
780 | 758 | DB_GEN_C2("m_inGroup " << m_inGroup)
|
781 |
| - if (m_inGroup) CLOSE_SECTION(m_t); |
| 759 | + if (m_inGroup) closeSection(); |
782 | 760 | m_inGroup = FALSE;
|
783 | 761 | }
|
784 | 762 |
|
@@ -839,7 +817,7 @@ void DocbookGenerator::startMemberDoc(const QCString &clname, const QCString &me
|
839 | 817 | int memCount, int memTotal, bool)
|
840 | 818 | {
|
841 | 819 | DB_GEN_C2("m_inLevel " << m_inLevel)
|
842 |
| - OPEN_SECTION(m_t); |
| 820 | + openSection(); |
843 | 821 | m_t << " <title>" << convertToDocBook(title);
|
844 | 822 | if (memTotal>1)
|
845 | 823 | {
|
@@ -875,7 +853,7 @@ void DocbookGenerator::startDoxyAnchor(const QCString &fName,const QCString &,
|
875 | 853 | DB_GEN_C
|
876 | 854 | if (!m_inListItem[m_levelListItem] && !m_descTable && !m_simpleTable)
|
877 | 855 | {
|
878 |
| - if (!m_firstMember) CLOSE_SECTION(m_t); |
| 856 | + if (!m_firstMember) closeSection(); |
879 | 857 | m_firstMember = FALSE;
|
880 | 858 | }
|
881 | 859 | if (!anchor.isEmpty())
|
@@ -1032,14 +1010,14 @@ DB_GEN_C
|
1032 | 1010 | void DocbookGenerator::startSection(const QCString &lab,const QCString &,SectionType)
|
1033 | 1011 | {
|
1034 | 1012 | DB_GEN_C
|
1035 |
| - OPEN_SECTION1(m_t, "xml:id=\"_" + stripPath(lab) + "\""); |
| 1013 | + openSection("xml:id=\"_" + stripPath(lab) + "\""); |
1036 | 1014 | m_t << "<title>";
|
1037 | 1015 | }
|
1038 | 1016 | void DocbookGenerator::endSection(const QCString &,SectionType)
|
1039 | 1017 | {
|
1040 | 1018 | DB_GEN_C
|
1041 | 1019 | m_t << "</title>";
|
1042 |
| - CLOSE_SECTION(m_t); |
| 1020 | + closeSection(); |
1043 | 1021 | }
|
1044 | 1022 | void DocbookGenerator::addIndexItem(const QCString &prim,const QCString &sec)
|
1045 | 1023 | {
|
@@ -1269,3 +1247,26 @@ void DocbookGenerator::endConstraintList()
|
1269 | 1247 | DB_GEN_C
|
1270 | 1248 | m_t << "</simplesect>\n";
|
1271 | 1249 | }
|
| 1250 | + |
| 1251 | +void DocbookGenerator::openSection(const QCString &attr) |
| 1252 | +{ |
| 1253 | + m_t << "<section"; |
| 1254 | + if (!attr.isEmpty()) m_t << " " << attr; |
| 1255 | + m_t << ">\n"; |
| 1256 | + m_openSectionCount++; |
| 1257 | +} |
| 1258 | + |
| 1259 | +void DocbookGenerator::closeSection() |
| 1260 | +{ |
| 1261 | + m_t << "</section>\n"; |
| 1262 | + m_openSectionCount--; |
| 1263 | +} |
| 1264 | + |
| 1265 | +void DocbookGenerator::closeAllSections() |
| 1266 | +{ |
| 1267 | + while (m_openSectionCount>0) |
| 1268 | + { |
| 1269 | + closeSection(); |
| 1270 | + } |
| 1271 | +} |
| 1272 | + |
0 commit comments