diff options
Diffstat (limited to 'src/xmlgen.cpp')
-rw-r--r-- | src/xmlgen.cpp | 153 |
1 files changed, 74 insertions, 79 deletions
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 19f1553..1993c1e 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -226,6 +226,7 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf FTextStream &m_t; }; +//------------------------------------------------------------------------------------------- /** Generator for producing XML formatted source code. */ void XMLCodeGenerator::codify(const char *text) @@ -340,6 +341,18 @@ void XMLCodeGenerator::finish() if (m_insideCodeLine) endCodeLine(); } +void XMLCodeGenerator::startCodeFragment(const char *) +{ + m_t << " <programlisting>" << endl; +} + +void XMLCodeGenerator::endCodeFragment(const char *) +{ + m_t << " </programlisting>" << endl; +} + +//------------------------------------------------------------------------------------------- + static void writeTemplateArgumentList(FTextStream &t, const ArgumentList &al, const Definition *scope, @@ -420,11 +433,12 @@ static void writeXMLDocBlock(FTextStream &t, void writeXMLCodeBlock(FTextStream &t,FileDef *fd) { - CodeParserInterface &intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); + auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); - intf.resetCodeParserState(); + intf->resetCodeParserState(); XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t); - intf.parseCode(*xmlGen, // codeOutIntf + xmlGen->startCodeFragment("DoxyCode"); + intf->parseCode(*xmlGen, // codeOutIntf 0, // scopeName fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)), langExt, // lang @@ -437,6 +451,7 @@ void writeXMLCodeBlock(FTextStream &t,FileDef *fd) 0, // memberDef TRUE // showLineNumbers ); + xmlGen->endCodeFragment("DoxyCode"); xmlGen->finish(); delete xmlGen; } @@ -1006,23 +1021,15 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream } //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers()); - MemberSDict *mdict = md->getReferencesMembers(); - if (mdict) + auto refList = md->getReferencesMembers(); + for (const auto &refmd : refList) { - MemberSDict::Iterator mdi(*mdict); - for (mdi.toFirst();(rmd=mdi.current());++mdi) - { - writeMemberReference(t,def,rmd,"references"); - } + writeMemberReference(t,def,refmd,"references"); } - mdict = md->getReferencedByMembers(); - if (mdict) + auto refByList = md->getReferencedByMembers(); + for (const auto &refmd : refByList) { - MemberSDict::Iterator mdi(*mdict); - for (mdi.toFirst();(rmd=mdi.current());++mdi) - { - writeMemberReference(t,def,rmd,"referencedby"); - } + writeMemberReference(t,def,refmd,"referencedby"); } t << " </memberdef>" << endl; @@ -1279,73 +1286,63 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) t << " <compoundname>"; writeXMLString(t,cd->name()); t << "</compoundname>" << endl; - if (cd->baseClasses()) + for (const auto &bcd : cd->baseClasses()) { - BaseClassListIterator bcli(*cd->baseClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) + t << " <basecompoundref "; + if (bcd.classDef->isLinkable()) { - t << " <basecompoundref "; - if (bcd->classDef->isLinkable()) - { - t << "refid=\"" << classOutputFileBase(bcd->classDef) << "\" "; - } - t << "prot=\""; - switch (bcd->prot) - { - case Public: t << "public"; break; - case Protected: t << "protected"; break; - case Private: t << "private"; break; - case Package: ASSERT(0); break; - } - t << "\" virt=\""; - switch(bcd->virt) - { - case Normal: t << "non-virtual"; break; - case Virtual: t << "virtual"; break; - case Pure: t <<"pure-virtual"; break; - } - t << "\">"; - if (!bcd->templSpecifiers.isEmpty()) - { - t << convertToXML( - insertTemplateSpecifierInScope( - bcd->classDef->name(),bcd->templSpecifiers) - ); - } - else - { - t << convertToXML(bcd->classDef->displayName()); - } - t << "</basecompoundref>" << endl; + t << "refid=\"" << classOutputFileBase(bcd.classDef) << "\" "; + } + t << "prot=\""; + switch (bcd.prot) + { + case Public: t << "public"; break; + case Protected: t << "protected"; break; + case Private: t << "private"; break; + case Package: ASSERT(0); break; } + t << "\" virt=\""; + switch(bcd.virt) + { + case Normal: t << "non-virtual"; break; + case Virtual: t << "virtual"; break; + case Pure: t <<"pure-virtual"; break; + } + t << "\">"; + if (!bcd.templSpecifiers.isEmpty()) + { + t << convertToXML( + insertTemplateSpecifierInScope( + bcd.classDef->name(),bcd.templSpecifiers) + ); + } + else + { + t << convertToXML(bcd.classDef->displayName()); + } + t << "</basecompoundref>" << endl; } - if (cd->subClasses()) + for (const auto &bcd : cd->subClasses()) { - BaseClassListIterator bcli(*cd->subClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) + t << " <derivedcompoundref refid=\"" + << classOutputFileBase(bcd.classDef) + << "\" prot=\""; + switch (bcd.prot) { - t << " <derivedcompoundref refid=\"" - << classOutputFileBase(bcd->classDef) - << "\" prot=\""; - switch (bcd->prot) - { - case Public: t << "public"; break; - case Protected: t << "protected"; break; - case Private: t << "private"; break; - case Package: ASSERT(0); break; - } - t << "\" virt=\""; - switch(bcd->virt) - { - case Normal: t << "non-virtual"; break; - case Virtual: t << "virtual"; break; - case Pure: t << "pure-virtual"; break; - } - t << "\">" << convertToXML(bcd->classDef->displayName()) - << "</derivedcompoundref>" << endl; + case Public: t << "public"; break; + case Protected: t << "protected"; break; + case Private: t << "private"; break; + case Package: ASSERT(0); break; + } + t << "\" virt=\""; + switch (bcd.virt) + { + case Normal: t << "non-virtual"; break; + case Virtual: t << "virtual"; break; + case Pure: t << "pure-virtual"; break; } + t << "\">" << convertToXML(bcd.classDef->displayName()) + << "</derivedcompoundref>" << endl; } IncludeInfo *ii=cd->includeInfo(); @@ -1639,9 +1636,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti) t << " </detaileddescription>" << endl; if (Config_getBool(XML_PROGRAMLISTING)) { - t << " <programlisting>" << endl; writeXMLCodeBlock(t,fd); - t << " </programlisting>" << endl; } t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>" << endl; t << " </compounddef>" << endl; |