From 55063c91fa74921d0c5c7c84d1784ce617f0d53b Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 17 Oct 2018 11:11:53 +0200 Subject: Remove old obsolete docbook generator The docbook generator has been replaced by a new implementation. The old implementation was still present, removed now (disrupts easy updates due to false positive searches in the code). --- src/docbookgen.cpp | 2147 ---------------------------------------------------- src/docbookgen.h | 2 - src/doxygen.cpp | 11 - 3 files changed, 2160 deletions(-) diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index bfec8bf..8c8ed90 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -70,52 +70,6 @@ #endif //------------------ -class DocbookSectionMapper : public QIntDict -{ - public: - DocbookSectionMapper() : QIntDict(47) - { - insert(MemberListType_pubTypes,"public-type"); - insert(MemberListType_pubMethods,"public-func"); - insert(MemberListType_pubAttribs,"public-attrib"); - insert(MemberListType_pubSlots,"public-slot"); - insert(MemberListType_signals,"signal"); - insert(MemberListType_dcopMethods,"dcop-func"); - insert(MemberListType_properties,"property"); - insert(MemberListType_events,"event"); - insert(MemberListType_pubStaticMethods,"public-static-func"); - insert(MemberListType_pubStaticAttribs,"public-static-attrib"); - insert(MemberListType_proTypes,"protected-type"); - insert(MemberListType_proMethods,"protected-func"); - insert(MemberListType_proAttribs,"protected-attrib"); - insert(MemberListType_proSlots,"protected-slot"); - insert(MemberListType_proStaticMethods,"protected-static-func"); - insert(MemberListType_proStaticAttribs,"protected-static-attrib"); - insert(MemberListType_pacTypes,"package-type"); - insert(MemberListType_pacMethods,"package-func"); - insert(MemberListType_pacAttribs,"package-attrib"); - insert(MemberListType_pacStaticMethods,"package-static-func"); - insert(MemberListType_pacStaticAttribs,"package-static-attrib"); - insert(MemberListType_priTypes,"private-type"); - insert(MemberListType_priMethods,"private-func"); - insert(MemberListType_priAttribs,"private-attrib"); - insert(MemberListType_priSlots,"private-slot"); - insert(MemberListType_priStaticMethods,"private-static-func"); - insert(MemberListType_priStaticAttribs,"private-static-attrib"); - insert(MemberListType_friends,"friend"); - insert(MemberListType_related,"related"); - insert(MemberListType_decDefineMembers,"define"); - insert(MemberListType_decProtoMembers,"prototype"); - insert(MemberListType_decTypedefMembers,"typedef"); - insert(MemberListType_decEnumMembers,"enum"); - insert(MemberListType_decFuncMembers,"func"); - insert(MemberListType_decVarMembers,"var"); - } -}; - -static DocbookSectionMapper g_docbookSectionMapper; - - inline void writeDocbookString(FTextStream &t,const char *s) { t << convertToDocBook(s); @@ -149,20 +103,6 @@ inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col) } } -static void writeDocbookHeaderMainpage(FTextStream &t, QCString &pageName) -{ - t << "" << endl;; - t << "" << endl; -} - -static void writeDocbookHeader_ID(FTextStream &t, QCString id) -{ - t << "" << endl;; - t << "
" << endl; -} - static void addIndexTerm(FTextStream &t, QCString prim, QCString sec = "") { t << ""; @@ -187,25 +127,6 @@ void writeDocbookLink(FTextStream &t,const char * /*extRef*/,const char *compoun t << ""; } -class TextGeneratorDocbookImpl : public TextGeneratorIntf -{ - public: - TextGeneratorDocbookImpl(FTextStream &t): m_t(t) {} - void writeString(const char *s,bool /*keepSpaces*/) const - { - writeDocbookString(m_t,s); - } - void writeBreak(int) const {} - void writeLink(const char *extRef,const char *file, - const char *anchor,const char *text - ) const - { - writeDocbookLink(m_t,extRef,file,anchor,text,0); - } - private: - FTextStream &m_t; -}; - DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) : m_lineNumber(-1), m_col(0), m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE) { @@ -328,2074 +249,6 @@ void DocbookCodeGenerator::endCodeFragment() m_t << "" << endl; } -static void writeTemplateArgumentList(ArgumentList *al, - FTextStream &t, - Definition *scope, - FileDef *fileScope, - int indent) -{ - QCString indentStr; - indentStr.fill(' ',indent); - if (al) - { - t << indentStr << "" << endl; - ArgumentListIterator ali(*al); - Argument *a; - for (ali.toFirst();(a=ali.current());++ali) - { - t << indentStr << " " << endl; - if (!a->type.isEmpty()) - { - t << indentStr << " "; - linkifyText(TextGeneratorDocbookImpl(t),scope,fileScope,0,a->type); - t << "" << endl; - } - if (!a->name.isEmpty()) - { - t << indentStr << " " << a->name << "" << endl; - t << indentStr << " " << a->name << "" << endl; - } - if (!a->defval.isEmpty()) - { - t << indentStr << " "; - linkifyText(TextGeneratorDocbookImpl(t),scope,fileScope,0,a->defval); - t << "" << endl; - } - t << indentStr << " " << endl; - } - t << indentStr << "" << endl; - } -} - -static void writeTemplateList(ClassDef *cd,FTextStream &t) -{ - writeTemplateArgumentList(cd->templateArguments(),t,cd,0,4); -} - -static void writeDocbookDocBlock(FTextStream &t, - const QCString &fileName, - int lineNr, - Definition *scope, - MemberDef * md, - const QCString &text) -{ - QCString stext = text.stripWhiteSpace(); - if (stext.isEmpty()) return; - // convert the documentation string into an abstract syntax tree - DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,text,FALSE,FALSE); - // create a code generator - DocbookCodeGenerator *docbookCodeGen = new DocbookCodeGenerator(t); - // create a parse tree visitor for Docbook - DocbookDocVisitor *visitor = new DocbookDocVisitor(t,*docbookCodeGen); - // visit all nodes - root->accept(visitor); - // clean up - delete visitor; - delete docbookCodeGen; - delete root; -} - -void writeDocbookCodeBlock(FTextStream &t,FileDef *fd) -{ - ParserInterface *pIntf=Doxygen::parserManager->getParser(fd->getDefFileExtension()); - SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); - pIntf->resetCodeParserState(); - DocbookCodeGenerator *docbookGen = new DocbookCodeGenerator(t); - pIntf->parseCode(*docbookGen, // codeOutIntf - 0, // scopeName - fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)), - langExt, // lang - FALSE, // isExampleBlock - 0, // exampleName - fd, // fileDef - -1, // startLine - -1, // endLine - FALSE, // inlineFragement - 0, // memberDef - TRUE // showLineNumbers - ); - docbookGen->finish(); - delete docbookGen; -} - -static QCString classOutputFileBase(ClassDef *cd) -{ - //static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); - //if (inlineGroupedClasses && cd->partOfGroups()!=0) - return cd->getOutputFileBase(); - //else - // return cd->getOutputFileBase(); -} - -static QCString memberOutputFileBase(MemberDef *md) -{ - //static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); - //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0) - // return md->getClassDef()->getDocbookOutputFileBase(); - //else - // return md->getOutputFileBase(); - return md->getOutputFileBase(); -} - -static void generateTOC(FTextStream &t, PageDef *pd) -{ - if (pd->localToc().isDocbookEnabled()) - { - t << " " << endl; - t << " " << theTranslator->trRTFTableOfContents() << "" << endl; - SectionDict *sectionDict = pd->getSectionDict(); - SDict::Iterator li(*sectionDict); - SectionInfo *si; - int level=1,l; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; - int maxLevel = pd->localToc().docbookLevel(); - for (li.toFirst();(si=li.current());++li) - { - if (si->type==SectionInfo::Section || - si->type==SectionInfo::Subsection || - si->type==SectionInfo::Subsubsection || - si->type==SectionInfo::Paragraph) - { - //printf(" level=%d title=%s\n",level,si->title.data()); - int nextLevel = (int)si->type; - if (nextLevel>level) - { - for (l=level;l" << endl; - } - } - else if (nextLevelnextLevel;l--) - { - inLi[l]=FALSE; - if (l <= maxLevel) t << " " << endl; - } - } - if (nextLevel <= maxLevel) - { - QCString titleDoc = convertToDocBook(si->title); - t << " " << (si->title.isEmpty()?si->label:titleDoc) << "" << endl; - } - inLi[nextLevel]=TRUE; - level = nextLevel; - } - } - t << " " << endl; - } -} - -static void generateSourceRefList(FTextStream &t,const char *scopeName, const QCString &text,MemberSDict *members, Definition *def) -{ - static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); - static bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE); - - if (members) - { - members->sort(); - - t << "" << convertToDocBook(text) << ""; - - QCString ldefLine=theTranslator->trWriteList(members->count()); - - QRegExp marker("@[0-9]+"); - int index=0,newIndex,matchLen; - // now replace all markers in inheritLine with links to the classes - while ((newIndex=marker.match(ldefLine,index,&matchLen))!=-1) - { - bool ok; - t << convertToDocBook(ldefLine.mid(index,newIndex-index)); - uint entryIndex = ldefLine.mid(newIndex+1,matchLen-1).toUInt(&ok); - MemberDef *md=members->at(entryIndex); - if (ok && md) - { - QCString scope=md->getScopeString(); - QCString name=md->name(); - //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),scope.data(),scopeName); - if (!scope.isEmpty() && scope!=scopeName) - { - name.prepend(scope+getLanguageSpecificSeparator(def->getLanguage())); - } - if (!md->isObjCMethod() && - (md->isFunction() || md->isSlot() || - md->isPrototype() || md->isSignal() - ) - ) - { - name+="()"; - } - //Definition *d = md->getOutputFileBase(); - //if (d==Doxygen::globalScope) d=md->getBodyDef(); - if (sourceBrowser && - !(md->isLinkable() && !refLinkSource) && - md->getStartBodyLine()!=-1 && - md->getBodyDef() - ) - { - //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); - - const int maxLineNrStr = 10; - char anchorStr[maxLineNrStr]; - qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); - //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data()); - t << convertToDocBook(name); - // or - // ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name); - } - else if (md->isLinkable() /*&& d && d->isLinkable()*/) - { - t << convertToDocBook(name); - // or - // ol.writeObjectLink(md->getReference(), md->getOutputFileBase(), md->anchor(),name); - } - else - { - t << convertToDocBook(name); - } - } - index=newIndex+matchLen; - } - t << ldefLine.right(ldefLine.length()-index); - t<< "."; - t << ""; - } -} -static void generateInlineCode(FTextStream &t,const char *scopeName, Definition *def) -{ - static bool inlineSources = Config_getBool(INLINE_SOURCES); - //printf("Source Fragment %s: %d-%d bodyDef=%p\n",name().data(), - // m_startBodyLine,m_endBodyLine,m_bodyDef); - if (inlineSources && def->hasSources()) - { - QCString codeFragment; - int actualStart=def->getStartBodyLine(),actualEnd=def->getEndBodyLine(); - if (readCodeFragment(def->getBodyDef()->absFilePath(), - actualStart,actualEnd,codeFragment) - ) - { - //printf("Adding code fragment '%s' ext='%s'\n", - // codeFragment.data(),m_impl->defFileExt.data()); - ParserInterface *pIntf = Doxygen::parserManager->getParser(def->getDefFileExtension()); - pIntf->resetCodeParserState(); - //printf("Read:\n`%s'\n\n",codeFragment.data()); - MemberDef *thisMd = 0; - if (def->definitionType()==Definition::TypeMember) thisMd = (MemberDef *)def; - - DocbookCodeGenerator *docbookGen = new DocbookCodeGenerator(t); - docbookGen->startCodeFragment(); - pIntf->parseCode(*docbookGen, // codeOutIntf - scopeName, // scope - codeFragment, // input - def->getLanguage(), // lang - FALSE, // isExample - 0, // exampleName - def->getBodyDef(), // fileDef - actualStart, // startLine - actualEnd, // endLine - TRUE, // inlineFragment - thisMd, // memberDef - TRUE // show line numbers - ); - docbookGen->finish(); - docbookGen->endCodeFragment(); - delete docbookGen; - } - } -} - -static void definedAtLine(int line, QCString fileName, FTextStream &t) -{ - QCString refText = theTranslator->trDefinedAtLineInSourceFile(); - int lineMarkerPos = refText.find("@0"); - int fileMarkerPos = refText.find("@1"); - if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this. - { - if (lineMarkerPosmemberType()==MemberType_EnumValue) return; - if (md->isHidden()) return; - //if (md->name().at(0)=='@') return; // anonymous member - - // group members are only visible in their group - //if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return; - QCString memType; - switch (md->memberType()) - { - case MemberType_Define: memType="define"; break; - case MemberType_Function: memType="function"; break; - case MemberType_Variable: memType="variable"; break; - case MemberType_Typedef: memType="typedef"; break; - case MemberType_Enumeration: memType="enum"; break; - case MemberType_EnumValue: ASSERT(0); break; - case MemberType_Signal: memType="signal"; break; - case MemberType_Slot: memType="slot"; break; - case MemberType_Friend: memType="friend"; break; - case MemberType_DCOP: memType="dcop"; break; - case MemberType_Property: memType="property"; break; - case MemberType_Event: memType="event"; break; - case MemberType_Interface: memType="interface"; break; - case MemberType_Service: memType="service"; break; - } - QCString scopeName; - if (md->getClassDef()) - { - scopeName=md->getClassDef()->name(); - } - else if (md->getNamespaceDef()) - { - scopeName=md->getNamespaceDef()->name(); - } - if (detailed==0) - { - t << " " << endl; - t << " " << endl; - t << " " << endl; - //enum - bool closePara=TRUE; - if (md->memberType()==MemberType_Enumeration) - { - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; - MemberList *enumFields = md->enumFieldList(); - t << " " << memType << " getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; - if (enumFields!=0) - { - MemberListIterator emli(*enumFields); - MemberDef *emd; - t << " {" << endl; - int cnt=0; - for (emli.toFirst();(emd=emli.current());++emli) - { - if (cnt!=0) - { - t << "," << endl; - } - t << "anchor() << "\">"; - writeDocbookString(t,emd->name()); - t << ""; - if (!emd->initializer().isEmpty()) - { - writeDocbookString(t,emd->initializer()); - } - cnt++; - } - t << endl << "}"; - } - t << "" << endl; - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - else if (md->memberType()==MemberType_Define) - { - t << " " << "#" << memType << " getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; - if (!md->initializer().isEmpty() && md->initializer().length()<2000) - { - t << " "; - linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->initializer()); - } - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - else if (md->memberType()==MemberType_Variable) - { - if (md->getClassDef()) - { - t << " " << convertToDocBook(md->declaration()); - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << ""; - } - } - else - { - t << " "; - linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - } - else if (md->memberType()==MemberType_Typedef) - { - t << " " << memType; - t << " "; - linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); - t << " "; - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - else if (md->memberType()==MemberType_Function) - { - t << " "; - linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,md->typeString()); - t << " getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << convertToDocBook(md->name()) << ""; - t << " (" << endl; - ArgumentList *declAl = md->declArgumentList(); - if (declAl && declAl->count()>0) - { - ArgumentListIterator declAli(*declAl); - Argument *a; - int cnt=0; - for (declAli.toFirst();(a=declAli.current());++declAli) - { - if (cnt!=0) - { - t << ", "; - } - if (!a->type.isEmpty()) - { - linkifyText(TextGeneratorDocbookImpl(t),def,md->getBodyDef(),md,a->type); - } - t << " "; - if (!a->name.isEmpty()) - { - writeDocbookString(t,a->name); - } - cnt++; - } - } - t << ")"; - if (md->briefDescription()) - { - t << ""; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - else - { - closePara = FALSE; - } - if (closePara) t << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - else - { - if (md->memberType()==MemberType_Enumeration) - { - MemberList *enumFields = md->enumFieldList(); - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << memType << " " << convertToDocBook(md->name()) << " " << "" << endl; - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - if (enumFields!=0) - { - MemberListIterator emli(*enumFields); - MemberDef *emd; - t << " " << endl; - t << " " << theTranslator->trEnumerationValues() << ":" << endl; - t << " " << endl; - for (emli.toFirst();(emd=emli.current());++emli) - { - t << " anchor() << "\">" << endl; - t << " "; - writeDocbookString(t,emd->name()); - t << "" << endl; - t << " " << endl; - if(Config_getBool(REPEAT_BRIEF)) - { - t << " "; - writeDocbookString(t,emd->briefDescription()); - t << "" << endl; - } - t << " " << endl; - t << " " << endl; - } - t << " " << endl; - t << " " << endl; - t << " "; - t << " "; - definedAtLine(md->getDefLine(),stripPath(md->getDefFileName()),t); - t << "" << endl; - - t << " " << endl; - t << "{" << endl; - for (emli.toFirst();(emd=emli.current());++emli) - { - writeDocbookString(t,emd->name()); - if (!emd->initializer().isEmpty()) - { - writeDocbookString(t,emd->initializer()); - } - t << ", " << endl; - } - t << "}" << convertToDocBook(md->name()) << ";" << endl; - t << " " << endl; - t << " " << endl; - } - t << "
" << endl; - } - else if (md->memberType()==MemberType_Typedef) - { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToDocBook(md->definition()) << ""; - if(Config_getBool(REPEAT_BRIEF)) - { - t << " "; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - t << "
" << endl; - } - else if (md->memberType()==MemberType_Function) - { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToDocBook(md->definition()) << " " << convertToDocBook(md->argsString()) << ""; - addIndexTerm(t,md->name(),def->name()); - addIndexTerm(t,def->name(),md->name()); - if(Config_getBool(REPEAT_BRIEF)) - { - if (!md->briefDescription().isEmpty()) - { - t << " "; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - } - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - - if (Config_getBool(REFERENCED_BY_RELATION)) - { - generateSourceRefList(t,md->name(),theTranslator->trReferencedBy(),md->getReferencedByMembers(),md); - } - if (Config_getBool(REFERENCES_RELATION)) - { - generateSourceRefList(t,md->name(),theTranslator->trReferences(),md->getReferencesMembers(),md); - } - generateInlineCode(t,md->name(),md); - t << "
" << endl; - } - else if (md->memberType()==MemberType_Define) - { - if (md->documentation()) - { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToDocBook(md->definition()) << ""; - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - t << "
" << endl; - } - } - else if (md->memberType()==MemberType_Variable) - { - if (md->getClassDef()) - { - if (md->documentation()) - { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToDocBook(md->definition()) << ""; - addIndexTerm(t,md->name(),def->name()); - addIndexTerm(t,def->name(),md->name()); - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - t << "
" << endl; - } - } - else - { - t << "
getGroupDef() && def->definitionType()==Definition::TypeGroup) - { - t << md->getGroupDef()->getOutputFileBase(); - } - else - { - t << memberOutputFileBase(md); - } - t << "_1" << md->anchor() << "\">" << endl; - t << " " << convertToDocBook(md->definition()) << ""; - addIndexTerm(t,md->name(),def->name()); - addIndexTerm(t,def->name(),md->name()); - if(Config_getBool(REPEAT_BRIEF)) - { - t << " "; - writeDocbookString(t,md->briefDescription()); - t << "" << endl; - } - t << " "; - writeDocbookDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); - t << endl; - t << "
" << endl; - } - } - } -} - -static void generateDocbookSection(Definition *d,FTextStream &t,MemberList *ml,const char *, - bool detailed=0, const char *header=0,const char *documentation=0) -{ - if (ml==0) return; - MemberListIterator mli(*ml); - MemberDef *md; - int count=0; - int doc_count=0; - QCString title, desctitle, subtitle; - - for (mli.toFirst();(md=mli.current());++mli) - { - // namespace members are also inserted in the file scope, but - // to prevent this duplication in the Docbook output, we filter those here. - if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) - { - count++; - } - } - - if (count==0) return; // empty list - - subtitle = ""; - switch (ml->listType()) - { - case MemberListType_pubMethods: d->getLanguage()==SrcLangExt_ObjC ? title = theTranslator->trInstanceMethods() : title = theTranslator->trPublicMembers(); - switch (d->getLanguage()) - { - case SrcLangExt_ObjC: desctitle = theTranslator->trMethodDocumentation(); break; - case SrcLangExt_Fortran: desctitle = theTranslator->trMemberFunctionDocumentationFortran(); break; - default: desctitle = theTranslator->trMemberFunctionDocumentation(); break; - }; - break; - case MemberListType_priMethods: title=theTranslator->trPrivateMembers(); desctitle=""; break; - - case MemberListType_decTypedefMembers: title=theTranslator->trTypedefs(); desctitle=theTranslator->trTypedefDocumentation(); break; - case MemberListType_decEnumMembers: title=theTranslator->trEnumerations(); desctitle=theTranslator->trEnumerationTypeDocumentation(); break; - case MemberListType_decFuncMembers: title=theTranslator->trFunctions(); desctitle=theTranslator->trFunctionDocumentation(); break; - case MemberListType_decVarMembers: title=theTranslator->trVariables(); desctitle=theTranslator->trVariableDocumentation(); break; - case MemberListType_pubAttribs: title=theTranslator->trPublicAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; - case MemberListType_priAttribs: title=theTranslator->trPrivateAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; - case MemberListType_proAttribs: title=theTranslator->trProtectedAttribs(); desctitle=theTranslator->trMemberDataDocumentation(); break; - case MemberListType_decDefineMembers: title=theTranslator->trDefines(); desctitle=theTranslator->trDefineDocumentation(); break; - case MemberListType_related: title=theTranslator->trRelatedFunctions(); desctitle=theTranslator->trRelatedFunctionDocumentation(); - subtitle=theTranslator->trRelatedSubscript(); break; - default: title=""; desctitle=""; - } - - if (detailed) - { - for (mli.toFirst();(md=mli.current());++mli) - { - if (md->documentation().isEmpty() && !Config_getBool(REPEAT_BRIEF)) - { - continue; - } - doc_count = 1; - break; - } - - if(doc_count == 0) return; - - if (!QCString(header).isEmpty()) - { - t << "
" << endl; - t << " " << convertToDocBook(header) << "" << endl; - } - else if (desctitle) - { - t << "
" << endl; - t << " " << desctitle << "" << endl; - } - } - else - { - t << "
" << endl; - if (!QCString(header).isEmpty()) - { - t << " " << convertToDocBook(header) << "" << endl; - } - else - { - t << " " << title << "" << endl; - } - if (!subtitle.isEmpty()) - t << " " << subtitle << "" << endl; - } - - if (documentation) - { - t << " "; - writeDocbookDocBlock(t,d->docFile(),d->docLine(),d,0,documentation); - t << "" << endl; - } - for (mli.toFirst();(md=mli.current());++mli) - { - // namespace members are also inserted in the file scope, but - // to prevent this duplication in the Docbook output, we filter those here. - if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) - { - if (detailed && md->documentation().isEmpty() && !Config_getBool(REPEAT_BRIEF)) - { - continue; - } - - generateDocbookForMember(md,t,d,detailed); - } - } - if (detailed) - { - if (!QCString(header).isEmpty()) - { - t << "
" << endl; - } - else if (desctitle) - { - t << "
" << endl; - } - } - else - { - t << "
" << endl; - } -} - -static void writeInnerClasses(const ClassSDict *cl,FTextStream &t) -{ - if (cl) - { - ClassSDict::Iterator cli(*cl); - ClassDef *cd; - QCString title = theTranslator->trClasses(); - - if (cli.toFirst()) - { - t << "
" << endl; - t << " " << title << " " << endl; - } - for (cli.toFirst();(cd=cli.current());++cli) - { - if (!cd->isHidden() && cd->name().find('@')==-1) - { - t << " " << endl; - t << " " << endl; - t << " " << endl; - t << " " << "struct " << convertToDocBook(cd->name()) << ""; - t << "" << endl; - if (cd->briefDescription()) - { - t << ""; - writeDocbookString(t,cd->briefDescription()); - t << "" << endl; - } - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - } - if (cli.toFirst()) - { - t << "
" << endl; - } - } -} - -static void writeInnerNamespaces(const NamespaceSDict *nl,FTextStream &t) -{ - if (nl) - { - NamespaceSDict::Iterator nli(*nl); - NamespaceDef *nd; - QCString title = theTranslator->trNamespaces(); - - if (nli.toFirst()) - { - t << " " << endl; - t << " " << title << " " << endl; - } - for (nli.toFirst();(nd=nli.current());++nli) - { - if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymouse scopes - { - t << " " << endl; - t << " " << endl; - t << " " << endl; - t << " " << "struct getOutputFileBase() << "\">" << convertToDocBook(nd->name()) << ""; - t << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - } - if (nli.toFirst()) - { - t << " " << endl; - } - } -} - -static void writeInnerFiles(const FileList *fl,FTextStream &t) -{ - if (fl) - { - QListIterator fli(*fl); - FileDef *fd; - QCString title = theTranslator->trFile(TRUE,TRUE); - - if (fli.toFirst()) - { - t << " " << endl; - t << " " << title << " " << endl; - } - for (fli.toFirst();(fd=fli.current());++fli) - { - t << " " << endl; - t << " " << endl; - t << " " << endl; - t << " " << "file getOutputFileBase() << "\">" << convertToDocBook(fd->name()) << ""; - t << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - if (fli.toFirst()) - { - t << " " << endl; - } - } -} - -static void writeInnerPages(const PageSDict *pl,FTextStream &t) -{ - if (pl) - { - PageSDict::Iterator pli(*pl); - PageDef *pd; - - for (pli.toFirst();(pd=pli.current());++pli) - { - t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; - } - } -} - -static void writeInnerGroups(const GroupList *gl,FTextStream &t) -{ - if (gl) - { - GroupListIterator gli(*gl); - GroupDef *sgd; - - //Docbook header tags for inner groups - if (gli.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trModules() << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - - for (gli.toFirst();(sgd=gli.current());++gli) - { - t << " getOutputFileBase() << "\">" << convertToDocBook(sgd->groupTitle()) << "" << endl; - } - - //Docbook footer tags for inner groups - if (gli.toFirst()) - { - t << " " << endl; - t << " " << endl; - } - - } -} - -static void writeInnerDirs(const DirList *dl,FTextStream &t) -{ - if (dl) - { - QListIterator subdirs(*dl); - DirDef *subdir; - QCString title = theTranslator->trDirectories(); - if (subdirs.toFirst()) - { - t << " " << endl; - t << " " << title << " " << endl; - } - for (subdirs.toFirst();(subdir=subdirs.current());++subdirs) - { - t << " " << endl; - t << " " << endl; - t << " " << endl; - t << " " << "dir getOutputFileBase() << "\">" << convertToDocBook(subdir->displayName()) << ""; - t << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - } - if (subdirs.toFirst()) - { - t << " " << endl; - } - } -} - -static void writeInnerGroupFiles(const GroupList *gl,FTextStream &t) -{ - if (gl) - { - GroupListIterator gli(*gl); - GroupDef *sgd; - - for (gli.toFirst();(sgd=gli.current());++gli) - { - t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>" << endl; - } - } -} - -static void generateDocbookForClass(ClassDef *cd,FTextStream &ti) -{ - // + brief description - // + detailed description - // + template argument list(s) - // - include file - // + member groups - // + inheritance diagram - // + list of direct super classes - // + list of direct sub classes - // + list of inner classes - // + collaboration diagram - // + list of all members - // + user defined member sections - // + standard member sections - // + detailed member documentation - // - examples using the class - - if (cd->isReference()) return; // skip external references. - if (cd->isHidden()) return; // skip hidden classes. - if (cd->name().find('@')!=-1) return; // skip anonymous compounds. - if (cd->templateMaster()!=0) return; // skip generated template instances. - - msg("Generating Docbook output for class %s\n",cd->name().data()); - - QCString fileDocbook=cd->getOutputFileBase()+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml"; - QCString relPath = relativePathToRoot(fileName); - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - - writeDocbookHeader_ID(t, classOutputFileBase(cd)); - t << ""; - writeDocbookString(t,cd->name()); - addIndexTerm(t,cd->name()); - t << " " << cd->compoundTypeString() << " Reference"; - t << "" << endl; - if (cd->briefDescription()) - { - t << " " << endl; - writeDocbookDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); - t << " " << endl; - } - - IncludeInfo *ii=cd->includeInfo(); - if (ii) - { - QCString nm = ii->includeName; - if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); - if (!nm.isEmpty()) - { - t << "" << endl; - t << " #include "; - if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references - { - t << "fileDef->getOutputFileBase() << "\">"; - } - if (ii->local) - { - t << """; - } - else - { - t << "<"; - } - t << convertToDocBook(nm); - if (ii->local) - { - t << """; - } - else - { - t << ">"; - } - if (ii->fileDef && !ii->fileDef->isReference()) - { - t << ""; - } - t << "" << endl; - t << "" << endl; - } - } - - if (Config_getBool(HAVE_DOT) && (Config_getBool(CLASS_DIAGRAMS) || Config_getBool(CLASS_GRAPH))) - { - t << "Inheritance diagram for " << convertToDocBook(cd->name()) << "" << endl; - DotClassGraph inheritanceGraph(cd,DotNode::Inheritance); - inheritanceGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE); - } - - if (Config_getBool(HAVE_DOT) && Config_getBool(COLLABORATION_GRAPH)) - { - t << "Collaboration diagram for " << convertToDocBook(cd->name()) << "" << endl; - DotClassGraph collaborationGraph(cd,DotNode::Collaboration); - collaborationGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,TRUE,FALSE); - } - - writeInnerClasses(cd->getClassSDict(),t); - - writeTemplateList(cd,t); - if (cd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(cd,t,mg->members(),"user-defined",0,mg->header(), - mg->documentation()); - } - } - - QListIterator mli(cd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_detailedLists)==0) - { - generateDocbookSection(cd,t,ml,g_docbookSectionMapper.find(ml->listType())); - } - } - - if ((Config_getBool(REPEAT_BRIEF) && cd->briefDescription()) || cd->documentation()) - { - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - - if(Config_getBool(REPEAT_BRIEF)) - { - if (cd->briefDescription()) - { - t << " " << endl; - // A title as 'Brief Description' may not be necessary. - //t << " " << theTranslator->trBriefDescription() << "" << endl; - writeDocbookDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); - t << " " << endl; - } - } - - if (cd->documentation()) - { - writeDocbookDocBlock(t,cd->docFile(),cd->docLine(),cd,0,cd->documentation()); - } - t << " " << endl; - } - - if (cd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(cd,t,mg->members(),"user-defined",1,mg->header(), - mg->documentation()); - } - } - - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_detailedLists)==0) - { - generateDocbookSection(cd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); - } - } - - /*// TODO: Handling of Inheritance and Colloboration graph for Docbook to be implemented - DotClassGraph inheritanceGraph(cd,DotNode::Inheritance); - if (!inheritanceGraph.isTrivial()) - { - t << " " << endl; - inheritanceGraph.writeDocbook(t); - t << " " << endl; - } - DotClassGraph collaborationGraph(cd,DotNode::Collaboration); - if (!collaborationGraph.isTrivial()) - { - t << " " << endl; - collaborationGraph.writeDocbook(t); - t << " " << endl; - } - t << " getDefFileName() << "\" line=\"" - << cd->getDefLine() << "\""; - if (cd->getStartBodyLine()!=-1) - { - FileDef *bodyDef = cd->getBodyDef(); - if (bodyDef) - { - t << " bodyfile=\"" << bodyDef->absFilePath() << "\""; - } - t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" - << cd->getEndBodyLine() << "\""; - } - t << "/>" << endl; - writeListOfAllMembers(cd,t); - */ - - t << " " << cd->generatedFromFiles() << "" << endl; - t << " " << stripPath(cd->getDefFileName()) << "" << endl; - t << "
" << endl; - -} - -static void generateDocbookForNamespace(NamespaceDef *nd,FTextStream &ti) -{ - // + contained class definitions - // + contained namespace definitions - // + member groups - // + normal members - // + brief desc - // + detailed desc - // + location - // - files containing (parts of) the namespace definition - - if (nd->isReference() || nd->isHidden()) return; // skip external references - - QCString fileDocbook=nd->getOutputFileBase()+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml"; - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - - writeDocbookHeader_ID(t, nd->getOutputFileBase()); - t << ""; - addIndexTerm(t,nd->displayName()); - writeDocbookString(t,nd->title()); - t << "" << endl; - - if (nd->briefDescription()) - { - t << " " << endl; - //t << " " << theTranslator->trBriefDescription() << "" << endl; - t << " " << endl; - } - writeInnerClasses(nd->getClassSDict(),t); - writeInnerNamespaces(nd->getNamespaceSDict(),t); - - if (nd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(nd,t,mg->members(),"user-defined",0,mg->header(), - mg->documentation()); - } - } - - QListIterator mli(nd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_declarationLists)!=0) - { - generateDocbookSection(nd,t,ml,g_docbookSectionMapper.find(ml->listType())); - } - } - - if ((Config_getBool(REPEAT_BRIEF) && nd->briefDescription()) || nd->documentation()) - { - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - - if(Config_getBool(REPEAT_BRIEF)) - { - if (nd->briefDescription()) - { - t << " " << endl; - //t << " " << theTranslator->trBriefDescription() << "" << endl; - writeDocbookDocBlock(t,nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription()); - t << " " << endl; - } - } - - if (nd->documentation()) - { - writeDocbookDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); - } - t << " " << endl; - } - - if (nd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(nd,t,mg->members(),"user-defined",1,mg->header(), - mg->documentation()); - } - } - - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_detailedLists)==0) - { - if (ml->listType() != MemberListType_allMembersList && - ml->listType() != MemberListType_docFuncMembers) - generateDocbookSection(nd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); - } - } - // we actually need here "namespace" - // t << " " << theTranslator->trGeneratedFromFiles(ClassDef::Struct, FALSE) << "" << endl; - // t << " " << stripPath(nd->getDefFileName()) << "" << endl; - t << "" << endl; -} - -static void generateDocbookForFile(FileDef *fd,FTextStream &ti) -{ - // + includes files - // + includedby files - // + include graph - // + included by graph - // + contained class definitions - // + contained namespace definitions - // + member groups - // + normal members - // + brief desc - // + detailed desc - // + source code - // + location - // - number of lines - - if (fd->isReference()) return; // skip external references - - QCString fileDocbook=fd->getOutputFileBase()+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml"; - QCString relPath = relativePathToRoot(fileName); - - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - writeDocbookHeader_ID(t, fd->getOutputFileBase()); - - t << " "; - writeDocbookString(t,fd->name()); - t << " File Reference"; - t << "" << endl; - - if (fd->briefDescription()) - { - t << " " << endl; - writeDocbookDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); - t << " " << endl; - } - - IncludeInfo *inc; - - if (fd->includeFileList()) - { - QListIterator ili1(*fd->includeFileList()); - for (ili1.toFirst();(inc=ili1.current());++ili1) - { - t << " #include "; - if (inc->local) - { - t << """; - } - else - { - t << "<"; - } - t << convertToDocBook(inc->includeName); - if (inc->local) - { - t << """; - } - else - { - t << ">"; - } - t << "" << endl; - } - } - if (Config_getBool(HAVE_DOT)) - { - if (Config_getBool(INCLUDE_GRAPH)) - { - t << "Include dependency diagram for " << convertToDocBook(fd->name()) << "" << endl; - DotInclDepGraph idepGraph(fd, FALSE); - idepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); - } - if (Config_getBool(INCLUDED_BY_GRAPH)) - { - t << "Included by dependency diagram for " << convertToDocBook(fd->name()) << "" << endl; - DotInclDepGraph ibdepGraph(fd, TRUE); - ibdepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); - } - } - - if (fd->getClassSDict()) - { - writeInnerClasses(fd->getClassSDict(),t); - } - if (fd->getNamespaceSDict()) - { - writeInnerNamespaces(fd->getNamespaceSDict(),t); - } - - if (fd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*fd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(fd,t,mg->members(),"user-defined",0,mg->header(), - mg->documentation()); - } - } - - QListIterator mli(fd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_declarationLists)!=0) - { - generateDocbookSection(fd,t,ml,g_docbookSectionMapper.find(ml->listType())); - } - } - - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - if(Config_getBool(REPEAT_BRIEF)) - { - if (fd->briefDescription()) - { - writeDocbookDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); - } - } - writeDocbookDocBlock(t,fd->docFile(),fd->docLine(),fd,0,fd->documentation()); - if (Config_getBool(FULL_PATH_NAMES)) - { - t << " Definition in file " << fd->getDefFileName() << "" << endl; - } - else - { - t << " Definition in file " << stripPath(fd->getDefFileName()) << "" << endl; - } - t << " " << endl; - - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_declarationLists)!=0) - { - generateDocbookSection(fd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); - } - } - - if (Config_getBool(DOCBOOK_PROGRAMLISTING)) - { - t << " " << endl;; - writeDocbookCodeBlock(t,fd); - t << " " << endl; - } - - t << "" << endl; -} - -static void generateDocbookForGroup(GroupDef *gd,FTextStream &ti) -{ - // + members - // + member groups - // + files - // + classes - // + namespaces - // - packages - // + pages - // + child groups - // - examples - // + brief description - // + detailed description - - if (gd->isReference()) return; // skip external references - - if (!gd->isASubGroup()) - { - QCString fileDocbook=gd->getOutputFileBase()+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - } - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml"; - QCString relPath = relativePathToRoot(fileName); - - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - writeDocbookHeader_ID(t, gd->getOutputFileBase()); - - t << " " << convertToDocBook(gd->groupTitle()) << "" << endl; - if (gd->briefDescription()) - { - t << " " << endl; - writeDocbookDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); - t << " " << endl; - } - - if (Config_getBool(GROUP_GRAPHS) && Config_getBool(HAVE_DOT)) - { - t << "Collaboration diagram for " << convertToDocBook(gd->groupTitle()) << "" << endl; - DotGroupCollaboration collaborationGraph(gd); - collaborationGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); - } - - writeInnerFiles(gd->getFiles(),t); - writeInnerClasses(gd->getClasses(),t); - writeInnerNamespaces(gd->getNamespaces(),t); - writeInnerPages(gd->getPages(),t); - writeInnerGroups(gd->getSubGroups(),t); - - if (gd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*gd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateDocbookSection(gd,t,mg->members(),"user-defined",0,mg->header(), - mg->documentation()); - } - } - - QListIterator mli(gd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_declarationLists)!=0) - { - generateDocbookSection(gd,t,ml,g_docbookSectionMapper.find(ml->listType())); - } - } - - if(Config_getBool(REPEAT_BRIEF)) - { - if (gd->briefDescription()) - { - //t << "
" << endl; - //t << " " << theTranslator->trBriefDescription() << "" << endl; - writeDocbookDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); - //t << "
" << endl; - } - } - - if (gd->documentation()) - { - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - writeDocbookDocBlock(t,gd->docFile(),gd->docLine(),gd,0,gd->documentation()); - t << " " << endl; - } - - for (mli.toFirst();(ml=mli.current());++mli) - { - if ((ml->listType()&MemberListType_declarationLists)!=0) - { - generateDocbookSection(gd,t,ml,g_docbookSectionMapper.find(ml->listType()),1); - } - } - - writeInnerGroupFiles(gd->getSubGroups(),t); - - t << "" << endl; - -} - -static void generateDocbookForDir(DirDef *dd,FTextStream &ti) -{ - if (dd->isReference()) return; // skip external references - - QCString fileDocbook=dd->getOutputFileBase()+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml"; - QFile f(fileName); - QCString relPath = relativePathToRoot(fileName); - - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - writeDocbookHeader_ID(t, dd->getOutputFileBase()); - - t << " "; - t << theTranslator->trDirReference(dd->displayName()); - t << "" << endl; - if (dd->briefDescription()) - { - writeDocbookDocBlock(t,dd->briefFile(),dd->briefLine(),dd,0,dd->briefDescription()); - } - if (Config_getBool(DIRECTORY_GRAPH) && Config_getBool(HAVE_DOT)) - { - t << "Directory dependency diagram for " << convertToDocBook(dd->displayName()) << "" << endl; - DotDirDeps dirdepGraph(dd); - dirdepGraph.writeGraph(t,GOF_BITMAP,EOF_DocBook,Config_getString(DOCBOOK_OUTPUT),fileName,relPath,FALSE); - } - - writeInnerDirs(&dd->subDirs(),t); - writeInnerFiles(dd->getFiles(),t); - - t << " " << endl; - t << " " << theTranslator->trDetailedDescription() << "" << endl; - if (dd->briefDescription()) - { - t << " " << endl; - writeDocbookDocBlock(t,dd->briefFile(),dd->briefLine(),dd,0,dd->briefDescription()); - t << " " << endl; - } - writeDocbookDocBlock(t,dd->docFile(),dd->docLine(),dd,0,dd->documentation()); - t << " Directory location is " << dd->name() << "" << endl; - t << " " << endl; - - t << "" << endl; -} - -static void generateDocbookForPage(PageDef *pd,FTextStream &ti,bool isExample) -{ - // + name - // + title - // + documentation - - if (pd->isReference()) return; - - QCString pageName = pd->getOutputFileBase(); - if (pd->getGroupDef()) - { - pageName+=(QCString)"_"+pd->name(); - } - if (pageName=="index") - { - pageName="mainpage"; // to prevent overwriting the generated index page. - } - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - QCString fileName=outputDirectory+"/"+pageName+".xml"; - QFile f(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - - if(isExample) - { - QCString fileDocbook=pageName+".xml"; - ti << " " << endl; - } - - if (!pd->hasParentPage() && !isExample) - { - QCString fileDocbook=pageName+".xml"; - //Add the file Documentation info to index file - ti << " " << endl; - writeDocbookHeaderMainpage(t,pageName); - } - else - { - QCString pid; - if(isExample) - { - pid = pageName; - } - else - { - pid = pageName+"_1"+pageName; - } - writeDocbookHeader_ID(t, pid); - } - - SectionInfo *si = Doxygen::sectionDict->find(pd->name()); - if (si) - { - if ( pageName == "mainpage") - t << " " << convertToDocBook(theTranslator->trMainPage()) << "" << endl; - else - t << " " << convertToDocBook(si->title) << "" << endl; - } - else - { - t << " " << convertToDocBook(pd->name()) << "" << endl; - } - - generateTOC(t, pd); - if (isExample) - { - writeDocbookDocBlock(t,pd->docFile(),pd->docLine(),pd,0, - pd->documentation()+"\n\\include "+pd->name()); - } - else - { - writeDocbookDocBlock(t,pd->docFile(),pd->docLine(),pd,0, - pd->documentation()); - } - writeInnerPages(pd->getSubPages(),t); - - if (!pd->hasParentPage() && !isExample) - { - t << endl << "
" << endl; - } - else - { - t << endl << "" << endl; - } -} -void generateDocbook_v1() -{ - - // + classes - // + namespaces - // + files - // + groups - // + related pages - // - examples - - QCString outputDirectory = Config_getString(DOCBOOK_OUTPUT); - if (outputDirectory.isEmpty()) - { - outputDirectory=QDir::currentDirPath().utf8(); - } - else - { - QDir dir(outputDirectory); - if (!dir.exists()) - { - dir.setPath(QDir::currentDirPath()); - if (!dir.mkdir(outputDirectory)) - { - err("tag DOCBOOK_OUTPUT: Output directory `%s' does not " - "exist and cannot be created\n",outputDirectory.data()); - exit(1); - } - else - { - msg("Notice: Output directory `%s' does not exist. " - "I have created it for you.\n", outputDirectory.data()); - } - dir.cd(outputDirectory); - } - outputDirectory=dir.absPath().utf8(); - } - - QDir dir(outputDirectory); - if (!dir.exists()) - { - dir.setPath(QDir::currentDirPath()); - if (!dir.mkdir(outputDirectory)) - { - err("Cannot create directory %s\n",outputDirectory.data()); - return; - } - } - QDir docbookDir(outputDirectory); - createSubDirs(docbookDir); - - QCString fileName=outputDirectory+"/index.xml"; - QCString dbk_projectName = Config_getString(PROJECT_NAME); - QFile f(fileName); - - f.setName(fileName); - if (!f.open(IO_WriteOnly)) - { - err("Cannot open file %s for writing!\n",fileName.data()); - return; - } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); - - // write index header for Docbook which calls the structure file - t << "" << endl;; - t << "" << endl; - t << " " << endl; - t << " " << convertToDocBook(dbk_projectName) << "" << endl; - t << " " << endl; - - // NAMESPACE DOCUMENTATION - NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); - NamespaceDef *nd; - - //Namespace Documentation index header - if (nli.toFirst()) - { - t << " " << endl; - t << " Namespace Documentation" << endl; - } - - for (nli.toFirst();(nd=nli.current());++nli) - { - msg("Generating Docbook output for namespace %s\n",nd->name().data()); - generateDocbookForNamespace(nd,t); - } - - //Namespace Documentation index footer - if (nli.toFirst()) - { - t << " " << endl; - } - - /** MAINPAGE DOCUMENTATION **/ - - if (Doxygen::mainPage) - { - msg("Generating Docbook output for the main page\n"); - generateDocbookForPage(Doxygen::mainPage,t,FALSE); - } - - // PAGE DOCUMENTATION - { - PageSDict::Iterator pdi(*Doxygen::pageSDict); - PageDef *pd=0; - - for (pdi.toFirst();(pd=pdi.current());++pdi) - { - msg("Generating Docbook output for page %s\n",pd->name().data()); - generateDocbookForPage(pd,t,FALSE); - } - } - - /** MODULE GROUP DOCUMENTATION **/ - - GroupSDict::Iterator gli(*Doxygen::groupSDict); - GroupDef *gd; - - //Module group Documentation index header - if (gli.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trModuleDocumentation() << "" << endl; - } - - for (;(gd=gli.current());++gli) - { - msg("Generating Docbook output for group %s\n",gd->name().data()); - generateDocbookForGroup(gd,t); - } - - //Module group Documentation index footer - if (gli.toFirst()) - { - t << " " << endl; - } - - //CLASS DOCUMENTATION - - { - ClassSDict::Iterator cli(*Doxygen::classSDict); - ClassDef *cd; - - //Class Documentation index header - if (cli.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trClassDocumentation() << "" << endl; - } - - for (cli.toFirst();(cd=cli.current());++cli) - { - generateDocbookForClass(cd,t); - } - - //Class Documentation index footer - if (cli.toFirst()) - { - t << " " << endl; - } - } - - // FILE DOCUMENTATION - - static bool showFiles = Config_getBool(SHOW_FILES); - if (showFiles) - { - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - - //File Documentation index header - if (fnli.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trFileDocumentation() << "" << endl; - } - - for (;(fn=fnli.current());++fnli) - { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) - { - msg("Generating Docbook output for file %s\n",fd->name().data()); - generateDocbookForFile(fd,t); - } - } - - //File Documentation index footer - if (fnli.toFirst()) - { - t << " " << endl; - } - } - - // DIRECTORY DOCUMENTATION - if (Config_getBool(DIRECTORY_GRAPH) && Config_getBool(HAVE_DOT)) - { - DirDef *dir; - DirSDict::Iterator sdi(*Doxygen::directories); - - //Directory Documentation index header - if (sdi.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trDirDocumentation() << "" << endl; - } - - for (sdi.toFirst();(dir=sdi.current());++sdi) - { - msg("Generate Docbook output for dir %s\n",dir->name().data()); - generateDocbookForDir(dir,t); - } - - //Module group Documentation index footer - if (sdi.toFirst()) - { - t << " " << endl; - } - } - - // EXAMPLE PAGE DOCUMENTATION - - { - PageSDict::Iterator pdi(*Doxygen::exampleSDict); - PageDef *pd=0; - - //Example Page Documentation index header - if (pdi.toFirst()) - { - t << " " << endl; - t << " " << theTranslator->trExampleDocumentation() << "" << endl; - } - - for (pdi.toFirst();(pd=pdi.current());++pdi) - { - msg("Generating Docbook output for example %s\n",pd->name().data()); - generateDocbookForPage(pd,t,TRUE); - } - - //Example Page Documentation index footer - if (pdi.toFirst()) - { - t << " " << endl; - } - } - - t << "" << endl; - t << "" << endl; - -} - DocbookGenerator::DocbookGenerator() : OutputGenerator() { DB_GEN_C diff --git a/src/docbookgen.h b/src/docbookgen.h index 104fbc5..08255a1 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -17,8 +17,6 @@ #include "outputgen.h" -void generateDocbook_v1(); - class DocbookCodeGenerator : public CodeOutputInterface { public: diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 13c60fb..7658555 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11532,13 +11532,11 @@ void generateOutput() g_outputList->add(new LatexGenerator); LatexGenerator::init(); } -#if 1 if (generateDocbook) { g_outputList->add(new DocbookGenerator); DocbookGenerator::init(); } -#endif if (generateMan) { g_outputList->add(new ManGenerator); @@ -11717,15 +11715,6 @@ void generateOutput() g_s.end(); } -#if 0 - if (generateDocbook) - { - g_s.begin("Generating Docbook output...\n"); - generateDocbook_v1(); - g_s.end(); - } -#endif - if (Config_getBool(GENERATE_AUTOGEN_DEF)) { g_s.begin("Generating AutoGen DEF output...\n"); -- cgit v0.12