From 31198c214de4f4a8f8935426574e9fa0eb0cf27e Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 27 Oct 2013 09:23:08 +0100 Subject: More template and context updates --- src/classdef.cpp | 925 ++++++++++++------------ src/classdef.h | 12 +- src/classlist.cpp | 24 +- src/context.cpp | 1903 ++++++++++++++++++++++++++++++++++++++++++++------ src/context.h | 183 +++++ src/definition.cpp | 6 + src/definition.h | 3 + src/doxygen.cpp | 26 +- src/memberdef.cpp | 1105 +++++++++++++++-------------- src/memberdef.h | 1 + src/namespacedef.cpp | 9 +- src/namespacedef.h | 5 +- src/template.cpp | 534 +++++++++----- src/template.h | 34 +- 14 files changed, 3353 insertions(+), 1417 deletions(-) diff --git a/src/classdef.cpp b/src/classdef.cpp index c097aee..474be45 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2013 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -57,29 +57,29 @@ class ClassDefImpl const QCString &ctStr, const char *fName); /*! file name that forms the base for the output file containing the - * class documentation. For compatibility with Qt (e.g. links via tag + * class documentation. For compatibility with Qt (e.g. links via tag * files) this name cannot be derived from the class name directly. */ - QCString fileName; + QCString fileName; /*! Include information about the header file should be included * in the documentation. 0 by default, set by setIncludeFile(). */ - IncludeInfo *incInfo; + IncludeInfo *incInfo; /*! List of base class (or super-classes) from which this class derives - * directly. + * directly. */ BaseClassList *inherits; - /*! List of sub-classes that directly derive from this class + /*! List of sub-classes that directly derive from this class */ BaseClassList *inheritedBy; - /*! Namespace this class is part of + /*! Namespace this class is part of * (this is the inner most namespace in case of nested namespaces) */ - NamespaceDef *nspace; + NamespaceDef *nspace; /*! File this class is defined in */ FileDef *fileDef; @@ -94,7 +94,7 @@ class ClassDefImpl ArgumentList *typeConstraints; /*! Files that were used for generating the class documentation. */ - QStrList files; + FileList files; /*! Examples that use this class */ ExampleSDict *exampleSDict; @@ -102,10 +102,10 @@ class ClassDefImpl /*! Holds the kind of "class" this is. */ ClassDef::CompoundType compType; - /*! The protection level in which this class was found. + /*! The protection level in which this class was found. * Typically Public, but for nested classes this can also be Protected * or Private. - */ + */ Protection prot; /*! The inner classes contained in this class. Will be 0 if there are @@ -120,13 +120,13 @@ class ClassDefImpl /*! Template instances that exists of this class, the key in the * dictionary is the template argument list. - */ + */ QDict *templateInstances; /*! Template instances that exists of this class, as defined by variables. * We do NOT want to document these individually. The key in the * dictionary is the template argument list. - */ + */ QDict *variableInstances; QDict *templBaseClassNames; @@ -162,10 +162,10 @@ class ClassDefImpl bool isTemplArg; /*! Does this class group its user-grouped members - * as a sub-section of the normal (public/protected/..) + * as a sub-section of the normal (public/protected/..) * groups? */ - bool subGrouping; + bool subGrouping; /** Reason of existence is a "use" relation */ bool usedOnly; @@ -238,7 +238,7 @@ void ClassDefImpl::init(const char *defFileName, const char *name, // we cannot use getLanguage at this point, as setLanguage has not been called. SrcLangExt lang = getLanguageFromFileName(defFileName); - if ((lang==SrcLangExt_Cpp || lang==SrcLangExt_ObjC) && + if ((lang==SrcLangExt_Cpp || lang==SrcLangExt_ObjC) && guessSection(defFileName)==Entry::SOURCE_SEC) { isLocal=TRUE; @@ -280,7 +280,7 @@ ClassDef::ClassDef( const char *defFileName,int defLine,int defColumn, const char *nm,CompoundType ct, const char *lref,const char *fName, - bool isSymbol,bool isJavaEnum) + bool isSymbol,bool isJavaEnum) : Definition(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol) { visited=FALSE; @@ -312,7 +312,7 @@ QCString ClassDef::displayName(bool includeScope) const { n = VhdlDocGen::getClassName(this); } - else + else { if (includeScope) { @@ -388,7 +388,7 @@ void ClassDef::addMembersToMemberGroup() MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - if (mg->allMembersInSameSection() && m_impl->subGrouping) + if (mg->allMembersInSameSection() && m_impl->subGrouping) { //printf("addToDeclarationSection(%s)\n",mg->header().data()); mg->addToDeclarationSection(); @@ -456,14 +456,14 @@ void ClassDef::internalInsertMember(MemberDef *md, case MemberType_Slot: // Qt specific switch (prot) { - case Protected: + case Protected: case Package: // slots in packages are not possible! addMemberToList(MemberListType_proSlots,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubSlots,md,TRUE); break; - case Private: + case Private: addMemberToList(MemberListType_priSlots,md,TRUE); break; } @@ -475,16 +475,16 @@ void ClassDef::internalInsertMember(MemberDef *md, { switch (prot) { - case Protected: + case Protected: addMemberToList(MemberListType_proStaticAttribs,md,TRUE); break; - case Package: + case Package: addMemberToList(MemberListType_pacStaticAttribs,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubStaticAttribs,md,TRUE); break; - case Private: + case Private: addMemberToList(MemberListType_priStaticAttribs,md,TRUE); break; } @@ -493,16 +493,16 @@ void ClassDef::internalInsertMember(MemberDef *md, { switch (prot) { - case Protected: + case Protected: addMemberToList(MemberListType_proStaticMethods,md,TRUE); break; - case Package: + case Package: addMemberToList(MemberListType_pacStaticMethods,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubStaticMethods,md,TRUE); break; - case Private: + case Private: addMemberToList(MemberListType_priStaticMethods,md,TRUE); break; } @@ -514,17 +514,17 @@ void ClassDef::internalInsertMember(MemberDef *md, { switch (prot) { - case Protected: + case Protected: addMemberToList(MemberListType_proAttribs,md,TRUE); break; case Package: addMemberToList(MemberListType_pacAttribs,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubAttribs,md,TRUE); isSimple=!md->isFunctionPtr(); break; - case Private: + case Private: addMemberToList(MemberListType_priAttribs,md,TRUE); break; } @@ -533,17 +533,17 @@ void ClassDef::internalInsertMember(MemberDef *md, { switch (prot) { - case Protected: + case Protected: addMemberToList(MemberListType_proTypes,md,TRUE); break; - case Package: + case Package: addMemberToList(MemberListType_pacTypes,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubTypes,md,TRUE); isSimple=QCString(md->typeString()).find(")(")==-1; break; - case Private: + case Private: addMemberToList(MemberListType_priTypes,md,TRUE); break; } @@ -552,22 +552,22 @@ void ClassDef::internalInsertMember(MemberDef *md, { switch (prot) { - case Protected: + case Protected: addMemberToList(MemberListType_proMethods,md,TRUE); break; - case Package: + case Package: addMemberToList(MemberListType_pacMethods,md,TRUE); break; - case Public: + case Public: addMemberToList(MemberListType_pubMethods,md,TRUE); break; - case Private: + case Private: addMemberToList(MemberListType_priMethods,md,TRUE); break; } } } - break; + break; } } if (!isSimple) // not a simple field -> not a simple struct @@ -641,17 +641,17 @@ void ClassDef::internalInsertMember(MemberDef *md, err("Unexpected member type %d found!\n",md->memberType()); } } - break; + break; } } /*************************************************/ /* insert member in the appropriate member group */ /*************************************************/ - // Note: this must be done AFTER inserting the member in the + // Note: this must be done AFTER inserting the member in the // regular groups //addMemberToGroup(md,groupId); - + } if (md->virtualness()==Pure) @@ -665,10 +665,10 @@ void ClassDef::internalInsertMember(MemberDef *md, } //::addClassMemberNameToIndex(md); - if (addToAllList && + if (addToAllList && !(Config_getBool("HIDE_FRIEND_COMPOUNDS") && md->isFriend() && - (QCString(md->typeString())=="friend class" || + (QCString(md->typeString())=="friend class" || QCString(md->typeString())=="friend struct" || QCString(md->typeString())=="friend union"))) { @@ -764,16 +764,17 @@ void ClassDef::findSectionsInDocumentation() // add a file name to the used files set -void ClassDef::insertUsedFile(const char *f) +void ClassDef::insertUsedFile(FileDef *fd) { - if (m_impl->files.find(f)==-1) m_impl->files.append(f); + if (fd==0) return; + if (m_impl->files.find(fd)==-1) m_impl->files.append(fd); if (m_impl->templateInstances) { QDictIterator qdi(*m_impl->templateInstances); ClassDef *cd; for (qdi.toFirst();(cd=qdi.current());++qdi) { - cd->insertUsedFile(f); + cd->insertUsedFile(fd); } } } @@ -814,7 +815,7 @@ void ClassDef::setIncludeFile(FileDef *fd, m_impl->incInfo->includeName = includeName; m_impl->incInfo->local = local; } - if (force && includeName) + if (force && includeName) { m_impl->incInfo->includeName = includeName; m_impl->incInfo->local = local; @@ -829,7 +830,7 @@ void ClassDef::setIncludeFile(FileDef *fd, // int pi=0; // if (m_impl->tempArgs) return m_impl->tempArgs; // // find the outer most class scope -// while ((ti=name().find("::",pi))!=-1 && +// while ((ti=name().find("::",pi))!=-1 && // (pcd=getClass(name().left(ti)))==0 // ) pi=ti+2; // if (pcd) @@ -858,7 +859,7 @@ static void searchTemplateSpecs(/*in*/ Definition *d, } name+=clName; bool isSpecialization = d->localName().find('<')!=-1; - if (cd->templateArguments()) + if (cd->templateArguments()) { result.append(cd->templateArguments()); if (!isSpecialization) @@ -881,7 +882,7 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, searchTemplateSpecs(d,specs,name); if (specs.count()>0) // class has template scope specifiers { - ol.startSubsubsection(); + ol.startSubsubsection(); QListIterator spi(specs); ArgumentList *al; for (spi.toFirst();(al=spi.current());++spi) @@ -900,7 +901,7 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, { ol.docify(" = "); ol.docify(a->defval); - } + } a=al->next(); if (a) ol.docify(", "); } @@ -916,12 +917,6 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, } } -bool ClassDef::hasBriefDescription() const -{ - static bool briefMemberDesc = Config_getBool("BRIEF_MEMBER_DESC"); - return !briefDescription().isEmpty() && briefMemberDesc; -} - void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag) { if (hasBriefDescription()) @@ -997,13 +992,13 @@ bool ClassDef::hasDetailedDescription() const { static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); static bool sourceBrowser = Config_getBool("SOURCE_BROWSER"); - return ((!briefDescription().isEmpty() && repeatBrief) || - !documentation().isEmpty() || + return ((!briefDescription().isEmpty() && repeatBrief) || + !documentation().isEmpty() || (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())); } // write the detailed description for this class -void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag, +void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag, const QCString &title,const QCString &anchor) { if (hasDetailedDescription() || exampleFlag) @@ -1038,111 +1033,113 @@ void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageTy //writeTemplateSpec(ol,this,pageType); } } - -void ClassDef::showUsedFiles(OutputList &ol) -{ - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); +QCString ClassDef::generatedFromFiles() const +{ + QCString result; SrcLangExt lang = getLanguage(); - ol.writeRuler(); if (lang==SrcLangExt_Fortran) { - ol.parseText(theTranslator->trGeneratedFromFilesFortran( + result = theTranslator->trGeneratedFromFilesFortran( getLanguage()==SrcLangExt_ObjC && m_impl->compType==Interface ? Class : m_impl->compType, - m_impl->files.count()==1)); + m_impl->files.count()==1); } else if (isJavaEnum()) { - ol.parseText(theTranslator->trEnumGeneratedFromFiles(m_impl->files.count()==1)); + result = theTranslator->trEnumGeneratedFromFiles(m_impl->files.count()==1); } else if (m_impl->compType==Service) { - ol.parseText(theTranslator->trServiceGeneratedFromFiles(m_impl->files.count()==1)); + result = theTranslator->trServiceGeneratedFromFiles(m_impl->files.count()==1); } else if (m_impl->compType==Singleton) { - ol.parseText(theTranslator->trSingletonGeneratedFromFiles(m_impl->files.count()==1)); + result = theTranslator->trSingletonGeneratedFromFiles(m_impl->files.count()==1); } else { - ol.parseText(theTranslator->trGeneratedFromFiles( + result = theTranslator->trGeneratedFromFiles( getLanguage()==SrcLangExt_ObjC && m_impl->compType==Interface ? Class : m_impl->compType, - m_impl->files.count()==1)); + m_impl->files.count()==1); } + return result; +} + +void ClassDef::showUsedFiles(OutputList &ol) +{ + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Man); + + + ol.writeRuler(); + ol.parseText(generatedFromFiles()); bool first=TRUE; - const char *file = m_impl->files.first(); - while (file) + FileDef *fd = m_impl->files.first(); + while (fd) { - bool ambig; - FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig); - if (fd) + if (first) { - if (first) - { - first=FALSE; - ol.startItemList(); - } - - ol.startItemListItem(); - QCString path=fd->getPath(); - if (Config_getBool("FULL_PATH_NAMES")) - { - ol.docify(stripFromPath(path)); - } + first=FALSE; + ol.startItemList(); + } - QCString fname = fd->name(); - if (!fd->getVersion().isEmpty()) // append version if available - { - fname += " (" + fd->getVersion() + ")"; - } + ol.startItemListItem(); + QCString path=fd->getPath(); + if (Config_getBool("FULL_PATH_NAMES")) + { + ol.docify(stripFromPath(path)); + } - // for HTML - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - if (fd->generateSourceFile()) - { - ol.writeObjectLink(0,fd->getSourceFileBase(),0,fname); - } - else if (fd->isLinkable()) - { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, - fname); - } - else - { - ol.docify(fname); - } - ol.popGeneratorState(); + QCString fname = fd->name(); + if (!fd->getVersion().isEmpty()) // append version if available + { + fname += " (" + fd->getVersion() + ")"; + } - // for other output formats - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Html); - if (fd->isLinkable()) - { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, - fname); - } - else - { - ol.docify(fname); - } - ol.popGeneratorState(); + // for HTML + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + if (fd->generateSourceFile()) + { + ol.writeObjectLink(0,fd->getSourceFileBase(),0,fname); + } + else if (fd->isLinkable()) + { + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, + fname); + } + else + { + ol.docify(fname); + } + ol.popGeneratorState(); - ol.endItemListItem(); + // for other output formats + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + if (fd->isLinkable()) + { + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, + fname); } - file=m_impl->files.next(); + else + { + ol.docify(fname); + } + ol.popGeneratorState(); + + ol.endItemListItem(); + + fd=m_impl->files.next(); } if (!first) ol.endItemList(); ol.popGeneratorState(); } - -void ClassDef::writeInheritanceGraph(OutputList &ol) +int ClassDef::countInheritanceNodes() { - // count direct inheritance relations int count=0; BaseClassDef *ibcd; if (m_impl->inheritedBy) @@ -1165,10 +1162,16 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) ibcd=m_impl->inherits->next(); } } + return count; +} + +void ClassDef::writeInheritanceGraph(OutputList &ol) +{ + // count direct inheritance relations + int count=countInheritanceNodes(); - bool renderDiagram = FALSE; - if (Config_getBool("HAVE_DOT") && + if (Config_getBool("HAVE_DOT") && (Config_getBool("CLASS_DIAGRAMS") || Config_getBool("CLASS_GRAPH"))) // write class diagram using dot { @@ -1184,7 +1187,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) renderDiagram = TRUE; } } - else if (Config_getBool("CLASS_DIAGRAMS") && count>0) + else if (Config_getBool("CLASS_DIAGRAMS") && count>0) // write class diagram using build-in generator { ClassDiagram diagram(this); // create a diagram of this class. @@ -1194,7 +1197,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) ol.enable(OutputGenerator::Man); ol.endClassDiagram(diagram,getOutputFileBase(),displayName()); renderDiagram = TRUE; - } + } if (renderDiagram) // if we already show the inheritance relations graphically, // then hide the text version @@ -1228,7 +1231,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) if (cd->isLinkable()) { - if (!Config_getString("GENERATE_TAGFILE").isEmpty()) + if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { Doxygen::tagFile << " prot==Protected) @@ -1243,7 +1246,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) { Doxygen::tagFile << " virtualness=\"virtual\""; } - Doxygen::tagFile << ">" << convertToXML(cd->name()) + Doxygen::tagFile << ">" << convertToXML(cd->name()) << "" << endl; } ol.writeObjectLink(cd->getReference(), @@ -1261,7 +1264,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) err("invalid marker %d in inherits list!\n",entryIndex); } index=newIndex+matchLen; - } + } ol.parseText(inheritLine.right(inheritLine.length()-index)); ol.endParagraph(); } @@ -1294,12 +1297,12 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) writeInheritanceSpecifier(ol,bcd); } index=newIndex+matchLen; - } + } ol.parseText(inheritLine.right(inheritLine.length()-index)); ol.endParagraph(); } - if (renderDiagram) + if (renderDiagram) { ol.enableAll(); } @@ -1322,33 +1325,40 @@ void ClassDef::writeCollaborationGraph(OutputList &ol) } } +QCString ClassDef::includeStatement() const +{ + SrcLangExt lang = getLanguage(); + bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java; + if (isIDLorJava) + { + return "import"; + } + else if (isObjectiveC()) + { + return "#import "; + } + else + { + return "#include "; + } +} + void ClassDef::writeIncludeFiles(OutputList &ol) { if (m_impl->incInfo /*&& Config_getBool("SHOW_INCLUDE_FILES")*/) { - QCString nm=m_impl->incInfo->includeName.isEmpty() ? + QCString nm=m_impl->incInfo->includeName.isEmpty() ? (m_impl->incInfo->fileDef ? - m_impl->incInfo->fileDef->docName().data() : "" + m_impl->incInfo->fileDef->docName().data() : "" ) : m_impl->incInfo->includeName.data(); if (!nm.isEmpty()) { ol.startParagraph(); ol.startTypewriter(); + ol.docify(includeStatement()); SrcLangExt lang = getLanguage(); bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java; - if (isIDLorJava) - { - ol.docify("import "); - } - else if (isObjectiveC()) - { - ol.docify("#import "); - } - else - { - ol.docify("#include "); - } if (m_impl->incInfo->local || isIDLorJava) ol.docify("\""); else @@ -1371,7 +1381,7 @@ void ClassDef::writeIncludeFiles(OutputList &ol) ol.docify("\""); else ol.docify(">"); - if (isIDLorJava) + if (isIDLorJava) ol.docify(";"); ol.endTypewriter(); ol.endParagraph(); @@ -1426,7 +1436,7 @@ void ClassDef::writeMemberGroups(OutputList &ol,bool showInline) void ClassDef::writeNestedClasses(OutputList &ol,const QCString &title) { // nested classes - if (m_impl->innerClasses) + if (m_impl->innerClasses) { m_impl->innerClasses->writeDeclaration(ol,0,title,TRUE); } @@ -1434,7 +1444,7 @@ void ClassDef::writeNestedClasses(OutputList &ol,const QCString &title) void ClassDef::writeInlineClasses(OutputList &ol) { - if (m_impl->innerClasses) + if (m_impl->innerClasses) { m_impl->innerClasses->writeDocumentation(ol,this); } @@ -1502,12 +1512,12 @@ void ClassDef::writeSummaryLinks(OutputList &ol) LayoutDocEntry *lde; bool first=TRUE; SrcLangExt lang = getLanguage(); - + if (lang!=SrcLangExt_VHDL) { for (eli.toFirst();(lde=eli.current());++eli) { - if (lde->kind()==LayoutDocEntry::ClassNestedClasses && + if (lde->kind()==LayoutDocEntry::ClassNestedClasses && m_impl->innerClasses && m_impl->innerClasses->declVisible() ) @@ -1555,7 +1565,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol) void ClassDef::writeTagFileMarker() { // write section to the tag file - if (!Config_getString("GENERATE_TAGFILE").isEmpty()) + if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { Doxygen::tagFile << " kind()) { - case LayoutDocEntry::BriefDesc: + case LayoutDocEntry::BriefDesc: { // since we already shown the brief description in the // declaration part of the container, so we use this to @@ -1648,15 +1658,15 @@ void ClassDef::writeInlineDocumentation(OutputList &ol) writeDetailedDocumentationBody(ol); } break; - case LayoutDocEntry::ClassInheritanceGraph: - writeInheritanceGraph(ol); - break; - case LayoutDocEntry::ClassCollaborationGraph: - writeCollaborationGraph(ol); - break; - case LayoutDocEntry::MemberDeclStart: + case LayoutDocEntry::ClassInheritanceGraph: + writeInheritanceGraph(ol); + break; + case LayoutDocEntry::ClassCollaborationGraph: + writeCollaborationGraph(ol); + break; + case LayoutDocEntry::MemberDeclStart: if (!isSimple) startMemberDeclarations(ol); - break; + break; case LayoutDocEntry::MemberDecl: { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; @@ -1666,13 +1676,13 @@ void ClassDef::writeInlineDocumentation(OutputList &ol) case LayoutDocEntry::MemberGroups: if (!isSimple) writeMemberGroups(ol,TRUE); break; - case LayoutDocEntry::MemberDeclEnd: + case LayoutDocEntry::MemberDeclEnd: if (!isSimple) endMemberDeclarations(ol); break; - case LayoutDocEntry::MemberDefStart: + case LayoutDocEntry::MemberDefStart: if (!isSimple) startMemberDocumentation(ol); - break; - case LayoutDocEntry::MemberDef: + break; + case LayoutDocEntry::MemberDef: { LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; if (isSimple) @@ -1684,8 +1694,8 @@ void ClassDef::writeInlineDocumentation(OutputList &ol) writeMemberDocumentation(ol,lmd->type,lmd->title(lang),TRUE); } } - break; - case LayoutDocEntry::MemberDefEnd: + break; + case LayoutDocEntry::MemberDefEnd: if (!isSimple) endMemberDocumentation(ol); break; default: @@ -1757,8 +1767,8 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES"); bool isLink = isLinkable(); SrcLangExt lang = getLanguage(); - if (isLink || - (!hideUndocClasses && + if (isLink || + (!hideUndocClasses && (!isLocal() || extractLocalClasses) ) ) @@ -1776,7 +1786,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade } else { - ol.parseText(lang==SrcLangExt_Fortran ? + ol.parseText(lang==SrcLangExt_Fortran ? theTranslator->trDataTypes() : theTranslator->trCompounds()); } @@ -1787,7 +1797,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade if (!Config_getString("GENERATE_TAGFILE").isEmpty() && !isReference()) // skip classes found in tag files { - Doxygen::tagFile << " " << convertToXML(name()) << "" << endl; } ol.startMemberDeclaration(); @@ -1801,7 +1811,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade ol.writeString(" "); ol.insertMemberAlign(); } - if (isLink) + if (isLink) { ol.writeObjectLink(getReference(), getOutputFileBase(), @@ -1809,7 +1819,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade cname ); } - else + else { ol.startBold(); ol.docify(cname); @@ -1899,67 +1909,67 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page { switch (lde->kind()) { - case LayoutDocEntry::BriefDesc: + case LayoutDocEntry::BriefDesc: writeBriefDescription(ol,exampleFlag); - break; - case LayoutDocEntry::ClassIncludes: + break; + case LayoutDocEntry::ClassIncludes: writeIncludeFiles(ol); break; - case LayoutDocEntry::ClassInheritanceGraph: - writeInheritanceGraph(ol); - break; - case LayoutDocEntry::ClassCollaborationGraph: - writeCollaborationGraph(ol); - break; - case LayoutDocEntry::ClassAllMembersLink: + case LayoutDocEntry::ClassInheritanceGraph: + writeInheritanceGraph(ol); + break; + case LayoutDocEntry::ClassCollaborationGraph: + writeCollaborationGraph(ol); + break; + case LayoutDocEntry::ClassAllMembersLink: //writeAllMembersLink(ol); // this is now part of the summary links break; - case LayoutDocEntry::MemberDeclStart: + case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); - break; - case LayoutDocEntry::MemberGroups: + break; + case LayoutDocEntry::MemberGroups: writeMemberGroups(ol); break; - case LayoutDocEntry::MemberDecl: + case LayoutDocEntry::MemberDecl: { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; writeMemberDeclarations(ol,lmd->type,lmd->title(lang),lmd->subtitle(lang)); } - break; - case LayoutDocEntry::ClassNestedClasses: + break; + case LayoutDocEntry::ClassNestedClasses: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeNestedClasses(ol,ls->title(lang)); } break; - case LayoutDocEntry::MemberDeclEnd: + case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; - case LayoutDocEntry::DetailedDesc: + case LayoutDocEntry::DetailedDesc: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeDetailedDescription(ol,pageType,exampleFlag,ls->title(lang)); } - break; - case LayoutDocEntry::MemberDefStart: + break; + case LayoutDocEntry::MemberDefStart: startMemberDocumentation(ol); - break; + break; case LayoutDocEntry::ClassInlineClasses: writeInlineClasses(ol); break; - case LayoutDocEntry::MemberDef: + case LayoutDocEntry::MemberDef: { LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } - break; - case LayoutDocEntry::MemberDefEnd: + break; + case LayoutDocEntry::MemberDefEnd: endMemberDocumentation(ol); break; - case LayoutDocEntry::ClassUsedFiles: + case LayoutDocEntry::ClassUsedFiles: showUsedFiles(ol); break; - case LayoutDocEntry::AuthorSection: + case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::NamespaceNestedNamespaces: @@ -1971,16 +1981,16 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: - case LayoutDocEntry::FileIncludedByGraph: + case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: - case LayoutDocEntry::GroupClasses: - case LayoutDocEntry::GroupInlineClasses: + case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: - case LayoutDocEntry::GroupDirs: - case LayoutDocEntry::GroupNestedGroups: + case LayoutDocEntry::GroupDirs: + case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: - case LayoutDocEntry::GroupGraph: + case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: @@ -1991,7 +2001,7 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page } } - if (!Config_getString("GENERATE_TAGFILE").isEmpty()) + if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { writeDocAnchorsToTagFile(); Doxygen::tagFile << " " << endl; @@ -2003,12 +2013,12 @@ QCString ClassDef::title() const { QCString pageTitle; SrcLangExt lang = getLanguage(); - + if (lang==SrcLangExt_Fortran) { pageTitle = theTranslator->trCompoundReferenceFortran(displayName(), m_impl->compType, - m_impl->tempArgs != 0); + m_impl->tempArgs != 0); } else if (lang==SrcLangExt_VHDL) { @@ -2042,8 +2052,8 @@ void ClassDef::writeDocumentation(OutputList &ol) //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); //static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); QCString pageTitle = title(); - - startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible,!generateTreeView); + + startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible,!generateTreeView); if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) @@ -2059,7 +2069,7 @@ void ClassDef::writeDocumentation(OutputList &ol) addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),displayName()); writeDocumentationContents(ol,pageTitle); - + endFileWithNavPath(this,ol); if (Config_getBool("SEPARATE_MEMBER_PAGES")) @@ -2076,7 +2086,7 @@ void ClassDef::writeMemberPages(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - + QListIterator mli(m_impl->memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) @@ -2177,7 +2187,7 @@ void ClassDef::writeMemberList(OutputList &ol) QCString memListFile = getMemberListFileName(); startFile(ol,memListFile,memListFile,theTranslator->trMemberList(), - HLI_ClassVisible,!generateTreeView,getOutputFileBase()); + HLI_ClassVisible,!generateTreeView,getOutputFileBase()); if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) @@ -2195,13 +2205,13 @@ void ClassDef::writeMemberList(OutputList &ol) ol.writeObjectLink(getReference(),getOutputFileBase(),anchor(),displayName()); ol.parseText(theTranslator->trIncludingInheritedMembers()); ol.endParagraph(); - + //ol.startItemList(); ol.writeString("\n"); - + int idx=0; //MemberNameInfo *mni=m_impl->allMemberNameInfoList->first(); - MemberNameInfoSDict::Iterator mnii(*m_impl->allMemberNameInfoSDict); + MemberNameInfoSDict::Iterator mnii(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; for (mnii.toFirst();(mni=mnii.current());++mnii) { @@ -2212,14 +2222,14 @@ void ClassDef::writeMemberList(OutputList &ol) ClassDef *cd=md->getClassDef(); Protection prot = mi->prot; Specifier virt=md->virtualness(); - + //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n", // name().data(),md->name().data(),cd->name().data(),md->protection(),mi->prot,prot,mi->inherited); if (cd && !md->name().isEmpty() && md->name()[0]!='@') { bool memberWritten=FALSE; - if (cd->isLinkable() && md->isLinkable()) + if (cd->isLinkable() && md->isLinkable()) // create a link to the documentation { QCString name=mi->ambiguityResolutionScope+md->name(); @@ -2255,7 +2265,7 @@ void ClassDef::writeMemberList(OutputList &ol) md->anchor(),name); if ( md->isFunction() || md->isSignal() || md->isSlot() || - (md->isFriend() && md->argsString())) + (md->isFriend() && md->argsString())) ol.docify(md->argsString()); else if (md->isEnumerate()) ol.parseText(" "+theTranslator->trEnumName()); @@ -2271,9 +2281,9 @@ void ClassDef::writeMemberList(OutputList &ol) memberWritten=TRUE; } else if (!cd->isArtificial() && - !Config_getBool("HIDE_UNDOC_MEMBERS") && - (protectionLevelVisible(md->protection()) || md->isFriend()) - ) // no documentation, + !Config_getBool("HIDE_UNDOC_MEMBERS") && + (protectionLevelVisible(md->protection()) || md->isFriend()) + ) // no documentation, // generate link to the class instead. { //ol.writeListItem(); @@ -2298,7 +2308,7 @@ void ClassDef::writeMemberList(OutputList &ol) ol.endBold(); if (!md->isObjCMethod()) { - if ( md->isFunction() || md->isSignal() || md->isSlot() ) + if ( md->isFunction() || md->isSignal() || md->isSlot() ) ol.docify(md->argsString()); else if (md->isEnumerate()) ol.parseText(" "+theTranslator->trEnumName()); @@ -2333,15 +2343,15 @@ void ClassDef::writeMemberList(OutputList &ol) ol.writeObjectLink(cd->getReference(), cd->getOutputFileBase(), cd->anchor(), - md->category() ? - md->category()->displayName() : + md->category() ? + md->category()->displayName() : cd->displayName()); ol.writeString(""); ol.writeString("
"); } SrcLangExt lang = md->getLanguage(); if ( - (prot!=Public || (virt!=Normal && getLanguage()!=SrcLangExt_ObjC) || + (prot!=Public || (virt!=Normal && getLanguage()!=SrcLangExt_ObjC) || md->isFriend() || md->isRelated() || md->isExplicit() || md->isMutable() || (md->isInline() && Config_getBool("INLINE_INFO")) || md->isSignal() || md->isSlot() || @@ -2353,7 +2363,7 @@ void ClassDef::writeMemberList(OutputList &ol) { ol.writeString(""); QStrList sl; - if (lang==SrcLangExt_VHDL) + if (lang==SrcLangExt_VHDL) { sl.append(VhdlDocGen::trVhdlType(md->getMemberSpecifiers())); //append vhdl type } @@ -2361,14 +2371,14 @@ void ClassDef::writeMemberList(OutputList &ol) else if (md->isRelated()) sl.append("related"); else { - if (Config_getBool("INLINE_INFO") && md->isInline()) + if (Config_getBool("INLINE_INFO") && md->isInline()) sl.append("inline"); if (md->isExplicit()) sl.append("explicit"); if (md->isMutable()) sl.append("mutable"); if (prot==Protected) sl.append("protected"); else if (prot==Private) sl.append("private"); else if (prot==Package) sl.append("package"); - if (virt==Virtual && getLanguage()!=SrcLangExt_ObjC) + if (virt==Virtual && getLanguage()!=SrcLangExt_ObjC) sl.append("virtual"); else if (virt==Pure) sl.append("pure virtual"); if (md->isStatic()) sl.append("static"); @@ -2408,7 +2418,7 @@ void ClassDef::writeMemberList(OutputList &ol) //ol.endItemList(); ol.writeString("
"); - + endFile(ol); ol.popGeneratorState(); } @@ -2438,7 +2448,7 @@ bool ClassDef::addExample(const char *anchor,const char *nameStr, // returns TRUE if this class is used in an example bool ClassDef::hasExamples() { - if (m_impl->exampleSDict==0) + if (m_impl->exampleSDict==0) return FALSE; else return m_impl->exampleSDict->count()>0; @@ -2449,7 +2459,7 @@ void ClassDef::setTemplateArguments(ArgumentList *al) { if (al==0) return; if (!m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed - m_impl->tempArgs=new ArgumentList; + m_impl->tempArgs=new ArgumentList; ArgumentListIterator ali(*al); Argument *a; for (;(a=ali.current());++ali) @@ -2472,12 +2482,12 @@ void ClassDef::setTypeConstraints(ArgumentList *al) } /*! Returns \c TRUE iff this class or a class inheriting from this class - * is \e not defined in an external tag file. + * is \e not defined in an external tag file. */ bool ClassDef::hasNonReferenceSuperClass() { - bool found=!isReference() && isLinkableInProject() && !isHidden(); - if (found) + bool found=!isReference() && isLinkableInProject() && !isHidden(); + if (found) { return TRUE; // we're done if this class is not a reference } @@ -2488,7 +2498,7 @@ bool ClassDef::hasNonReferenceSuperClass() { ClassDef *bcd=bcli.current()->classDef; // recurse into the super class branch - found = found || bcd->hasNonReferenceSuperClass(); + found = found || bcd->hasNonReferenceSuperClass(); if (!found) { // look for template instances that might have non-reference super classes @@ -2508,7 +2518,7 @@ bool ClassDef::hasNonReferenceSuperClass() return found; } -/*! called from MemberDef::writeDeclaration() to (recusively) write the +/*! called from MemberDef::writeDeclaration() to (recusively) write the * definition of an anonymous struct, union or class. */ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, @@ -2524,7 +2534,7 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, if (ri==-1) ri=name().length(); QCString cn=name().right(name().length()-ri-2); if (!cn.isEmpty() && cn.at(0)!='@' && md) - { + { if (cn.right(2)=="-p" /*|| cn.right(2)=="-g"*/) { cn = cn.left(cn.length()-2); @@ -2542,7 +2552,7 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, } } ol.docify(" {"); - ol.endMemberItem(); + ol.endMemberItem(); // write user defined member groups if (m_impl->memberGroupSDict) @@ -2571,7 +2581,7 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, /*! a link to this class is possible within this project */ bool ClassDef::isLinkableInProject() const -{ +{ static bool extractLocal = Config_getBool("EXTRACT_LOCAL_CLASSES"); static bool extractStatic = Config_getBool("EXTRACT_STATIC"); static bool hideUndoc = Config_getBool("HIDE_UNDOC_CLASSES"); @@ -2586,7 +2596,7 @@ bool ClassDef::isLinkableInProject() const name().find('@')==-1 && /* not anonymous */ protectionLevelVisible(m_impl->prot) && /* private/internal */ (!m_impl->isLocal || extractLocal) && /* local */ - (hasDocumentation() || !hideUndoc) && /* documented */ + (hasDocumentation() || !hideUndoc) && /* documented */ (!m_impl->isStatic || extractStatic) && /* static */ !isReference(); /* not an external reference */ } @@ -2606,8 +2616,8 @@ bool ClassDef::isLinkable() const /*! the class is visible in a class diagram, or class hierarchy */ -bool ClassDef::isVisibleInHierarchy() -{ +bool ClassDef::isVisibleInHierarchy() +{ static bool allExternals = Config_getBool("ALLEXTERNALS"); static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES"); static bool extractStatic = Config_getBool("EXTRACT_STATIC"); @@ -2620,10 +2630,10 @@ bool ClassDef::isVisibleInHierarchy() /*!isArtificial() &&*/ // 1.8.2: allowed these to appear // and not privately inherited protectionLevelVisible(m_impl->prot) && - // documented or shown anyway or documentation is external - (hasDocumentation() || - !hideUndocClasses || - (m_impl->templateMaster && m_impl->templateMaster->hasDocumentation()) || + // documented or shown anyway or documentation is external + (hasDocumentation() || + !hideUndocClasses || + (m_impl->templateMaster && m_impl->templateMaster->hasDocumentation()) || isReference() ) && // is not part of an unnamed namespace or shown anyway @@ -2637,7 +2647,7 @@ bool ClassDef::hasDocumentation() const //---------------------------------------------------------------------- // recursive function: -// returns TRUE iff class definition `bcd' represents an (in)direct base +// returns TRUE iff class definition `bcd' represents an (in)direct base // class of class definition `cd'. bool ClassDef::isBaseClass(ClassDef *bcd, bool followInstances,int level) @@ -2659,9 +2669,9 @@ bool ClassDef::isBaseClass(ClassDef *bcd, bool followInstances,int level) ClassDef *ccd=bcli.current()->classDef; if (!followInstances && ccd->templateMaster()) ccd=ccd->templateMaster(); //printf("isBaseClass() baseclass %s\n",ccd->name().data()); - if (ccd==bcd) + if (ccd==bcd) found=TRUE; - else + else found=ccd->isBaseClass(bcd,followInstances,level+1); } } @@ -2684,9 +2694,9 @@ bool ClassDef::isSubClass(ClassDef *cd,int level) for ( ; bcli.current() && !found ; ++bcli) { ClassDef *ccd=bcli.current()->classDef; - if (ccd==cd) + if (ccd==cd) found=TRUE; - else + else found=ccd->isSubClass(cd,level+1); } } @@ -2702,8 +2712,8 @@ static bool isStandardFunc(MemberDef *md) md->isDestructor(); // destructor } -/*! - * recusively merges the `all members' lists of a class base +/*! + * recusively merges the `all members' lists of a class base * with that of this class. Must only be called for classes without * subclasses! */ @@ -2727,7 +2737,7 @@ void ClassDef::mergeMembers() BaseClassDef *bcd; for ( ; (bcd=bcli.current()) ; ++bcli ) { - ClassDef *bClass=bcd->classDef; + ClassDef *bClass=bcd->classDef; // merge the members in the base class of this inheritance branch first bClass->mergeMembers(); @@ -2746,10 +2756,10 @@ void ClassDef::mergeMembers() if (dstMnd!=0 && (dstMni=dstMnd->find(srcMni->memberName()))) // a member with that name is already in the class. // the member may hide or reimplement the one in the sub class - // or there may be another path to the base class that is already + // or there may be another path to the base class that is already // visited via another branch in the class hierarchy. { - MemberNameInfoIterator srcMnii(*srcMni); + MemberNameInfoIterator srcMnii(*srcMni); MemberInfo *srcMi; for ( ; (srcMi=srcMnii.current()) ; ++srcMnii ) { @@ -2757,7 +2767,7 @@ void ClassDef::mergeMembers() bool found=FALSE; bool ambigue=FALSE; bool hidden=FALSE; - MemberNameInfoIterator dstMnii(*dstMni); + MemberNameInfoIterator dstMnii(*dstMni); MemberInfo *dstMi; ClassDef *srcCd = srcMd->getClassDef(); for ( ; (dstMi=dstMnii.current()) && !found; ++dstMnii ) @@ -2767,7 +2777,7 @@ void ClassDef::mergeMembers() { ClassDef *dstCd = dstMd->getClassDef(); //printf(" Is %s a base class of %s?\n",srcCd->name().data(),dstCd->name().data()); - if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE)) + if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE)) // member is in the same or a base class { ArgumentList *srcAl = srcMd->argumentList(); @@ -2799,18 +2809,18 @@ void ClassDef::mergeMembers() } else // same members { - // do not add if base class is virtual or + // do not add if base class is virtual or // if scope paths are equal or // if base class is an interface (and thus implicitly virtual). //printf("same member found srcMi->virt=%d dstMi->virt=%d\n",srcMi->virt,dstMi->virt); if ((srcMi->virt!=Normal && dstMi->virt!=Normal) || bClass->name()+sep+srcMi->scopePath == dstMi->scopePath || dstMd->getClassDef()->compoundType()==Interface - ) + ) { found=TRUE; } - else // member can be reached via multiple paths in the + else // member can be reached via multiple paths in the // inheritance tree { //printf("$$ Existing member %s %s add scope %s\n", @@ -2832,10 +2842,10 @@ void ClassDef::mergeMembers() // TODO: fix the case where a member is hidden by inheritance // of a member with the same name but with another prototype, - // while there is more than one path to the member in the + // while there is more than one path to the member in the // base class due to multiple inheritance. In this case - // it seems that the member is not reachable by prefixing a - // scope name either (according to my compiler). Currently, + // it seems that the member is not reachable by prefixing a + // scope name either (according to my compiler). Currently, // this case is shown anyway. if (!found && srcMd->protection()!=Private && !srcMd->isFriend()) { @@ -2890,10 +2900,10 @@ void ClassDef::mergeMembers() } else // base class has a member that is not in the sub class => copy { - // create a deep copy of the list (only the MemberInfo's will be + // create a deep copy of the list (only the MemberInfo's will be // copied, not the actual MemberDef's) MemberNameInfo *newMni = 0; - newMni = new MemberNameInfo(srcMni->memberName()); + newMni = new MemberNameInfo(srcMni->memberName()); // copy the member(s) from the base to the sub class MemberNameInfoIterator mnii(*srcMni); @@ -3000,7 +3010,7 @@ void ClassDef::mergeCategory(ClassDef *category) } // make methods private for categories defined in the .m file //printf("%s::mergeCategory makePrivate=%d\n",name().data(),makePrivate); - + MemberNameInfoSDict *srcMnd = category->memberNameInfoSDict(); MemberNameInfoSDict *dstMnd = m_impl->allMemberNameInfoSDict; @@ -3019,7 +3029,7 @@ void ClassDef::mergeCategory(ClassDef *category) //if (dstMi) //{ // Protection prot = dstMi->prot; - // if (makePrivate || isExtension) + // if (makePrivate || isExtension) // { // prot = Private; // removeMemberFromLists(dstMi->memberDef); @@ -3039,7 +3049,7 @@ void ClassDef::mergeCategory(ClassDef *category) //printf("New member %s\n",srcMni->memberName()); // create a deep copy of the list MemberNameInfo *newMni = 0; - newMni = new MemberNameInfo(srcMni->memberName()); + newMni = new MemberNameInfo(srcMni->memberName()); // copy the member(s) from the category to this class MemberNameInfoIterator mnii(*srcMni); @@ -3079,7 +3089,7 @@ void ClassDef::mergeCategory(ClassDef *category) newMd->setCategory(category); newMd->setCategoryRelation(mi->memberDef); mi->memberDef->setCategoryRelation(newMd); - if (makePrivate || isExtension) + if (makePrivate || isExtension) { newMd->makeImplementationDetail(); } @@ -3102,9 +3112,9 @@ void ClassDef::addUsedClass(ClassDef *cd,const char *accessName, static bool umlLook = Config_getBool("UML_LOOK"); if (prot==Private && !extractPrivate) return; //printf("%s::addUsedClass(%s,%s)\n",name().data(),cd->name().data(),accessName); - if (m_impl->usesImplClassDict==0) + if (m_impl->usesImplClassDict==0) { - m_impl->usesImplClassDict = new UsesClassDict(17); + m_impl->usesImplClassDict = new UsesClassDict(17); m_impl->usesImplClassDict->setAutoDelete(TRUE); } UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name()); @@ -3136,9 +3146,9 @@ void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName, static bool umlLook = Config_getBool("UML_LOOK"); if (prot==Private && !extractPrivate) return; //printf("%s::addUsedByClass(%s,%s)\n",name().data(),cd->name().data(),accessName); - if (m_impl->usedByImplClassDict==0) + if (m_impl->usedByImplClassDict==0) { - m_impl->usedByImplClassDict = new UsesClassDict(17); + m_impl->usedByImplClassDict = new UsesClassDict(17); m_impl->usedByImplClassDict->setAutoDelete(TRUE); } UsesClassDef *ucd=m_impl->usedByImplClassDict->find(cd->name()); @@ -3165,8 +3175,8 @@ void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName, #if 0 -/*! Builds up a dictionary of all classes that are used by the state of this - * class (the "implementation"). +/*! Builds up a dictionary of all classes that are used by the state of this + * class (the "implementation"). * Must be called before mergeMembers() is called! */ @@ -3205,7 +3215,7 @@ void ClassDef::determineImplUsageRelation() if (arg->name==usedClassName) // type is a template argument { found=TRUE; - if (m_impl->usesImplClassDict==0) m_impl->usesImplClassDict = new UsesClassDict(257); + if (m_impl->usesImplClassDict==0) m_impl->usesImplClassDict = new UsesClassDict(257); cd = new ClassDef(cd->getDefFileName(),cd->getDefLine(), usedClassName,ClassDef::Class); cd->setIsTemplateBaseClass(count); @@ -3232,12 +3242,12 @@ void ClassDef::determineImplUsageRelation() if (cd==0) cd=getResolvedClass(name()+"::"+usedClassName,0,&templSpec); if (cd==0) cd=getResolvedClass(usedClassName,0,&templSpec); // TODO: also try in-between scopes! //printf("Search for class %s result=%p\n",usedClassName.data(),cd); - if (cd) // class exists + if (cd) // class exists { found=TRUE; - if (m_impl->usesImplClassDict==0) + if (m_impl->usesImplClassDict==0) { - m_impl->usesImplClassDict = new UsesClassDict(257); + m_impl->usesImplClassDict = new UsesClassDict(257); m_impl->usesImplClassDict->setAutoDelete(TRUE); } UsesClassDef *ucd=m_impl->usesImplClassDict->find(cd->name()); @@ -3267,7 +3277,7 @@ void ClassDef::determineImplUsageRelation() for (;(ucd=ucdi.current());++ucdi) { msg(" %s via ",ucd->classDef->name().data()); - QDictIterator dvi(*ucd->accessors); + QDictIterator dvi(*ucd->accessors); const char *s; for (;(s=dvi.currentKey());++dvi) { @@ -3295,9 +3305,9 @@ void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) if (cd==0) cd=getClass(type.mid(i,l)); // TODO: also try in-between scopes! if (cd && cd!=this && !isBaseClass(cd)) { - if (m_impl->usesIntfClassDict==0) + if (m_impl->usesIntfClassDict==0) { - m_impl->usesIntfClassDict = new UsesClassDict(257); + m_impl->usesIntfClassDict = new UsesClassDict(257); } UsesClassDef *ucd=m_impl->usesIntfClassDict->find(cd->name()); if (ucd==0) @@ -3326,7 +3336,7 @@ void ClassDef::determineIntfUsageRelation() for (mnii.toFirst();(mi=mnii.current());++mnii) { MemberDef *md=mi->memberDef; - + // compute the protection level for this member Protection protect=md->protection(); if (mi->prot==Protected) // inherited protection @@ -3334,8 +3344,8 @@ void ClassDef::determineIntfUsageRelation() if (protect==Public) protect=Protected; else if (protect==Protected) protect=Private; } - - if (!md->name().isEmpty() && md->name()[0]!='@' && + + if (!md->name().isEmpty() && md->name()[0]!='@' && (mi->prot!=Private && protect!=Private) ) { @@ -3375,7 +3385,7 @@ QCString ClassDef::compoundTypeString() const case Category: return "category"; case Exception: return "exception"; default: return "unknown"; - } + } } else { @@ -3395,8 +3405,8 @@ QCString ClassDef::compoundTypeString() const } } -QCString ClassDef::getOutputFileBase() const -{ +QCString ClassDef::getOutputFileBase() const +{ if (!Doxygen::generatingXmlOutput) { static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES"); @@ -3437,36 +3447,36 @@ QCString ClassDef::getOutputFileBase() const else { // normal locally defined class - return convertNameToFile(m_impl->fileName); + return convertNameToFile(m_impl->fileName); } } -QCString ClassDef::getInstanceOutputFileBase() const -{ +QCString ClassDef::getInstanceOutputFileBase() const +{ if (isReference()) { return m_impl->fileName; } else { - return convertNameToFile(m_impl->fileName); + return convertNameToFile(m_impl->fileName); } } -QCString ClassDef::getFileBase() const -{ +QCString ClassDef::getFileBase() const +{ if (m_impl->templateMaster) { return m_impl->templateMaster->getFileBase(); } else { - return m_impl->fileName; + return m_impl->fileName; } } -QCString ClassDef::getSourceFileBase() const -{ +QCString ClassDef::getSourceFileBase() const +{ if (m_impl->templateMaster) { return m_impl->templateMaster->getSourceFileBase(); @@ -3568,7 +3578,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, int startLine, int startColumn, const QCString &templSpec,bool &freshInstance) { freshInstance = FALSE; - if (m_impl->templateInstances==0) + if (m_impl->templateInstances==0) { m_impl->templateInstances = new QDict(17); } @@ -3590,7 +3600,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, ClassDef *ClassDef::getVariableInstance(const char *templSpec) { - if (m_impl->variableInstances==0) + if (m_impl->variableInstances==0) { m_impl->variableInstances = new QDict(17); m_impl->variableInstances->setAutoDelete(TRUE); @@ -3746,7 +3756,7 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( QCString clName = className(); //bool isGeneric = getLanguage()==SrcLangExt_CSharp; - //if (isGeneric && clName.right(2)=="-g") + //if (isGeneric && clName.right(2)=="-g") //{ // clName = clName.left(clName.length()-2); //} @@ -3928,7 +3938,7 @@ void ClassDef::sortMemberLists() * For protected inheritance, both protected and public members of the * base class should be joined in the protected member section. * - * For private inheritance, both protected and public members of the + * For private inheritance, both protected and public members of the * base class should be joined in the private member section. */ static void convertProtectionLevel( @@ -3948,9 +3958,9 @@ static void convertProtectionLevel( // the private section of the base class should not // be visible { - case MemberListType_priMethods: - case MemberListType_priStaticMethods: - case MemberListType_priSlots: + case MemberListType_priMethods: + case MemberListType_priStaticMethods: + case MemberListType_priSlots: case MemberListType_priAttribs: case MemberListType_priStaticAttribs: case MemberListType_priTypes: @@ -3967,15 +3977,15 @@ static void convertProtectionLevel( // both the public and protected members are shown // as protected { - case MemberListType_pubMethods: - case MemberListType_pubStaticMethods: - case MemberListType_pubSlots: - case MemberListType_pubAttribs: - case MemberListType_pubStaticAttribs: - case MemberListType_pubTypes: - case MemberListType_priMethods: - case MemberListType_priStaticMethods: - case MemberListType_priSlots: + case MemberListType_pubMethods: + case MemberListType_pubStaticMethods: + case MemberListType_pubSlots: + case MemberListType_pubAttribs: + case MemberListType_pubStaticAttribs: + case MemberListType_pubTypes: + case MemberListType_priMethods: + case MemberListType_priStaticMethods: + case MemberListType_priSlots: case MemberListType_priAttribs: case MemberListType_priStaticAttribs: case MemberListType_priTypes: @@ -3983,25 +3993,25 @@ static void convertProtectionLevel( *outListType2=-1; break; - case MemberListType_proMethods: + case MemberListType_proMethods: *outListType2=MemberListType_pubMethods; break; - case MemberListType_proStaticMethods: + case MemberListType_proStaticMethods: *outListType2=MemberListType_pubStaticMethods; break; - case MemberListType_proSlots: + case MemberListType_proSlots: *outListType2=MemberListType_pubSlots; break; - case MemberListType_proAttribs: + case MemberListType_proAttribs: *outListType2=MemberListType_pubAttribs; break; - case MemberListType_proStaticAttribs: + case MemberListType_proStaticAttribs: *outListType2=MemberListType_pubStaticAttribs; break; - case MemberListType_proTypes: + case MemberListType_proTypes: *outListType2=MemberListType_pubTypes; break; - default: + default: break; } } @@ -4011,15 +4021,15 @@ static void convertProtectionLevel( // both the public and protected members are shown // as private { - case MemberListType_pubMethods: - case MemberListType_pubStaticMethods: - case MemberListType_pubSlots: - case MemberListType_pubAttribs: - case MemberListType_pubStaticAttribs: - case MemberListType_pubTypes: - case MemberListType_proMethods: - case MemberListType_proStaticMethods: - case MemberListType_proSlots: + case MemberListType_pubMethods: + case MemberListType_pubStaticMethods: + case MemberListType_pubSlots: + case MemberListType_pubAttribs: + case MemberListType_pubStaticAttribs: + case MemberListType_pubTypes: + case MemberListType_proMethods: + case MemberListType_proStaticMethods: + case MemberListType_proSlots: case MemberListType_proAttribs: case MemberListType_proStaticAttribs: case MemberListType_proTypes: @@ -4027,7 +4037,7 @@ static void convertProtectionLevel( *outListType2=-1; break; - case MemberListType_priMethods: + case MemberListType_priMethods: if (extractPrivate) { *outListType1=MemberListType_pubMethods; @@ -4039,7 +4049,7 @@ static void convertProtectionLevel( *outListType2=-1; } break; - case MemberListType_priStaticMethods: + case MemberListType_priStaticMethods: if (extractPrivate) { *outListType1=MemberListType_pubStaticMethods; @@ -4051,7 +4061,7 @@ static void convertProtectionLevel( *outListType2=-1; } break; - case MemberListType_priSlots: + case MemberListType_priSlots: if (extractPrivate) { *outListType1=MemberListType_pubSlots; @@ -4099,7 +4109,7 @@ static void convertProtectionLevel( *outListType2=-1; } break; - default: + default: break; } } @@ -4116,7 +4126,7 @@ int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, MemberList * ml2 = getMemberList((MemberListType)lt2); if (getLanguage()!=SrcLangExt_VHDL) // use specific declarations function { - if (ml) + if (ml) { ml->countDecMembers(); count+=ml->numDecMembers(); @@ -4164,7 +4174,7 @@ int ClassDef::countInheritedDecMembers(MemberListType lt, convertProtectionLevel(lt,ibcd->prot,<1,<2); //printf("%s: convert %d->(%d,%d) prot=%d\n", // icd->name().data(),lt,lt1,lt2,ibcd->prot); - if (visitedClasses->find(icd)==0) + if (visitedClasses->find(icd)==0) { visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance if (lt1!=-1) @@ -4191,7 +4201,7 @@ void ClassDef::getTitleForMemberListType(MemberListType type, if (lde->kind()==LayoutDocEntry::MemberDecl) { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; - if (lmd->type==type) + if (lmd->type==type) { title = lmd->title(lang); subtitle = lmd->subtitle(lang); @@ -4254,8 +4264,8 @@ int ClassDef::countMembersIncludingGrouped(MemberListType lt, { int count=0; MemberList *ml = getMemberList(lt); - if (ml) - { + if (ml) + { count=ml->countInheritableMembers(inheritedFrom); } //printf("%s:countMembersIncludingGrouped: count=%d\n",name().data(),count); @@ -4265,7 +4275,7 @@ int ClassDef::countMembersIncludingGrouped(MemberListType lt, MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - bool hasOwnSection = !mg->allMembersInSameSection() || + bool hasOwnSection = !mg->allMembersInSameSection() || !m_impl->subGrouping; // group is in its own section if ((additional && hasOwnSection) || (!additional && !hasOwnSection)) { @@ -4307,7 +4317,7 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol, lt2=lt3; } //printf("%s:convert %d->(%d,%d) prot=%d\n",icd->name().data(),lt,lt1,lt2,ibcd->prot); - if (visitedClasses->find(icd)==0) + if (visitedClasses->find(icd)==0) { visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance if (lt1!=-1) @@ -4345,17 +4355,17 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC { //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",name().data(),title.data(),ml,ml2); QCString tt = title, st = subTitle; - if (ml) + if (ml) { //printf(" writeDeclaration type=%d count=%d\n",lt,ml->numDecMembers()); - ml->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt); + ml->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt); tt.resize(0); st.resize(0); } if (ml2) { //printf(" writeDeclaration type=%d count=%d\n",lt2,ml2->numDecMembers()); - ml2->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt); + ml2->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt); } static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB"); if (!inlineInheritedMembers) // show inherited members as separate lists @@ -4407,91 +4417,91 @@ void ClassDef::writePlainMemberDeclaration(OutputList &ol, { //printf("%s: ClassDef::writePlainMemberDeclaration()\n",name().data()); MemberList * ml = getMemberList(lt); - if (ml) + if (ml) { ml->setInGroup(inGroup); - ml->writePlainDeclarations(ol,this,0,0,0,definitionType(),inheritedFrom,inheritId); + ml->writePlainDeclarations(ol,this,0,0,0,definitionType(),inheritedFrom,inheritId); } } -bool ClassDef::isLocal() const -{ - return m_impl->isLocal; +bool ClassDef::isLocal() const +{ + return m_impl->isLocal; } -ClassSDict *ClassDef::getClassSDict() -{ - return m_impl->innerClasses; +ClassSDict *ClassDef::getClassSDict() +{ + return m_impl->innerClasses; } -ClassDef::CompoundType ClassDef::compoundType() const -{ - return m_impl->compType; -} +ClassDef::CompoundType ClassDef::compoundType() const +{ + return m_impl->compType; +} BaseClassList *ClassDef::baseClasses() const -{ - return m_impl->inherits; +{ + return m_impl->inherits; } BaseClassList *ClassDef::subClasses() const -{ - return m_impl->inheritedBy; +{ + return m_impl->inheritedBy; } MemberNameInfoSDict *ClassDef::memberNameInfoSDict() const -{ - return m_impl->allMemberNameInfoSDict; +{ + return m_impl->allMemberNameInfoSDict; } -Protection ClassDef::protection() const -{ - return m_impl->prot; +Protection ClassDef::protection() const +{ + return m_impl->prot; } -ArgumentList *ClassDef::templateArguments() const -{ - return m_impl->tempArgs; +ArgumentList *ClassDef::templateArguments() const +{ + return m_impl->tempArgs; } NamespaceDef *ClassDef::getNamespaceDef() const -{ - return m_impl->nspace; +{ + return m_impl->nspace; } -FileDef *ClassDef::getFileDef() const -{ - return m_impl->fileDef; +FileDef *ClassDef::getFileDef() const +{ + return m_impl->fileDef; } -QDict *ClassDef::getTemplateInstances() const -{ - return m_impl->templateInstances; +QDict *ClassDef::getTemplateInstances() const +{ + return m_impl->templateInstances; } -ClassDef *ClassDef::templateMaster() const -{ - return m_impl->templateMaster; -} +ClassDef *ClassDef::templateMaster() const +{ + return m_impl->templateMaster; +} -bool ClassDef::isTemplate() const -{ - return m_impl->tempArgs!=0; +bool ClassDef::isTemplate() const +{ + return m_impl->tempArgs!=0; } -IncludeInfo *ClassDef::includeInfo() const -{ - return m_impl->incInfo; +IncludeInfo *ClassDef::includeInfo() const +{ + return m_impl->incInfo; } -UsesClassDict *ClassDef::usedImplementationClasses() const -{ - return m_impl->usesImplClassDict; +UsesClassDict *ClassDef::usedImplementationClasses() const +{ + return m_impl->usesImplClassDict; } -UsesClassDict *ClassDef::usedByImplementationClasses() const -{ - return m_impl->usedByImplClassDict; +UsesClassDict *ClassDef::usedByImplementationClasses() const +{ + return m_impl->usedByImplClassDict; } UsesClassDict *ClassDef::usedInterfaceClasses() const @@ -4504,9 +4514,9 @@ bool ClassDef::isTemplateArgument() const return m_impl->isTemplArg; } -bool ClassDef::isAbstract() const -{ - return m_impl->isAbstract || (m_impl->spec&Entry::Abstract); +bool ClassDef::isAbstract() const +{ + return m_impl->isAbstract || (m_impl->spec&Entry::Abstract); } bool ClassDef::isFinal() const @@ -4524,69 +4534,69 @@ bool ClassDef::isPublished() const return m_impl->spec&Entry::Published; } -bool ClassDef::isObjectiveC() const -{ - return getLanguage()==SrcLangExt_ObjC; +bool ClassDef::isObjectiveC() const +{ + return getLanguage()==SrcLangExt_ObjC; } -bool ClassDef::isCSharp() const -{ - return getLanguage()==SrcLangExt_CSharp; +bool ClassDef::isCSharp() const +{ + return getLanguage()==SrcLangExt_CSharp; } -ClassDef *ClassDef::categoryOf() const -{ - return m_impl->categoryOf; +ClassDef *ClassDef::categoryOf() const +{ + return m_impl->categoryOf; } -const QList &ClassDef::getMemberLists() const -{ - return m_impl->memberLists; +const QList &ClassDef::getMemberLists() const +{ + return m_impl->memberLists; } -MemberGroupSDict *ClassDef::getMemberGroupSDict() const -{ - return m_impl->memberGroupSDict; +MemberGroupSDict *ClassDef::getMemberGroupSDict() const +{ + return m_impl->memberGroupSDict; } -void ClassDef::setNamespace(NamespaceDef *nd) -{ - m_impl->nspace = nd; +void ClassDef::setNamespace(NamespaceDef *nd) +{ + m_impl->nspace = nd; } -void ClassDef::setFileDef(FileDef *fd) -{ - m_impl->fileDef=fd; +void ClassDef::setFileDef(FileDef *fd) +{ + m_impl->fileDef=fd; } -void ClassDef::setSubGrouping(bool enabled) -{ - m_impl->subGrouping = enabled; +void ClassDef::setSubGrouping(bool enabled) +{ + m_impl->subGrouping = enabled; } -void ClassDef::setProtection(Protection p) -{ - m_impl->prot=p; +void ClassDef::setProtection(Protection p) +{ + m_impl->prot=p; } -void ClassDef::setIsStatic(bool b) -{ - m_impl->isStatic=b; +void ClassDef::setIsStatic(bool b) +{ + m_impl->isStatic=b; } -void ClassDef::setCompoundType(CompoundType t) -{ - m_impl->compType = t; -} +void ClassDef::setCompoundType(CompoundType t) +{ + m_impl->compType = t; +} -void ClassDef::setTemplateMaster(ClassDef *tm) -{ - m_impl->templateMaster=tm; +void ClassDef::setTemplateMaster(ClassDef *tm) +{ + m_impl->templateMaster=tm; } -void ClassDef::makeTemplateArgument(bool b) -{ - m_impl->isTemplArg = b; +void ClassDef::makeTemplateArgument(bool b) +{ + m_impl->isTemplArg = b; } void ClassDef::setCategoryOf(ClassDef *cd) @@ -4644,7 +4654,7 @@ QCString ClassDef::anchor() const else { // normal locally defined class - anc = convertNameToFile(m_impl->fileName); + anc = convertNameToFile(m_impl->fileName); } } return anc; @@ -4657,12 +4667,12 @@ bool ClassDef::isEmbeddedInOuterScope() const Definition *container = getOuterScope(); - bool containerLinkable = - container && + bool containerLinkable = + container && ( (container==Doxygen::globalScope && getFileDef() && getFileDef()->isLinkableInProject()) || // global class in documented file container->isLinkableInProject() // class in documented scope - ); + ); // inline because of INLINE_GROUPED_CLASSES=YES ? bool b1 = (inlineGroupedClasses && partOfGroups()!=0); // a grouped class @@ -4734,7 +4744,7 @@ bool ClassDef::isExtension() const QCString n = name(); int si = n.find('('); int ei = n.find(')'); - bool b = ei>si && n.mid(si+1,ei-si-1).stripWhiteSpace().isEmpty(); + bool b = ei>si && n.mid(si+1,ei-si-1).stripWhiteSpace().isEmpty(); return b; } @@ -4743,3 +4753,8 @@ const ClassSDict *ClassDef::innerClasses() const return m_impl->innerClasses; } +const FileList &ClassDef::usedFiles() const +{ + return m_impl->files; +} + diff --git a/src/classdef.h b/src/classdef.h index 537ff1f..c3ae9f5 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -31,6 +31,7 @@ class ClassList; class ClassSDict; class OutputList; class FileDef; +class FileList; class BaseClassList; class NamespaceDef; class MemberDef; @@ -125,9 +126,6 @@ class ClassDef : public Definition /** returns TRUE if this class has documentation */ bool hasDocumentation() const; - /** returns TRUE if this class has a brief description */ - bool hasBriefDescription() const; - /** returns TRUE if this class has a non-empty detailed description */ bool hasDetailedDescription() const; @@ -310,6 +308,11 @@ class ClassDef : public Definition const ClassSDict *innerClasses() const; QCString title() const; + QCString generatedFromFiles() const; + const FileList &usedFiles() const; + + QCString includeStatement() const; + //----------------------------------------------------------------------------------- // --- setters ---- //----------------------------------------------------------------------------------- @@ -318,7 +321,7 @@ class ClassDef : public Definition void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0); void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); void insertMember(MemberDef *); - void insertUsedFile(const char *); + void insertUsedFile(FileDef *); bool addExample(const char *anchor,const char *name, const char *file); void mergeCategory(ClassDef *category); void setNamespace(NamespaceDef *nd); @@ -375,6 +378,7 @@ class ClassDef : public Definition void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, ClassDef *inheritedFrom,const QCString &inheritId); int countMembersIncludingGrouped(MemberListType lt,ClassDef *inheritedFrom,bool additional); + int countInheritanceNodes(); bool visited; diff --git a/src/classlist.cpp b/src/classlist.cpp index da5bf5a..f19c374 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2013 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -39,8 +39,8 @@ static int compItems(void *item1,void *item2) ClassDef *c2=(ClassDef *)item2; static bool b = Config_getBool("SORT_BY_SCOPE_NAME"); //printf("compItems: %d %s<->%s\n",b,c1->name().data(),c2->name().data()); - if (b) - { + if (b) + { return qstricmp(c1->name(), c2->name()); } @@ -76,13 +76,13 @@ bool ClassSDict::declVisible(const ClassDef::CompoundType *filter) const ClassDef *cd=0; for (sdi.toFirst();(cd=sdi.current());++sdi) { - if (cd->name().find('@')==-1 && + if (cd->name().find('@')==-1 && (filter==0 || *filter==cd->compoundType()) ) { bool isLink = cd->isLinkable(); - if (isLink || - (!hideUndocClasses && + if (isLink || + (!hideUndocClasses && (!cd->isLocal() || extractLocalClasses) ) ) @@ -107,8 +107,8 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f for (sdi.toFirst();(cd=sdi.current());++sdi) { //printf(" ClassSDict::writeDeclaration for %s\n",cd->name().data()); - if (cd->name().find('@')==-1 && - !cd->isExtension() && + if (cd->name().find('@')==-1 && + !cd->isExtension() && (cd->protection()!=Private || extractPrivate) && (filter==0 || *filter==cd->compoundType()) ) @@ -119,7 +119,7 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f if (found) ol.endMemberList(); } } - + void ClassSDict::writeDocumentation(OutputList &ol,Definition * container) { static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); @@ -140,7 +140,7 @@ void ClassSDict::writeDocumentation(OutputList &ol,Definition * container) // cd->name().data(),cd->getOuterScope(),cd->isEmbeddedInOuterScope(), // container); - if (cd->name().find('@')==-1 && + if (cd->name().find('@')==-1 && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && (container==0 || cd->partOfGroups()==0) // if container==0 -> show as part of the group docs, otherwise only show if not part of a group diff --git a/src/context.cpp b/src/context.cpp index c5b6903..a810808 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -17,16 +17,56 @@ #include "docparser.h" #include "htmlgen.h" #include "htmldocvisitor.h" +#include "dot.h" +#include "diagram.h" + +struct ContextGlobals +{ + enum OutputFormat + { + Html, + LateX, + Rtf, + ManPage, + DocBook, + Xml, + TagFile + }; + int dynSectionId; + QCString outputDir; + OutputFormat outputFormat; +} g_globals; + +/** @brief Scoped smart pointer */ +template class ScopedPtr +{ + private: + T *m_ptr; + ScopedPtr(const ScopedPtr &); + ScopedPtr &operator=(const ScopedPtr &); + void operator==(const ScopedPtr &) const; + void operator!=(const ScopedPtr &) const; + + public: + typedef T Type; + explicit ScopedPtr(T *p=0) : m_ptr(p) {} + ~ScopedPtr() { delete m_ptr; }; + T &operator*() const { return *m_ptr; } + T *operator->() const { return m_ptr; } + T *get() const { return m_ptr; } + operator bool() const { return m_ptr!=0; } + void reset(T *p=0) { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } } +}; // iterator support template class GenericConstIterator : public TemplateListIntf::ConstIterator { public: - GenericConstIterator(const QList &list) + GenericConstIterator(const QList &list) : m_it(list) { } virtual ~GenericConstIterator() {} - void toFirst() + void toFirst() { m_it.toFirst(); } @@ -105,11 +145,16 @@ class GenericNodeListContext : public TemplateListIntf //------------------------------------------------------------------------ /** @brief Helper class to map a property name to a handler member function */ -template class PropertyMapper { - public: - struct PropertyFunc + private: + struct PropertyFuncIntf + { + virtual ~PropertyFuncIntf() {} + virtual TemplateVariant operator()() const = 0; + }; + template + struct PropertyFunc : public PropertyFuncIntf { typedef TemplateVariant (T::*Handler)() const; PropertyFunc(const T *o,Handler h) : obj(o), handler(h) {} @@ -120,24 +165,41 @@ class PropertyMapper const T *obj; Handler handler; }; + + public: PropertyMapper() { m_map.setAutoDelete(TRUE); } - TemplateVariant get(const char *n) + + /** Add a property to the map + * @param[in] name The name of the property to add. + * @param[in] obj The object handling access to the property. + * @param[in] handle The method to call when the property is accessed. + */ + template + void addProperty(const char *name,const T* obj, + typename PropertyFunc::Handler handle) + { + m_map.insert(name,new PropertyFunc(obj,handle)); + } + + /** Gets the value of a property. + * @param[in] name The name of the property. + * @returns A variant representing the properties value or an + * invalid variant if it was not found. + */ + TemplateVariant get(const char *name) const { - //printf("PropertyMapper::get(%s)\n",n); + //printf("PropertyMapper::get(%s)\n",name); TemplateVariant result; - PropertyFunc *func = m_map.find(n); + PropertyFuncIntf *func = m_map.find(name); if (func) { result = (*func)(); } return result; } - void insert(const char *name,const PropertyFunc *func) - { - m_map.insert(name,func); - } + private: - QDict m_map; + QDict m_map; }; @@ -213,7 +275,7 @@ TemplateVariant ConfigContext::get(const char *name) const //%% struct Doxygen: global information //%% { -class DoxygenContext::Private : public PropertyMapper +class DoxygenContext::Private : public PropertyMapper { public: TemplateVariant version() const @@ -227,9 +289,9 @@ class DoxygenContext::Private : public PropertyMapper Private() { //%% string version - insert("version",new PropertyFunc(this,&Private::version)); + addProperty("version",this,&Private::version); //makeProperty(this,&Private::version)); //%% string date - insert("date", new PropertyFunc(this,&Private::date)); + addProperty("date", this,&Private::date); } }; //%% } @@ -253,14 +315,31 @@ TemplateVariant DoxygenContext::get(const char *n) const //%% struct Translator: translation methods //%% { -class TranslateContext::Private : public PropertyMapper +class TranslateContext::Private : public PropertyMapper { public: - static QCString generatedAtFunc(const void *obj,const QValueList &args) + + static TemplateVariant generatedAtFunc(const void *obj,const QValueList &args) { return ((TranslateContext::Private*)obj)->generatedAt(args); } - QCString generatedAt(const QValueList &args) const + static TemplateVariant inheritanceDiagramForFunc(const void *obj,const QValueList &args) + { + return ((TranslateContext::Private*)obj)->inheritanceDiagramFor(args); + } + static TemplateVariant inheritsListFunc(const void *obj,const QValueList &args) + { + return ((TranslateContext::Private*)obj)->inheritsList(args); + } + static TemplateVariant inheritedByListFunc(const void *obj,const QValueList &args) + { + return ((TranslateContext::Private*)obj)->inheritedByList(args); + } + static TemplateVariant collaborationDiagramForFunc(const void *obj,const QValueList &args) + { + return ((TranslateContext::Private*)obj)->collaborationDiagramFor(args); + } + TemplateVariant generatedAt(const QValueList &args) const { if (args.count()==2) { @@ -268,11 +347,61 @@ class TranslateContext::Private : public PropertyMapper &args) const + { + if (args.count()==1) + { + return theTranslator->trClassDiagram(args[0].toString()); + } + else + { + err("tr.inheritanceDiagramFor should take one parameter, got %d!\n",args.count()); + } + return TemplateVariant(); + } + TemplateVariant collaborationDiagramFor(const QValueList &args) const + { + if (args.count()==1) + { + return theTranslator->trCollaborationDiagram(args[0].toString()); + } + else + { + err("tr.collaborationDiagramFor should take one parameter, got %d!\n",args.count()); + } + return TemplateVariant(); + } + TemplateVariant inheritsList(const QValueList &args) const + { + if (args.count()==1) + { + return theTranslator->trInheritsList(args[0].toInt()); + } + else + { + err("tr.inheritsList should take one integer parameter, got %d!\n",args.count()); + } + return TemplateVariant(); + } + QCString inheritedByList(const QValueList &args) const + { + if (args.count()==1) + { + return theTranslator->trInheritedByList(args[0].toInt()); + } + else + { + err("tr.inheritedByList should take one integer parameter, got %d!\n",args.count()); } return QCString(); } + + TemplateVariant generatedBy() const { return theTranslator->trGeneratedBy(); @@ -281,6 +410,14 @@ class TranslateContext::Private : public PropertyMappertrSearch(); @@ -366,7 +503,7 @@ class TranslateContext::Private : public PropertyMappertrModulesMembers(); } else - { + { return theTranslator->trNamespaceMembers(); } } @@ -390,54 +527,70 @@ class TranslateContext::Private : public PropertyMappertrDetailedDescription(); } + TemplateVariant inheritsList() const + { + return TemplateVariant(this,&Private::inheritsListFunc); + } + TemplateVariant inheritedByList() const + { + return TemplateVariant(this,&Private::inheritedByListFunc); + } Private() { //%% string generatedBy - insert("generatedby", new PropertyFunc(this,&Private::generatedBy)); + addProperty("generatedby", this,&Private::generatedBy); //%% string generatedAt - insert("generatedAt", new PropertyFunc(this,&Private::generatedAt)); + addProperty("generatedAt", this,&Private::generatedAt); //%% string search - insert("search", new PropertyFunc(this,&Private::search)); + addProperty("search", this,&Private::search); //%% string mainPage - insert("mainPage", new PropertyFunc(this,&Private::mainPage)); + addProperty("mainPage", this,&Private::mainPage); //%% string classes - insert("classes", new PropertyFunc(this,&Private::classes)); + addProperty("classes", this,&Private::classes); //%% string classList - insert("classList", new PropertyFunc(this,&Private::classList)); + addProperty("classList", this,&Private::classList); //%% string classIndex - insert("classIndex", new PropertyFunc(this,&Private::classIndex)); + addProperty("classIndex", this,&Private::classIndex); //%% string classHierarchy - insert("classHierarchy", new PropertyFunc(this,&Private::classHierarchy)); + addProperty("classHierarchy", this,&Private::classHierarchy); //%% string classMembers - insert("classMembers", new PropertyFunc(this,&Private::classMembers)); + addProperty("classMembers", this,&Private::classMembers); //%% string modules - insert("modules", new PropertyFunc(this,&Private::modules)); + addProperty("modules", this,&Private::modules); //%% string namespaces - insert("namespaces", new PropertyFunc(this,&Private::namespaces)); + addProperty("namespaces", this,&Private::namespaces); //%% string files - insert("files", new PropertyFunc(this,&Private::files)); + addProperty("files", this,&Private::files); //%% string pages - insert("pages", new PropertyFunc(this,&Private::pages)); + addProperty("pages", this,&Private::pages); //%% string examples - insert("examples", new PropertyFunc(this,&Private::examples)); + addProperty("examples", this,&Private::examples); //%% string namespaceList - insert("namespaceList", new PropertyFunc(this,&Private::namespaceList)); + addProperty("namespaceList", this,&Private::namespaceList); //%% string namespaceMembers - insert("namespaceMembers",new PropertyFunc(this,&Private::namespaceMembers)); + addProperty("namespaceMembers", this,&Private::namespaceMembers); //%% srting fileList - insert("fileList", new PropertyFunc(this,&Private::fileList)); + addProperty("fileList", this,&Private::fileList); //%% string fileMembers - insert("fileMembers", new PropertyFunc(this,&Private::fileMembers)); + addProperty("fileMembers", this,&Private::fileMembers); //%% string relatedPagesDescripiton - insert("relatedPagesDesc",new PropertyFunc(this,&Private::relatedPagesDesc)); + addProperty("relatedPagesDesc", this,&Private::relatedPagesDesc); //%% string more - insert("more", new PropertyFunc(this,&Private::more)); + addProperty("more", this,&Private::more); //%% string detailedDescription - insert("detailedDesc", new PropertyFunc(this,&Private::detailedDesc)); + addProperty("detailedDesc", this,&Private::detailedDesc); + //%% string inheritanceDiagramFor + addProperty("inheritanceDiagramFor", this,&Private::inheritanceDiagramFor); + //%% string collaborationDiagramFor + addProperty("collaborationDiagramFor", this,&Private::collaborationDiagramFor); + //%% string inheritsList + addProperty("inheritsList", this,&Private::inheritsList); + //%% string inheritedByList + addProperty("inheritedByList", this,&Private::inheritedByList); m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); - m_vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); + m_vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); } private: bool m_javaOpt; @@ -475,11 +628,10 @@ static TemplateVariant parseDoc(Definition *def,const QCString &file,int line, root->accept(&visitor); } bool isEmpty = root->isEmpty(); - if (isEmpty) + if (isEmpty) result = ""; - else - result = TemplateVariant(docs); - result.setRaw(TRUE); + else + result = TemplateVariant(docs,TRUE); delete root; return result; } @@ -488,64 +640,199 @@ static TemplateVariant parseDoc(Definition *def,const QCString &file,int line, //%% struct Symbol: shared info for all symbols //%% { -template -class DefinitionContext : public PropertyMapper +template +class DefinitionContext : public PropertyMapper { public: - DefinitionContext(const T *super,Definition *d) : m_def(d), m_detailsCached(FALSE) + DefinitionContext(Definition *d) : m_def(d) { //%% string name: the name of the symbol - PropertyMapper::insert("name", new typename PropertyMapper::PropertyFunc(super,&DefinitionContext::name)); + addProperty("name",this,&DefinitionContext::name); + //%% string bareName: the bare name of the symbol with scope info + addProperty("bareName",this,&DefinitionContext::bareName); //%% string relPath: the relative path to the root of the output (CREATE_SUBDIRS) - PropertyMapper::insert("relPath", new typename PropertyMapper::PropertyFunc(super,&DefinitionContext::relPath)); + addProperty("relPath",this,&DefinitionContext::relPath); //%% string fileName: the file name of the output file associated with the symbol (without extension) - PropertyMapper::insert("fileName", new typename PropertyMapper::PropertyFunc(super,&DefinitionContext::fileName)); + addProperty("fileName",this,&DefinitionContext::fileName); + //%% string anchor: anchor within the page + addProperty("anchor",this,&DefinitionContext::anchor); //%% string details: the detailed documentation for this symbol - PropertyMapper::insert("details", new typename PropertyMapper::PropertyFunc(super,&DefinitionContext::details)); + addProperty("details",this,&DefinitionContext::details); //%% string brief: the brief description for this symbol - PropertyMapper::insert("brief", new typename PropertyMapper::PropertyFunc(super,&DefinitionContext::brief)); + addProperty("brief",this,&DefinitionContext::brief); + //%% string sourceFileName: the file name of the source file (without extension) + addProperty("sourceFileName",this,&DefinitionContext::sourceFileName); + //%% bool isLinkable: can the symbol be linked to? + addProperty("isLinkable",this,&DefinitionContext::isLinkable); + //%% bool isLinkableInProject: can the symbol be linked within this project? + addProperty("isLinkableInProject",this,&DefinitionContext::isLinkableInProject); + //%% int dynSectionId: identifier that can be used for collapsable sections + addProperty("dynSectionId",this,&DefinitionContext::dynSectionId); + //%% string language: the programming language in which the symbol is written + addProperty("language",this,&DefinitionContext::language); } TemplateVariant fileName() const { - return TemplateVariant(m_def->getOutputFileBase()); + return m_def->getOutputFileBase(); + } + TemplateVariant anchor() const + { + return m_def->anchor(); + } + TemplateVariant sourceFileName() const + { + return m_def->getSourceFileBase(); + } + TemplateVariant isLinkable() const + { + return m_def->isLinkable(); + } + TemplateVariant isLinkableInProject() const + { + return m_def->isLinkableInProject(); } TemplateVariant name() const { - return m_def->displayName(); + return m_def->displayName(TRUE); } - TemplateVariant relPath() const + TemplateVariant bareName() const + { + return m_def->displayName(FALSE); + } + QCString relPathAsString() const { static bool createSubdirs = Config_getBool("CREATE_SUBDIRS"); - return createSubdirs ? TemplateVariant("../../") : TemplateVariant(""); + return createSubdirs ? QCString("../../") : QCString(""); + } + TemplateVariant relPath() const + { + return relPathAsString(); } TemplateVariant details() const { - if (!m_detailsCached) + if (!m_details) { - m_details = parseDoc(m_def,m_def->docFile(),m_def->docLine(), - relPath().toString(),m_def->documentation(),FALSE); - m_detailsCached = TRUE; + m_details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(), + relPathAsString(),m_def->documentation(),FALSE))); } - return m_details; + return *m_details; } TemplateVariant brief() const { - if (!m_briefCached) + if (!m_brief) + { + if (m_def->hasBriefDescription()) + { + m_brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), + relPathAsString(),m_def->briefDescription(),TRUE))); + } + else + { + m_brief.reset(new TemplateVariant("")); + } + } + return *m_brief; + } + TemplateVariant dynSectionId() const + { + return g_globals.dynSectionId; + } + TemplateVariant language() const + { + SrcLangExt lang = m_def->getLanguage(); + QCString result = "unknown"; + switch (lang) { - m_brief = parseDoc(m_def,m_def->briefFile(),m_def->briefLine(), - relPath().toString(),m_def->briefDescription(),TRUE); - m_briefCached = TRUE; + case SrcLangExt_Unknown: break; + case SrcLangExt_IDL: result="idl"; break; + case SrcLangExt_Java: result="java"; break; + case SrcLangExt_CSharp: result="csharp"; break; + case SrcLangExt_D: result="d"; break; + case SrcLangExt_PHP: result="php"; break; + case SrcLangExt_ObjC: result="objc"; break; + case SrcLangExt_Cpp: result="cpp"; break; + case SrcLangExt_JS: result="js"; break; + case SrcLangExt_Python: result="python"; break; + case SrcLangExt_Fortran: result="fortran"; break; + case SrcLangExt_VHDL: result="vhdl"; break; + case SrcLangExt_XML: result="xml"; break; + case SrcLangExt_Tcl: result="tcl"; break; + case SrcLangExt_Markdown: result="markdown"; break; } - return m_brief; + return result; } private: Definition *m_def; - mutable bool m_detailsCached; - mutable TemplateVariant m_details; - mutable bool m_briefCached; - mutable TemplateVariant m_brief; + mutable ScopedPtr m_details; + mutable ScopedPtr m_brief; +}; +//%% } + +//------------------------------------------------------------------------ + +//%% struct IncludeInfo: include file information +//%% { +class IncludeInfoContext::Private : public PropertyMapper +{ + public: + Private(IncludeInfo *info,SrcLangExt lang) : + m_info(info), + m_fileContext(info && info->fileDef ? info->fileDef : 0), + m_lang(lang) + { + if (m_info) + { + addProperty("file",this,&Private::file); + addProperty("name",this,&Private::name); + addProperty("isImport",this,&Private::isImport); + addProperty("isLocal",this,&Private::isLocal); + } + } + TemplateVariant isLocal() const + { + bool isIDLorJava = m_lang==SrcLangExt_IDL || m_lang==SrcLangExt_Java; + return m_info->local || isIDLorJava; + } + TemplateVariant isImport() const + { + return m_info->imported; + } + TemplateVariant file() const + { + if (m_info->fileDef) + { + return &m_fileContext; + } + else + { + return FALSE; + } + } + TemplateVariant name() const + { + return m_info->includeName; + } + private: + IncludeInfo *m_info; + FileContext m_fileContext; + SrcLangExt m_lang; }; + +IncludeInfoContext::IncludeInfoContext(IncludeInfo *info,SrcLangExt lang) +{ + p = new Private(info,lang); +} + +IncludeInfoContext::~IncludeInfoContext() +{ + delete p; +} + +TemplateVariant IncludeInfoContext::get(const char *n) const +{ + return p->get(n); +} //%% } //------------------------------------------------------------------------ @@ -555,13 +842,57 @@ class DefinitionContext : public PropertyMapper class ClassContext::Private : public DefinitionContext { public: - Private(ClassDef *cd) : DefinitionContext(this,cd) , m_classDef(cd) - { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); - insert("hasBrief", new PropertyFunc(this,&Private::hasBrief)); - insert("hasDetails", new PropertyFunc(this,&Private::hasDetails)); + Private(ClassDef *cd) : DefinitionContext(cd) , + m_classDef(cd), m_usedFiles(cd), + m_includeInfo(cd ? cd->includeInfo() : 0, cd ? cd->getLanguage() : SrcLangExt_Unknown) + { + addProperty("title", this,&Private::title); + addProperty("highlight", this,&Private::highlight); + addProperty("subhighlight", this,&Private::subHighlight); + addProperty("hasDetails", this,&Private::hasDetails); + addProperty("generatedFromFiles", this,&Private::generatedFromFiles); + addProperty("usedFiles", this,&Private::usedFiles); + addProperty("hasInheritanceDiagram", this,&Private::hasInheritanceDiagram); + addProperty("inheritanceDiagram", this,&Private::inheritanceDiagram); + addProperty("hasCollaborationDiagram", this,&Private::hasCollaborationDiagram); + addProperty("collaborationDiagram", this,&Private::collaborationDiagram); + addProperty("includeInfo", this,&Private::includeInfo); + addProperty("includeStatement", this,&Private::includeStatement); + addProperty("inherits", this,&Private::inherits); + addProperty("inheritedBy", this,&Private::inheritedBy); + addProperty("unoIDLServices", this,&Private::unoIDLServices); + addProperty("unoIDLInterfaces", this,&Private::unoIDLInterfaces); + addProperty("signals", this,&Private::signals); + addProperty("publicTypes", this,&Private::publicTypes); + addProperty("publicMethods", this,&Private::publicMethods); + addProperty("publicStaticMethods", this,&Private::publicStaticMethods); + addProperty("publicAttributes", this,&Private::publicAttributes); + addProperty("publicStaticAttributes", this,&Private::publicStaticAttributes); + addProperty("publicSlots", this,&Private::publicSlots); + addProperty("protectedTypes", this,&Private::protectedTypes); + addProperty("protectedMethods", this,&Private::protectedMethods); + addProperty("protectedStaticMethods", this,&Private::protectedStaticMethods); + addProperty("protectedAttributes", this,&Private::protectedAttributes); + addProperty("protectedStaticAttributes", this,&Private::protectedStaticAttributes); + addProperty("protectedSlots", this,&Private::protectedSlots); + addProperty("privateTypes", this,&Private::privateTypes); + addProperty("privateMethods", this,&Private::privateMethods); + addProperty("privateStaticMethods", this,&Private::privateStaticMethods); + addProperty("privateAttributes", this,&Private::privateAttributes); + addProperty("privateStaticAttributes", this,&Private::privateStaticAttributes); + addProperty("privateSlots", this,&Private::privateSlots); + addProperty("packageTypes", this,&Private::packageTypes); + addProperty("packageMethods", this,&Private::packageMethods); + addProperty("packageStaticMethods", this,&Private::packageStaticMethods); + addProperty("packageAttributes", this,&Private::packageAttributes); + addProperty("packageStaticAttributes", this,&Private::packageStaticAttributes); + addProperty("properties", this,&Private::properties); + addProperty("events", this,&Private::events); + addProperty("friends", this,&Private::friends); + addProperty("related", this,&Private::related); + addProperty("nestedClasses", this,&Private::nestedClasses); + addProperty("compoundType", this,&Private::compoundType); + addProperty("templateDecls", this,&Private::templateDecls); } TemplateVariant title() const { @@ -575,21 +906,422 @@ class ClassContext::Private : public DefinitionContext { return TemplateVariant(""); } - TemplateVariant hasBrief() const - { - return m_classDef->hasBriefDescription(); - } TemplateVariant hasDetails() const { return m_classDef->hasDetailedDescription(); } + TemplateVariant generatedFromFiles() const + { + return m_classDef->generatedFromFiles(); + } + TemplateVariant usedFiles() const + { + return TemplateVariant(&m_usedFiles); + } + DotClassGraph *getClassGraph() const + { + if (!m_cache.classGraph) + { + m_cache.classGraph.reset(new DotClassGraph(m_classDef,DotNode::Inheritance)); + } + return m_cache.classGraph.get(); + } + int numInheritanceNodes() const + { + if (m_cache.inheritanceNodes==-1) + { + m_cache.inheritanceNodes=m_classDef->countInheritanceNodes(); + } + return m_cache.inheritanceNodes>0; + } + TemplateVariant hasInheritanceDiagram() const + { + bool result=FALSE; + static bool haveDot = Config_getBool("HAVE_DOT"); + static bool classDiagrams = Config_getBool("CLASS_DIAGRAMS"); + static bool classGraph = Config_getBool("CLASS_GRAPH"); + if (haveDot && (classDiagrams || classGraph)) + { + DotClassGraph *cg = getClassGraph(); + result = !cg->isTrivial() && !cg->isTooBig(); + } + else if (classDiagrams) + { + result = numInheritanceNodes()>0; + } + return result; + } + TemplateVariant inheritanceDiagram() const + { + QGString result; + static bool haveDot = Config_getBool("HAVE_DOT"); + static bool classDiagrams = Config_getBool("CLASS_DIAGRAMS"); + static bool classGraph = Config_getBool("CLASS_GRAPH"); + if (haveDot && (classDiagrams || classGraph)) + { + DotClassGraph *cg = getClassGraph(); + FTextStream t(&result); + cg->writeGraph(t,BITMAP, + g_globals.outputDir, + m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + else if (classDiagrams) + { + ClassDiagram d(m_classDef); + FTextStream t(&result); + QCString name = convertToHtml(m_classDef->displayName()); + t << "
" << endl; + t << "getOutputFileBase(); + t << ".png\" usemap=\"#" << name << "_map\" alt=\"\"/>" << endl; + t << "" << endl; + d.writeImage(t,g_globals.outputDir, + relPathAsString(), + m_classDef->getOutputFileBase()); + t << "
"; + } + g_globals.dynSectionId++; + return TemplateVariant(result.data(),TRUE); + } + DotClassGraph *getCollaborationGraph() const + { + if (!m_cache.collaborationGraph) + { + m_cache.collaborationGraph.reset(new DotClassGraph(m_classDef,DotNode::Collaboration)); + } + return m_cache.collaborationGraph.get(); + } + TemplateVariant hasCollaborationDiagram() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + return haveDot && !getCollaborationGraph()->isTrivial(); + } + TemplateVariant collaborationDiagram() const + { + static bool haveDot = Config_getBool("HAVE_DOT"); + QGString result; + if (haveDot) + { + DotClassGraph *cg = getCollaborationGraph(); + FTextStream t(&result); + cg->writeGraph(t,BITMAP, + g_globals.outputDir, + m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, + relPathAsString(),TRUE,TRUE,g_globals.dynSectionId + ); + } + g_globals.dynSectionId++; + return TemplateVariant(result.data(),TRUE); + } + + TemplateVariant includeInfo() const + { + if (m_classDef->includeInfo()) + { + return TemplateVariant(&m_includeInfo); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant includeStatement() const + { + return m_classDef->includeStatement(); + } + TemplateVariant inherits() const + { + if (!m_cache.inheritsList) + { + m_cache.inheritsList.reset(new InheritanceListContext(m_classDef->baseClasses(),TRUE)); + } + return m_cache.inheritsList.get(); + } + TemplateVariant inheritedBy() const + { + if (!m_cache.inheritedByList) + { + m_cache.inheritedByList.reset(new InheritanceListContext(m_classDef->subClasses(),FALSE)); + } + return m_cache.inheritedByList.get(); + } + TemplateVariant getMemberList(ScopedPtr &list, + MemberListType type,const char *title) const + { + if (!list) + { + MemberList *ml = m_classDef->getMemberList(type); + if (ml) + { + list.reset(new MemberListInfoContext(ml,title)); + } + } + if (list) + { + return list.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant unoIDLServices() const + { + return getMemberList(m_cache.unoIDLServices,MemberListType_services,theTranslator->trServices()); + } + TemplateVariant unoIDLInterfaces() const + { + return getMemberList(m_cache.unoIDLInterfaces,MemberListType_interfaces,theTranslator->trInterfaces()); + } + TemplateVariant signals() const + { + return getMemberList(m_cache.signals,MemberListType_signals,theTranslator->trSignals()); + } + TemplateVariant publicTypes() const + { + return getMemberList(m_cache.publicTypes,MemberListType_pubTypes,theTranslator->trPublicTypes()); + } + TemplateVariant publicMethods() const + { + return getMemberList(m_cache.publicMethods,MemberListType_pubMethods, + m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trInstanceMethods() + : theTranslator->trPublicMembers()); + } + TemplateVariant publicStaticMethods() const + { + return getMemberList(m_cache.publicStaticMethods,MemberListType_pubStaticMethods, + m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trClassMethods() + : theTranslator->trStaticPublicMembers()); + } + TemplateVariant publicAttributes() const + { + return getMemberList(m_cache.publicAttributes,MemberListType_pubAttribs,theTranslator->trPublicAttribs()); + } + TemplateVariant publicStaticAttributes() const + { + return getMemberList(m_cache.publicStaticAttributes,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs()); + } + TemplateVariant publicSlots() const + { + return getMemberList(m_cache.publicSlots,MemberListType_pubSlots,theTranslator->trPublicSlots()); + } + TemplateVariant protectedTypes() const + { + return getMemberList(m_cache.protectedTypes,MemberListType_proTypes,theTranslator->trProtectedTypes()); + } + TemplateVariant protectedMethods() const + { + return getMemberList(m_cache.protectedMethods,MemberListType_proMethods,theTranslator->trProtectedMembers()); + } + TemplateVariant protectedStaticMethods() const + { + return getMemberList(m_cache.protectedStaticMethods,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers()); + } + TemplateVariant protectedAttributes() const + { + return getMemberList(m_cache.protectedAttributes,MemberListType_proAttribs,theTranslator->trProtectedAttribs()); + } + TemplateVariant protectedStaticAttributes() const + { + return getMemberList(m_cache.protectedStaticAttributes,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs()); + } + TemplateVariant protectedSlots() const + { + return getMemberList(m_cache.protectedSlots,MemberListType_proSlots,theTranslator->trProtectedSlots()); + } + TemplateVariant privateTypes() const + { + return getMemberList(m_cache.privateTypes,MemberListType_priTypes,theTranslator->trPrivateTypes()); + } + TemplateVariant privateSlots() const + { + return getMemberList(m_cache.privateSlots,MemberListType_priSlots,theTranslator->trPrivateSlots()); + } + TemplateVariant privateMethods() const + { + return getMemberList(m_cache.privateMethods,MemberListType_priMethods,theTranslator->trPrivateMembers()); + } + TemplateVariant privateStaticMethods() const + { + return getMemberList(m_cache.privateStaticMethods,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers()); + } + TemplateVariant privateAttributes() const + { + return getMemberList(m_cache.privateAttributes,MemberListType_priAttribs,theTranslator->trPrivateAttribs()); + } + TemplateVariant privateStaticAttributes() const + { + return getMemberList(m_cache.privateStaticAttributes,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs()); + } + TemplateVariant packageTypes() const + { + return getMemberList(m_cache.packageTypes,MemberListType_pacTypes,theTranslator->trPackageTypes()); + } + TemplateVariant packageMethods() const + { + return getMemberList(m_cache.packageMethods,MemberListType_pacMethods,theTranslator->trPackageMembers()); + } + TemplateVariant packageStaticMethods() const + { + return getMemberList(m_cache.packageStaticMethods,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers()); + } + TemplateVariant packageAttributes() const + { + return getMemberList(m_cache.packageAttributes,MemberListType_pacAttribs,theTranslator->trPackageAttribs()); + } + TemplateVariant packageStaticAttributes() const + { + return getMemberList(m_cache.packageStaticAttributes,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs()); + } + TemplateVariant properties() const + { + return getMemberList(m_cache.properties,MemberListType_properties,theTranslator->trProperties()); + } + TemplateVariant events() const + { + return getMemberList(m_cache.events,MemberListType_events,theTranslator->trEvents()); + } + TemplateVariant friends() const + { + return getMemberList(m_cache.events,MemberListType_friends,theTranslator->trFriends()); + } + TemplateVariant related() const + { + return getMemberList(m_cache.events,MemberListType_related,theTranslator->trRelatedFunctions()); + } + TemplateVariant nestedClasses() const + { + static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); + static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES"); + static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES"); + if (!m_cache.nestedClasses) + { + if (m_classDef->getClassSDict()) + { + NestedClassListContext *classList = new NestedClassListContext; + ClassSDict::Iterator sdi(*m_classDef->getClassSDict()); + ClassDef *cd; + for (sdi.toFirst();(cd=sdi.current());++sdi) + { + bool linkable = cd->isLinkable(); + if (cd->name().find('@')==-1 && !cd->isExtension() && + (cd->protection()!=::Private || extractPrivate) && + (linkable || + (!hideUndocClasses && (!cd->isLocal() || extractLocalClasses))) + ) + { + classList->append(cd); + } + } + m_cache.nestedClasses.reset(classList); + } + } + if (m_cache.nestedClasses) + { + return m_cache.nestedClasses.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + TemplateVariant compoundType() const + { + return m_classDef->compoundTypeString(); + } + void addTemplateDecls(Definition *d,TemplateList *tl) const + { + if (d->definitionType()==Definition::TypeClass) + { + Definition *parent = d->getOuterScope(); + if (parent) + { + addTemplateDecls(parent,tl); + } + ClassDef *cd=(ClassDef *)d; + if (cd->templateArguments()) + { + ArgumentListContext *al = new ArgumentListContext(cd->templateArguments()); + // since a TemplateVariant does take ownership of the object, we add it + // a separate list just to be able to delete it and avoid a memory leak + m_cache.templateArgList.append(al); + tl->append(al); + } + } + } + TemplateVariant templateDecls() const + { + if (!m_cache.templateDecls) + { + TemplateList *tl = new TemplateList; + addTemplateDecls(m_classDef,tl); + m_cache.templateDecls.reset(tl); + } + if (m_cache.templateDecls) + { + return m_cache.templateDecls.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + private: ClassDef *m_classDef; + UsedFilesContext m_usedFiles; + IncludeInfoContext m_includeInfo; + struct Cachable + { + Cachable() : inheritanceNodes(-1) { templateArgList.setAutoDelete(TRUE); } + ScopedPtr inheritsList; + ScopedPtr inheritedByList; + ScopedPtr classGraph; + ScopedPtr collaborationGraph; + ScopedPtr nestedClasses; + ScopedPtr publicTypes; + ScopedPtr publicMethods; + ScopedPtr publicStaticMethods; + ScopedPtr publicAttributes; + ScopedPtr publicStaticAttributes; + ScopedPtr publicSlots; + ScopedPtr protectedTypes; + ScopedPtr protectedMethods; + ScopedPtr protectedStaticMethods; + ScopedPtr protectedAttributes; + ScopedPtr protectedStaticAttributes; + ScopedPtr protectedSlots; + ScopedPtr privateTypes; + ScopedPtr privateMethods; + ScopedPtr privateStaticMethods; + ScopedPtr privateAttributes; + ScopedPtr privateStaticAttributes; + ScopedPtr privateSlots; + ScopedPtr packageTypes; + ScopedPtr packageMethods; + ScopedPtr packageStaticMethods; + ScopedPtr packageAttributes; + ScopedPtr packageStaticAttributes; + ScopedPtr unoIDLServices; + ScopedPtr unoIDLInterfaces; + ScopedPtr signals; + ScopedPtr properties; + ScopedPtr events; + ScopedPtr friends; + ScopedPtr related; + ScopedPtr templateDecls; + int inheritanceNodes; + QList templateArgList; + }; + mutable Cachable m_cache; }; //%% } ClassContext::ClassContext(ClassDef *cd) { + //printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():""); p = new Private(cd); } @@ -610,11 +1342,11 @@ TemplateVariant ClassContext::get(const char *n) const class NamespaceContext::Private : public DefinitionContext { public: - Private(NamespaceDef *nd) : DefinitionContext(this,nd) , m_namespaceDef(nd) + Private(NamespaceDef *nd) : DefinitionContext(nd) , m_namespaceDef(nd) { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); + addProperty("title",this,&Private::title); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subHighlight); } TemplateVariant title() const { @@ -655,15 +1387,16 @@ TemplateVariant NamespaceContext::get(const char *n) const class FileContext::Private : public DefinitionContext { public: - Private(FileDef *fd) : DefinitionContext(this,fd) , m_fileDef(fd) + Private(FileDef *fd) : DefinitionContext(fd) , m_fileDef(fd) { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); + addProperty("title",this,&Private::title); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subHighlight); + addProperty("versionInfo",this,&Private::versionInfo); } TemplateVariant title() const { - return TemplateVariant(m_fileDef->title()); + return m_fileDef->title(); } TemplateVariant highlight() const { @@ -673,6 +1406,10 @@ class FileContext::Private : public DefinitionContext { return TemplateVariant(""); } + TemplateVariant versionInfo() const + { + return m_fileDef->getVersion(); + } private: FileDef *m_fileDef; }; @@ -700,12 +1437,12 @@ TemplateVariant FileContext::get(const char *n) const class DirContext::Private : public DefinitionContext { public: - Private(DirDef *dd) : DefinitionContext(this,dd) , m_dirDef(dd) + Private(DirDef *dd) : DefinitionContext(dd) , m_dirDef(dd) { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); - insert("dirName", new PropertyFunc(this,&Private::dirName)); + addProperty("title",this,&Private::title); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subHighlight); + addProperty("dirName",this,&Private::dirName); } TemplateVariant title() const { @@ -751,11 +1488,11 @@ TemplateVariant DirContext::get(const char *n) const class PageContext::Private : public DefinitionContext { public: - Private(PageDef *pd) : DefinitionContext(this,pd) , m_pageDef(pd) + Private(PageDef *pd) : DefinitionContext(pd) , m_pageDef(pd) { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); + addProperty("title",this,&Private::title); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subHighlight); } TemplateVariant title() const { @@ -791,16 +1528,266 @@ TemplateVariant PageContext::get(const char *n) const //------------------------------------------------------------------------ +class TextGeneratorHtml : public TextGeneratorIntf +{ + public: + TextGeneratorHtml(FTextStream &ts,const QCString &relPath) + : m_ts(ts), m_relPath(relPath) {} + void writeString(const char *s,bool keepSpaces) const + { + if (s==0) return; + //printf("TextGeneratorOlImpl::writeString('%s',%d)\n",s,keepSpaces); + if (keepSpaces) + { + const char *p=s; + char c; + while ((c=*p++)) + { + switch(c) + { + case '<': m_ts << "<"; break; + case '>': m_ts << ">"; break; + case '\'': m_ts << "'"; break; + case '"': m_ts << """; break; + case '&': m_ts << "&"; break; + case ' ': m_ts << " "; break; + } + } + } + else + { + m_ts << convertToHtml(s); + } + } + + void writeBreak(int indent) const + { + m_ts << "
"; + for (int i=0;i"; + m_ts << convertToHtml(name); + m_ts << ""; + } + + private: + FTextStream &m_ts; + QCString m_relPath; +}; + +class TextGeneratorFactory +{ + public: + static TextGeneratorFactory *instance() + { + static TextGeneratorFactory *instance = 0; + if (instance==0) instance = new TextGeneratorFactory; + return instance; + } + TextGeneratorIntf *create(FTextStream &ts,const QCString &relPath) + { + switch (g_globals.outputFormat) + { + case ContextGlobals::Html: + return new TextGeneratorHtml(ts,relPath); + break; + default: + break; + } + return 0; + } + private: + TextGeneratorFactory() {} + virtual ~TextGeneratorFactory() {} +}; + +TemplateVariant createLinkedText(Definition *def,const QCString &relPath,const QCString &text) +{ + QGString s; + FTextStream ts(&s); + TextGeneratorIntf *tg = TextGeneratorFactory::instance()->create(ts,relPath); + if (tg) + { + linkifyText(*tg,def->getOuterScope(),def->getBodyDef(),def,text); + return TemplateVariant(s.data(),TRUE); + } + else + { + return text; + } +} + +//%% struct Member(Symbol): member information +//%% { +class MemberContext::Private : public DefinitionContext +{ + public: + Private(MemberDef *md) : DefinitionContext(md) , m_memberDef(md) + { + addProperty("declType", this,&Private::declType); + addProperty("declArgs", this,&Private::declArgs); + addProperty("isStatic", this,&Private::isStatic); + addProperty("isObjCMethod", this,&Private::isObjCMethod); + addProperty("isObjCProperty", this,&Private::isObjCProperty); + addProperty("isImplementation", this,&Private::isImplementation); + addProperty("isEvent", this,&Private::isEvent); + addProperty("isProperty", this,&Private::isProperty); + addProperty("hasDetails", this,&Private::hasDetails); + addProperty("exception", this,&Private::exception); + addProperty("bitfields", this,&Private::bitfields); + addProperty("initializer", this,&Private::initializer); + addProperty("oneLineInitializer",this,&Private::oneLineInitializer); + addProperty("templateArgs", this,&Private::templateArgs); + addProperty("templateAlias", this,&Private::templateAlias); + addProperty("propertyAttrs", this,&Private::propertyAttrs); + addProperty("eventAttrs", this,&Private::eventAttrs); + + if (md && md->isProperty()) + { + if (md->isGettable()) m_propertyAttrs.append("get"); + if (md->isSettable()) m_propertyAttrs.append("set"); + } + if (md && md->isEvent()) + { + if (md->isAddable()) m_eventAttrs.append("add"); + if (md->isRemovable()) m_eventAttrs.append("remove"); + if (md->isRaisable()) m_eventAttrs.append("raise"); + } + } + TemplateVariant declType() const + { + return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->getDeclType()); + } + TemplateVariant declArgs() const + { + return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->argsString()); + } + TemplateVariant exception() const + { + return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->excpString()); + } + TemplateVariant bitfields() const + { + return createLinkedText(m_memberDef,relPathAsString(),m_memberDef->bitfieldString()); + } + TemplateVariant isStatic() const + { + return m_memberDef->isStatic(); + } + TemplateVariant isObjCMethod() const + { + return m_memberDef->isObjCMethod(); + } + TemplateVariant isObjCProperty() const + { + return m_memberDef->isObjCProperty(); + } + TemplateVariant isImplementation() const + { + return m_memberDef->isImplementation(); + } + TemplateVariant isEvent() const + { + return m_memberDef->isEvent(); + } + TemplateVariant isProperty() const + { + return m_memberDef->isProperty(); + } + TemplateVariant hasDetails() const + { + return m_memberDef->isDetailedSectionLinkable(); + } + TemplateVariant initializer() const + { + return m_memberDef->initializer(); + } + TemplateVariant oneLineInitializer() const + { + return m_memberDef->hasOneLineInitializer(); + } + TemplateVariant templateArgs() const + { + if (!m_templateArgs) + { + m_templateArgs.reset(new ArgumentListContext(m_memberDef->templateArguments())); + } + return m_templateArgs.get(); + } + TemplateVariant templateAlias() const + { + if (m_memberDef->isAlias()) + { + return createLinkedText(m_memberDef,relPathAsString(), + QCString(" = ")+m_memberDef->typeString()); + } + return ""; + } + TemplateVariant propertyAttrs() const + { + return &m_propertyAttrs; + } + TemplateVariant eventAttrs() const + { + return &m_eventAttrs; + } + private: + MemberDef *m_memberDef; + mutable ScopedPtr m_templateArgs; + TemplateList m_propertyAttrs; + TemplateList m_eventAttrs; +}; +//%% } + +MemberContext::MemberContext(MemberDef *md) +{ + p = new Private(md); +} + +MemberContext::~MemberContext() +{ + delete p; +} + +TemplateVariant MemberContext::get(const char *n) const +{ + return p->get(n); +} + + +//------------------------------------------------------------------------ + //%% struct Module(Symbol): group information //%% { class ModuleContext::Private : public DefinitionContext { public: - Private(GroupDef *gd) : DefinitionContext(this,gd) , m_groupDef(gd) + Private(GroupDef *gd) : DefinitionContext(gd) , m_groupDef(gd) { - insert("title", new PropertyFunc(this,&Private::title)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight", new PropertyFunc(this,&Private::subHighlight)); + addProperty("title",this,&Private::title); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subHighlight); } TemplateVariant title() const { @@ -836,6 +1823,47 @@ TemplateVariant ModuleContext::get(const char *n) const //------------------------------------------------------------------------ +//%% list NestedClassList[Class] : list of nested classes +class NestedClassListContext::Private : public GenericNodeListContext +{ +}; + +NestedClassListContext::NestedClassListContext() +{ + p = new Private; +} + +NestedClassListContext::~NestedClassListContext() +{ + delete p; +} + +// TemplateListIntf +int NestedClassListContext::count() const +{ + return p->count(); +} + +TemplateVariant NestedClassListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *NestedClassListContext::createIterator() const +{ + return p->createIterator(); +} + +void NestedClassListContext::append(ClassDef *cd) +{ + if (cd) + { + p->append(new ClassContext(cd)); + } +} + +//------------------------------------------------------------------------ + //%% list ClassList[Class] : list of classes class ClassListContext::Private : public GenericNodeListContext { @@ -846,8 +1874,8 @@ class ClassListContext::Private : public GenericNodeListContext ClassDef *cd; for (cli.toFirst() ; (cd=cli.current()) ; ++cli ) { - if (cd->getLanguage()==SrcLangExt_VHDL && - ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || + if (cd->getLanguage()==SrcLangExt_VHDL && + ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) ) // no architecture { @@ -891,19 +1919,19 @@ TemplateListIntf::ConstIterator *ClassListContext::createIterator() const //------------------------------------------------------------------------ -//%% struct ClassInheritanceNode: node in inheritance tree +//%% struct ClassInheritanceNode: node in inheritance tree //%% { -class ClassInheritanceNodeContext::Private : public PropertyMapper +class ClassInheritanceNodeContext::Private : public PropertyMapper { public: - Private(ClassDef *cd) : m_classContext(cd) + Private(ClassDef *cd) : m_classContext(cd) { //%% bool is_leaf_node: true if this node does not have any children - insert("is_leaf_node", new PropertyFunc(this,&Private::isLeafNode)); + addProperty("is_leaf_node",this,&Private::isLeafNode); //%% ClassInheritance children: list of nested classes/namespaces - insert("children", new PropertyFunc(this,&Private::children)); + addProperty("children",this,&Private::children); //%% Class class: class info - insert("class", new PropertyFunc(this,&Private::getClass)); + addProperty("class",this,&Private::getClass); } void addChildren(const BaseClassList *bcl,bool hideSuper) { @@ -911,7 +1939,7 @@ class ClassInheritanceNodeContext::Private : public PropertyMapperclassDef; if (cd->getLanguage()==SrcLangExt_VHDL && (VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { @@ -938,11 +1966,11 @@ class ClassInheritanceNodeContext::Private : public PropertyMappername().data(),cd,cd->visited); bool wasVisited=cd->visited; cd->visited=TRUE; - if (cd->getLanguage()==SrcLangExt_VHDL) + if (cd->getLanguage()==SrcLangExt_VHDL) { tnc->addChildren(cd->baseClasses(),wasVisited); } - else + else { tnc->addChildren(cd->subClasses(),wasVisited); } @@ -968,7 +1996,7 @@ class ClassInheritanceNodeContext::Private : public PropertyMappergetLanguage()==SrcLangExt_VHDL) { - if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) + if (!(VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ENTITYCLASS) { continue; } @@ -1021,8 +2049,8 @@ class ClassInheritanceContext::Private : public // new root level class ClassInheritanceNodeContext *tnc = new ClassInheritanceNodeContext(cd); append(tnc); - bool hasChildren = !cd->visited && classHasVisibleChildren(cd); - if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren) + bool hasChildren = !cd->visited && classHasVisibleChildren(cd); + if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren) { tnc->addChildren(cd->baseClasses(),cd->visited); cd->visited=TRUE; @@ -1075,9 +2103,9 @@ TemplateListIntf::ConstIterator *ClassInheritanceContext::createIterator() const //------------------------------------------------------------------------ -//%% struct ClassHierarchy: inheritance tree +//%% struct ClassHierarchy: inheritance tree //%% { -class ClassHierarchyContext::Private : public PropertyMapper +class ClassHierarchyContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -1102,7 +2130,7 @@ class ClassHierarchyContext::Private : public PropertyMapper +class NestingNodeContext::Private : public PropertyMapper { public: - Private(Definition *d,bool addCls) : m_def(d), + Private(Definition *d,bool addCls) : m_def(d), m_classContext(m_def->definitionType()==Definition::TypeClass?(ClassDef*)d:0), m_namespaceContext(m_def->definitionType()==Definition::TypeNamespace?(NamespaceDef*)d:0) { //%% bool is_leaf_node: true if this node does not have any children - insert("is_leaf_node", new PropertyFunc(this,&Private::isLeafNode)); + addProperty("is_leaf_node",this,&Private::isLeafNode); //%% Nesting children: list of nested classes/namespaces - insert("children", new PropertyFunc(this,&Private::children)); + addProperty("children",this,&Private::children); //%% [optional] Class class: class info (if this node represents a class) - insert("class", new PropertyFunc(this,&Private::getClass)); + addProperty("class",this,&Private::getClass); //%% [optional] Namespace namespace: namespace info (if this node represents a namespace) - insert("namespace", new PropertyFunc(this,&Private::getNamespace)); + addProperty("namespace",this,&Private::getNamespace); addNamespaces(addCls); addClasses(); } @@ -1222,7 +2250,7 @@ class NestingNodeContext::Private : public PropertyMappergetLanguage()==SrcLangExt_VHDL) + if (cd->getLanguage()==SrcLangExt_VHDL) { - if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || + if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS )// no architecture { continue; } } - if (!rootOnly || - cd->getOuterScope()==0 || - cd->getOuterScope()==Doxygen::globalScope - ) + if (!rootOnly || + cd->getOuterScope()==0 || + cd->getOuterScope()==Doxygen::globalScope + ) { - if (classVisibleInIndex(cd) && cd->templateMaster()==0) + if (classVisibleInIndex(cd) && cd->templateMaster()==0) { NestingNodeContext *nnc = new NestingNodeContext(cd,TRUE); append(nnc); @@ -1332,7 +2360,7 @@ void NestingContext::addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bo //%% struct ClassTree: Class nesting relations //%% { -class ClassTreeContext::Private : public PropertyMapper +class ClassTreeContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -1358,8 +2386,8 @@ class ClassTreeContext::Private : public PropertyMappertrCompoundListFortran(); } @@ -1383,12 +2411,12 @@ class ClassTreeContext::Private : public PropertyMapper +class NamespaceTreeContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -1488,8 +2516,8 @@ class NamespaceTreeContext::Private : public PropertyMappertrPackages(); } @@ -1509,12 +2537,12 @@ class NamespaceTreeContext::Private : public PropertyMapper +{ + public: + void addFile(FileDef *fd) + { + append(new FileContext(fd)); + } +}; + +UsedFilesContext::UsedFilesContext(ClassDef *cd) +{ + p = new Private; + if (cd) + { + QListIterator li(cd->usedFiles()); + FileDef *fd; + for (li.toFirst();(fd=li.current());++li) + { + p->addFile(fd); + } + } +} + +UsedFilesContext::~UsedFilesContext() +{ + delete p; +} + +// TemplateListIntf +int UsedFilesContext::count() const +{ + return p->count(); +} + +TemplateVariant UsedFilesContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *UsedFilesContext::createIterator() const +{ + return p->createIterator(); +} + +void UsedFilesContext::addFile(FileDef *fd) +{ + p->addFile(fd); +} + +//------------------------------------------------------------------------ + + //%% struct DirFileNode: node is a directory hierarchy //%% { -class DirFileNodeContext::Private : public PropertyMapper +class DirFileNodeContext::Private : public PropertyMapper { public: - Private(Definition *d) : m_def(d), + Private(Definition *d) : m_def(d), m_dirContext (m_def->definitionType()==Definition::TypeDir ? (DirDef*)d : 0), m_fileContext(m_def->definitionType()==Definition::TypeFile ? (FileDef*)d : 0) { //%% bool is_leaf_node: true if this node does not have any children - insert("is_leaf_node", new PropertyFunc(this,&Private::isLeafNode)); + addProperty("is_leaf_node",this,&Private::isLeafNode); //%% DirFile children: list of nested classes/namespaces - insert("children", new PropertyFunc(this,&Private::children)); + addProperty("children",this,&Private::children); //%% [optional] Dir dir: directory info (if this node represents a directory) - insert("dir", new PropertyFunc(this,&Private::getDir)); + addProperty("dir",this,&Private::getDir); //%% [optional] File file: file info (if this node represents a file) - insert("file", new PropertyFunc(this,&Private::getFile)); + addProperty("file",this,&Private::getFile); addDirFiles(); } TemplateVariant isLeafNode() const @@ -1663,7 +2744,7 @@ class DirFileNodeContext::Private : public PropertyMappergetOuterScope()==Doxygen::globalScope) + if (dd->getOuterScope()==Doxygen::globalScope) { append(new DirFileNodeContext(dd)); } @@ -1708,7 +2789,7 @@ class DirFileContext::Private : public GenericNodeListContext +class FileTreeContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -1824,12 +2905,12 @@ class FileTreeContext::Private : public PropertyMapper m_dirFileTree.addFiles(*Doxygen::inputNameList); } //%% DirFile tree: - insert("tree", new PropertyFunc(this,&Private::tree)); - insert("fileName", new PropertyFunc(this,&Private::fileName)); - insert("relPath", new PropertyFunc(this,&Private::relPath)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight",new PropertyFunc(this,&Private::subhighlight)); - insert("title", new PropertyFunc(this,&Private::title)); + addProperty("tree",this,&Private::tree); + addProperty("fileName",this,&Private::fileName); + addProperty("relPath",this,&Private::relPath); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subhighlight); + addProperty("title",this,&Private::title); } private: DirFileContext m_dirFileTree; @@ -1855,17 +2936,17 @@ TemplateVariant FileTreeContext::get(const char *name) const //%% struct PageNode: node is a directory hierarchy //%% { -class PageNodeContext::Private : public PropertyMapper +class PageNodeContext::Private : public PropertyMapper { public: Private(PageDef *pd) : m_pageDef(pd), m_pageContext(pd) { //%% bool is_leaf_node: true if this node does not have any children - insert("is_leaf_node", new PropertyFunc(this,&Private::isLeafNode)); + addProperty("is_leaf_node",this,&Private::isLeafNode); //%% PageList children: list of nested classes/namespaces - insert("children", new PropertyFunc(this,&Private::children)); + addProperty("children",this,&Private::children); //%% Page page: page info - insert("page", new PropertyFunc(this,&Private::getPage)); + addProperty("page",this,&Private::getPage); addPages(); } TemplateVariant isLeafNode() const @@ -1894,7 +2975,7 @@ class PageNodeContext::Private : public PropertyMapper }; //%% } -PageNodeContext::PageNodeContext(PageDef *pd) +PageNodeContext::PageNodeContext(PageDef *pd) { p = new Private(pd); } @@ -1922,7 +3003,7 @@ class PageNodeListContext::Private : public GenericNodeListContextgetOuterScope()==0 || + pd->getOuterScope()==0 || pd->getOuterScope()->definitionType()!=Definition::TypePage) { append(new PageNodeContext(pd)); @@ -1966,7 +3047,7 @@ void PageNodeListContext::addPages(const PageSDict &pages,bool rootOnly) //%% struct PageTree: tree of related pages //%% { -class PageTreeContext::Private : public PropertyMapper +class PageTreeContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -1995,19 +3076,19 @@ class PageTreeContext::Private : public PropertyMapper } Private() { - // Add pages + // Add pages if (Doxygen::pageSDict) { m_pageList.addPages(*Doxygen::pageSDict,TRUE); } //%% PageNodeList tree: - insert("tree", new PropertyFunc(this,&Private::tree)); - insert("fileName", new PropertyFunc(this,&Private::fileName)); - insert("relPath", new PropertyFunc(this,&Private::relPath)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight",new PropertyFunc(this,&Private::subhighlight)); - insert("title", new PropertyFunc(this,&Private::title)); + addProperty("tree",this,&Private::tree); + addProperty("fileName",this,&Private::fileName); + addProperty("relPath",this,&Private::relPath); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subhighlight); + addProperty("title",this,&Private::title); } private: PageNodeListContext m_pageList; @@ -2033,7 +3114,7 @@ TemplateVariant PageTreeContext::get(const char *name) const //%% struct PageList: list of related pages //%% { -class PageListContext::Private : public PropertyMapper +class PageListContext::Private : public PropertyMapper { public: TemplateVariant items() const @@ -2062,7 +3143,7 @@ class PageListContext::Private : public PropertyMapper } Private() { - // Add pages + // Add pages PageSDict::Iterator pdi(*Doxygen::pageSDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) @@ -2074,12 +3155,12 @@ class PageListContext::Private : public PropertyMapper } //%% list[Page] items: - insert("items", new PropertyFunc(this,&Private::items)); - insert("fileName", new PropertyFunc(this,&Private::fileName)); - insert("relPath", new PropertyFunc(this,&Private::relPath)); - insert("highlight", new PropertyFunc(this,&Private::highlight)); - insert("subhighlight",new PropertyFunc(this,&Private::subhighlight)); - insert("title", new PropertyFunc(this,&Private::title)); + addProperty("items",this,&Private::items); + addProperty("fileName",this,&Private::fileName); + addProperty("relPath",this,&Private::relPath); + addProperty("highlight",this,&Private::highlight); + addProperty("subhighlight",this,&Private::subhighlight); + addProperty("title",this,&Private::title); } private: GenericNodeListContext m_pageList; @@ -2106,17 +3187,17 @@ TemplateVariant PageListContext::get(const char *name) const //%% struct ModuleNode: node is a directory hierarchy //%% { -class ModuleNodeContext::Private : public PropertyMapper +class ModuleNodeContext::Private : public PropertyMapper { public: Private(GroupDef *gd) : m_groupDef(gd), m_moduleContext(gd) { //%% bool is_leaf_node: true if this node does not have any children - insert("is_leaf_node", new PropertyFunc(this,&Private::isLeafNode)); + addProperty("is_leaf_node",this,&Private::isLeafNode); //%% ModuleList children: list of submodules - insert("children", new PropertyFunc(this,&Private::children)); + addProperty("children",this,&Private::children); //%% Module module: module info - insert("module", new PropertyFunc(this,&Private::getModule)); + addProperty("module",this,&Private::getModule); addModules(); } TemplateVariant isLeafNode() const @@ -2145,7 +3226,7 @@ class ModuleNodeContext::Private : public PropertyMapper +class ModuleTreeContext::Private : public PropertyMapper { public: TemplateVariant tree() const @@ -2260,19 +3341,19 @@ class ModuleTreeContext::Private : public PropertyMapper +class ExampleListContext::Private : public PropertyMapper { public: TemplateVariant items() const @@ -2327,19 +3408,19 @@ class ExampleListContext::Private : public PropertyMapperget(name); } + +//------------------------------------------------------------------------ + +//%% struct InheritanceNode: a class in the inheritance list +//%% { +class InheritanceNodeContext::Private : public PropertyMapper +{ + public: + Private(ClassDef *cd,const QCString &name) : m_classContext(cd), m_name(name) + { + addProperty("class",this,&Private::getClass); + addProperty("name",this,&Private::name); + } + TemplateVariant getClass() const + { + return &m_classContext; + } + TemplateVariant name() const + { + return m_name; + } + private: + ClassContext m_classContext; + QCString m_name; +}; +//%% } + +InheritanceNodeContext::InheritanceNodeContext(ClassDef *cd,const QCString &name) +{ + p = new Private(cd,name); +} + +InheritanceNodeContext::~InheritanceNodeContext() +{ + delete p; +} + +TemplateVariant InheritanceNodeContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list InheritanceList[InheritanceNode] : list of inherited classes +class InheritanceListContext::Private : public GenericNodeListContext +{ + public: + void addClass(ClassDef *cd,const QCString &name) + { + append(new InheritanceNodeContext(cd,name)); + } +}; + +InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses) +{ + p = new Private; + if (list) + { + BaseClassListIterator li(*list); + BaseClassDef *bcd; + for (li.toFirst();(bcd=li.current());++li) + { + ClassDef *cd=bcd->classDef; + QCString name; + if (baseClasses) + { + name = insertTemplateSpecifierInScope( + cd->displayName(),bcd->templSpecifiers); + } + else + { + name = cd->displayName(); + } + //printf("InheritanceListContext: adding %s baseClass=%d\n",name.data(),baseClasses); + p->addClass(cd,name); + } + } +} + +InheritanceListContext::~InheritanceListContext() +{ + delete p; +} + +// TemplateListIntf +int InheritanceListContext::count() const +{ + return p->count(); +} + +TemplateVariant InheritanceListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *InheritanceListContext::createIterator() const +{ + return p->createIterator(); +} + + +//------------------------------------------------------------------------ + +//%% list MemberList[Member] : list of inherited classes +class MemberListContext::Private : public GenericNodeListContext +{ + public: + void addMember(MemberDef *md) + { + append(new MemberContext(md)); + } +}; + +MemberListContext::MemberListContext(const MemberList *list) +{ + p = new Private; + if (list) + { + MemberListIterator mli(*list); + MemberDef *md; + for (mli.toFirst();(md=mli.current());++mli) + { + if (md->isBriefSectionVisible()) + { + p->addMember(md); + } + } + } +} + +MemberListContext::~MemberListContext() +{ + delete p; +} + +// TemplateListIntf +int MemberListContext::count() const +{ + return p->count(); +} + +TemplateVariant MemberListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *MemberListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + +//%% struct MemberListInfo: member list information +//%% { +class MemberListInfoContext::Private : public PropertyMapper +{ + public: + Private(const MemberList *ml,const QCString &title,const QCString &subtitle) : + m_memberListContext(ml), m_memberList(ml), m_title(title), m_subtitle(subtitle) + { + addProperty("members", this,&Private::members); + addProperty("title", this,&Private::title); + addProperty("subtitle",this,&Private::subtitle); + addProperty("anchor", this,&Private::anchor); + // TODO: member groups + } + TemplateVariant members() const + { + return &m_memberListContext; + } + TemplateVariant title() const + { + return m_title; + } + TemplateVariant subtitle() const + { + return m_subtitle; + } + TemplateVariant anchor() const + { + return m_memberList->listTypeAsString(m_memberList->listType()); + } + private: + MemberListContext m_memberListContext; + const MemberList *m_memberList; + QCString m_title; + QCString m_subtitle; +}; +//%% } + +MemberListInfoContext::MemberListInfoContext(const MemberList *ml, + const QCString &title,const QCString &subtitle) +{ + p = new Private(ml,title,subtitle); +} + +MemberListInfoContext::~MemberListInfoContext() +{ + delete p; +} + +TemplateVariant MemberListInfoContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% struct Argument: member list information +//%% { +class ArgumentContext::Private : public PropertyMapper +{ + public: + Private(const Argument *arg) : + m_argument(arg) + { + addProperty("type", this,&Private::type); + addProperty("name", this,&Private::name); + addProperty("defVal",this,&Private::defVal); + } + TemplateVariant type() const + { + return m_argument->type; + } + TemplateVariant name() const + { + return m_argument->name; + } + TemplateVariant defVal() const + { + return m_argument->defval; + } + private: + const Argument *m_argument; +}; +//%% } + +ArgumentContext::ArgumentContext(const Argument *al) +{ + p = new Private(al); +} + +ArgumentContext::~ArgumentContext() +{ + delete p; +} + +TemplateVariant ArgumentContext::get(const char *name) const +{ + return p->get(name); +} + +//------------------------------------------------------------------------ + +//%% list ArgumentList[Argument] : list of inherited classes +class ArgumentListContext::Private : public GenericNodeListContext +{ + public: + void addArgument(const Argument *arg) + { + append(new ArgumentContext(arg)); + } +}; + +ArgumentListContext::ArgumentListContext(const ArgumentList *list) +{ + p = new Private; + if (list) + { + ArgumentListIterator ali(*list); + const Argument *arg; + for (ali.toFirst();(arg=ali.current());++ali) + { + p->addArgument(arg); + } + } +} + +ArgumentListContext::~ArgumentListContext() +{ + delete p; +} + +// TemplateListIntf +int ArgumentListContext::count() const +{ + return p->count(); +} + +TemplateVariant ArgumentListContext::at(int index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *ArgumentListContext::createIterator() const +{ + return p->createIterator(); +} + //------------------------------------------------------------------------ class HtmlEscaper : public TemplateEscapeIntf @@ -2374,12 +3756,78 @@ class HtmlEscaper : public TemplateEscapeIntf //------------------------------------------------------------------------ +class HtmlSpaceless : public TemplateSpacelessIntf +{ + public: + HtmlSpaceless() : m_insideTag(FALSE), m_insideString('\0'), m_removeSpaces(TRUE) {} + QCString remove(const QCString &s) + { + QGString result; + const char *p = s.data(); + char c; + while ((c=*p++)) + { + switch(c) + { + case '<': // start of a tag + if (!m_insideString) m_insideTag=TRUE,m_removeSpaces=FALSE; + result+=c; + break; + case '>': // end of a tag + if (!m_insideString) m_insideTag=FALSE,m_removeSpaces=TRUE; + result+=c; + break; + case '\\': // escaped character in a string + result+=c; + if (m_insideString && *p) result+=*p++; + break; + case '"': case '\'': + if (m_insideTag) + { + if (m_insideString==c) // end of string + { + m_insideString='\0'; + } + else // start of string + { + m_insideString=c; + } + } + result+=c; + break; + case ' ': case '\t': case '\n': // whitespace + if (!m_removeSpaces) + { + result+=' '; + } + if (!m_insideTag) // outside tags strip consecutive whitespace + { + m_removeSpaces=TRUE; + } + break; + default: + result+=c; + m_removeSpaces=FALSE; + break; + } + } + result+='\0'; + //printf("HtmlSpaceless::remove('%s')='%s' m_insideTag=%d m_insideString=%d removeSpaces=%d\n",s.data(),result.data(), + // m_insideTag,m_insideString,m_removeSpaces); + return result.data(); + } + private: + bool m_insideTag; + char m_insideString; + bool m_removeSpaces; +}; + +//------------------------------------------------------------------------ + void generateOutputViaTemplate() { TemplateEngine e; TemplateContext *ctx = e.createContext(); - HtmlEscaper esc; - ctx->setEscapeIntf(&esc); if (ctx) { DoxygenContext doxygen; @@ -2431,7 +3879,14 @@ void generateOutputViaTemplate() Template *tpl = e.loadByName("htmllayout.tpl"); if (tpl) { - ctx->setOutputDirectory(Config_getString("HTML_OUTPUT")); + g_globals.outputFormat = ContextGlobals::Html; + g_globals.dynSectionId = 0; + g_globals.outputDir = Config_getString("HTML_OUTPUT"); + HtmlEscaper esc; + ctx->setEscapeIntf(&esc); + HtmlSpaceless spl; + ctx->setSpacelessIntf(&spl); + ctx->setOutputDirectory(g_globals.outputDir); FTextStream ts; tpl->render(ts,ctx); } diff --git a/src/context.h b/src/context.h index 4940403..d99eeac 100644 --- a/src/context.h +++ b/src/context.h @@ -1,11 +1,13 @@ #ifndef CONTEXT_H #define CONTEXT_H +#include "types.h" #include "template.h" class Definition; class ClassDef; class ClassSDict; +class BaseClassList; class PageDef; class GroupDef; class NamespaceDef; @@ -21,6 +23,11 @@ class PageSDict; class GroupSDict; class GroupDef; class GroupList; +struct IncludeInfo; +class MemberList; +class MemberDef; +struct Argument; +class ArgumentList; //---------------------------------------------------- @@ -72,6 +79,42 @@ class TranslateContext : public TemplateStructIntf //---------------------------------------------------- +class UsedFilesContext : public TemplateListIntf +{ + public: + UsedFilesContext(ClassDef *cd); + ~UsedFilesContext(); + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + + void addFile(FileDef *fd); + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class IncludeInfoContext : public TemplateStructIntf +{ + public: + IncludeInfoContext(IncludeInfo *,SrcLangExt lang); + ~IncludeInfoContext(); + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + class ClassContext : public TemplateStructIntf { public: @@ -152,6 +195,23 @@ class PageContext : public TemplateStructIntf //---------------------------------------------------- +class MemberContext : public TemplateStructIntf +{ + public: + MemberContext(MemberDef *); + ~MemberContext(); + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + + private: + class Private; + Private *p; +}; + + +//---------------------------------------------------- + class ModuleContext : public TemplateStructIntf { public: @@ -168,6 +228,26 @@ class ModuleContext : public TemplateStructIntf //---------------------------------------------------- +class NestedClassListContext : public TemplateListIntf +{ + public: + NestedClassListContext(); + ~NestedClassListContext(); + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + + void append(ClassDef *cd); + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + class ClassListContext : public TemplateListIntf { public: @@ -530,6 +610,109 @@ class ExampleListContext : public TemplateStructIntf //---------------------------------------------------- +class InheritanceNodeContext : public TemplateStructIntf +{ + public: + InheritanceNodeContext(ClassDef *cd,const QCString &name); + ~InheritanceNodeContext(); + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class InheritanceListContext : public TemplateListIntf +{ + public: + InheritanceListContext(const BaseClassList *list,bool baseClasses); + ~InheritanceListContext(); + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class MemberListContext : public TemplateListIntf +{ + public: + MemberListContext(const MemberList *ml); + ~MemberListContext(); + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class MemberListInfoContext : public TemplateStructIntf +{ + public: + MemberListInfoContext(const MemberList *ml,const QCString &title, + const QCString &subtitle=QCString()); + ~MemberListInfoContext(); + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class ArgumentContext : public TemplateStructIntf +{ + public: + ArgumentContext(const Argument *arg); + ~ArgumentContext(); + + // TemplateStructIntf methods + virtual TemplateVariant get(const char *name) const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + +class ArgumentListContext : public TemplateListIntf +{ + public: + ArgumentListContext(const ArgumentList *al); + ~ArgumentListContext(); + + // TemplateListIntf + virtual int count() const; + virtual TemplateVariant at(int index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + + private: + class Private; + Private *p; +}; + +//---------------------------------------------------- + void generateOutputViaTemplate(); #endif diff --git a/src/definition.cpp b/src/definition.cpp index 2140a59..93b55ab 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1876,4 +1876,10 @@ void Definition::_setSymbolName(const QCString &name) m_symbolName=name; } +bool Definition::hasBriefDescription() const +{ + static bool briefMemberDesc = Config_getBool("BRIEF_MEMBER_DESC"); + return !briefDescription().isEmpty() && briefMemberDesc; +} + diff --git a/src/definition.h b/src/definition.h index e3502a0..9de08fd 100644 --- a/src/definition.h +++ b/src/definition.h @@ -260,6 +260,9 @@ class Definition : public DefinitionIntf bool hasSections() const; + /** returns TRUE if this class has a brief description */ + bool hasBriefDescription() const; + QCString id() const; //----------------------------------------------------------------------------------- diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6f9a8bf..b27dcd7 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1336,8 +1336,7 @@ static void addClassToContext(EntryNav *rootNav) // see if the class is found inside a namespace //bool found=addNamespace(root,cd); - // the empty string test is needed for extract all case - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); // add class to the list //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data()); @@ -1537,7 +1536,6 @@ static ClassDef *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,const QC gd->addClass(cd); } } - //cd->insertUsedFile(root->fileName); //printf("** adding class %s based on %s\n",fullName.data(),templ->name().data()); Doxygen::classSDict->append(fullName,cd); @@ -1776,7 +1774,7 @@ static void buildNamespaceList(EntryNav *rootNav) // the empty string test is needed for extract all case nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); - nd->insertUsedFile(root->fileName); + nd->insertUsedFile(fd); nd->setBodySegment(root->bodyLine,root->endBodyLine); nd->setBodyDef(fd); // add class to the list @@ -1954,7 +1952,7 @@ static void findUsingDirectives(EntryNav *rootNav) // the empty string test is needed for extract all case nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); - nd->insertUsedFile(root->fileName); + nd->insertUsedFile(fd); // add class to the list Doxygen::namespaceSDict->inSort(name,nd); nd->setRefItems(root->sli); @@ -2373,7 +2371,7 @@ static MemberDef *addVariableToClass( md->setRefItems(root->sli); //TODO: insert FileDef instead of filename strings. - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(rootNav->fileDef()); rootNav->changeSection(Entry::EMPTY_SEC); return md; } @@ -3114,7 +3112,7 @@ static void addInterfaceOrServiceToServiceOrSingleton( findClassRelation(rootNav,cd,cd,&base,0,DocumentedOnly,true) || findClassRelation(rootNav,cd,cd,&base,0,Undocumented,true); // add file to list of used files - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); addMemberToGroups(root,md); rootNav->changeSection(Entry::EMPTY_SEC); @@ -3357,7 +3355,7 @@ static void addMethodToClass(EntryNav *rootNav,ClassDef *cd, // add member to the class cd cd->insertMember(md); // add file to list of used files - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); addMemberToGroups(root,md); rootNav->changeSection(Entry::EMPTY_SEC); @@ -4831,7 +4829,7 @@ static bool findClassRelation( // add this class as super class to the base class baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec); // the undocumented base was found in this file - baseClass->insertUsedFile(root->fileName); + baseClass->insertUsedFile(rootNav->fileDef()); baseClass->setOuterScope(Doxygen::globalScope); if (baseClassName.right(2)=="-p") { @@ -5344,7 +5342,7 @@ static void addMemberDocs(EntryNav *rootNav, md->mergeMemberSpecifiers(root->spec); md->addSectionsToDefinition(root->anchors); addMemberToGroups(root,md); - if (cd) cd->insertUsedFile(root->fileName); + if (cd) cd->insertUsedFile(rfd); //printf("root->mGrpId=%d\n",root->mGrpId); if (root->mGrpId!=-1) { @@ -6424,7 +6422,7 @@ static void findMember(EntryNav *rootNav, md->setMemberGroupId(root->mGrpId); mn->append(md); cd->insertMember(md); - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); md->setRefItems(root->sli); } } @@ -6621,7 +6619,7 @@ static void findMember(EntryNav *rootNav, //md->setMemberDefTemplateArguments(root->mtArgList); mn->append(md); cd->insertMember(md); - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); md->setRefItems(root->sli); if (root->relatesType == Duplicate) md->setRelatedAlso(cd); if (!isDefine) @@ -6693,7 +6691,7 @@ localObjCMethod: md->setMemberSpecifiers(root->spec); md->setMemberGroupId(root->mGrpId); cd->insertMember(md); - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); md->setRefItems(root->sli); if ((mn=Doxygen::memberNameSDict->find(root->name))) { @@ -7077,7 +7075,7 @@ static void findEnums(EntryNav *rootNav) md->setDefinition(cd->name()+"::"+name+baseType); } cd->insertMember(md); - cd->insertUsedFile(root->fileName); + cd->insertUsedFile(fd); } md->setDocumentation(root->doc,root->docFile,root->docLine); md->setDocsForDefinition(!root->proto); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 9125b0d..10c5b29 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2013 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -71,9 +71,9 @@ static QCString addTemplateNames(const QCString &s,const QCString &n,const QCStr if (s.length()==j || (s.at(j)!='<' && !isId(s.at(j)))) { // add template names //printf("Adding %s+%s\n",clRealName.data(),t.data()); - result+=clRealName+t; + result+=clRealName+t; } - else + else { // template names already present //printf("Adding %s\n",clRealName.data()); result+=clRealName; @@ -116,15 +116,15 @@ static QCString addTemplateNames(const QCString &s,const QCString &n,const QCStr // --- leave writeDefArgumentList with return value FALSE // ol.endMemberDocName // ol.endMemberDoc(hasArgs=FALSE); -// +// static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, const QCString & /*scopeName*/,MemberDef *md) { - ArgumentList *defArgList=(md->isDocsForDefinition()) ? + ArgumentList *defArgList=(md->isDocsForDefinition()) ? md->argumentList() : md->declArgumentList(); //printf("writeDefArgumentList `%s' isDocsForDefinition()=%d\n",md->name().data(),md->isDocsForDefinition()); - if (defArgList==0 || md->isProperty()) + if (defArgList==0 || md->isProperty()) { return FALSE; // member has no function like argument list } @@ -140,7 +140,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.startParameterType(TRUE,0); ol.endParameterType(); ol.startParameterName(FALSE); - while (a) + while (a) { if (a->defval.isEmpty()) { @@ -167,7 +167,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, if (latexOn) ol.enable(OutputGenerator::Latex); ol.endMemberDocName(); - ol.startParameterList(!md->isObjCMethod()); + ol.startParameterList(!md->isObjCMethod()); } ol.enableAll(); ol.disable(OutputGenerator::Html); @@ -194,7 +194,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, } else if (cd->templateArguments()) { - cName=tempArgListToString(cd->templateArguments()); + cName=tempArgListToString(cd->templateArguments()); //printf("2. cName=%s\n",cName.data()); } else // no template specifier @@ -209,7 +209,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, bool isDefine = md->isDefine(); while (a) { - if (isDefine || first) + if (isDefine || first) { ol.startParameterType(first,0); paramTypeStarted=TRUE; @@ -224,7 +224,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, int wp=a->type.find(res); // use the following to put the function pointer type before the name - bool hasFuncPtrType=FALSE; + bool hasFuncPtrType=FALSE; if (!a->attrib.isEmpty() && !md->isObjCMethod()) // argument has an IDL attribute { @@ -251,7 +251,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, } if (!isDefine) { - if (paramTypeStarted) + if (paramTypeStarted) { ol.endParameterType(); paramTypeStarted=FALSE; @@ -260,10 +260,10 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, } if (hasFuncPtrType) { - ol.docify(a->type.mid(wp,vp-wp)); + ol.docify(a->type.mid(wp,vp-wp)); } if (!a->name.isEmpty() || (a->name.isEmpty() && a->type=="...")) // argument has a name - { + { //if (!hasFuncPtrType) //{ // ol.docify(" "); @@ -284,7 +284,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, { ol.docify(a->array); } - if (hasFuncPtrType) // write the part of the argument type + if (hasFuncPtrType) // write the part of the argument type // that comes after the name { linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(), @@ -297,15 +297,15 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, ol.docify(" = "); ol.startTypewriter(); - linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,n,FALSE,TRUE,TRUE); + linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,n,FALSE,TRUE,TRUE); ol.endTypewriter(); } a=defArgList->next(); - if (a) + if (a) { if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments - if (!isDefine) + if (!isDefine) { QCString key; if (md->isObjCMethod() && a->attrib.length()>=2) @@ -316,7 +316,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, if (key!=",") key+=":"; // for normal keywords add colon } ol.endParameterName(FALSE,FALSE,!md->isObjCMethod()); - if (paramTypeStarted) + if (paramTypeStarted) { ol.endParameterType(); } @@ -360,7 +360,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, md, // self defArgList->trailingReturnType, // text FALSE // autoBreak - ); + ); } return TRUE; @@ -441,7 +441,7 @@ static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) { ol.docify(" = "); ol.docify(a->defval); - } + } a=al->next(); if (a) ol.docify(", "); } @@ -484,16 +484,16 @@ class MemberDefImpl const ArgumentList *al ); - ClassDef *classDef; // member of or related to - FileDef *fileDef; // member of file definition + ClassDef *classDef; // member of or related to + FileDef *fileDef; // member of file definition NamespaceDef *nspace; // the namespace this member is in. MemberDef *enumScope; // the enclosing scope, if this is an enum field - bool livesInsideEnum; + bool livesInsideEnum; MemberDef *annEnumType; // the anonymous enum that is the type of this member MemberList *enumFields; // enumeration fields - MemberDef *redefines; // the members that this member redefines + MemberDef *redefines; // the members that this member redefines MemberList *redefinedBy; // the list of members that redefine this one MemberDef *memDef; // member definition for this declaration @@ -523,7 +523,7 @@ class MemberDefImpl uint64 memSpec; // The specifiers present for this member MemberType mtype; // returns the kind of member - int maxInitLines; // when the initializer will be displayed + int maxInitLines; // when the initializer will be displayed int userInitLines; // result of explicit \hideinitializer or \showinitializer MemberDef *annMemb; @@ -533,13 +533,13 @@ class MemberDefImpl ArgumentList *tArgList; // template argument list of function template ArgumentList *typeConstraints; // type constraints for template parameters MemberDef *templateMaster; - QList *defTmpArgLists; // lists of template argument lists + QList *defTmpArgLists; // lists of template argument lists // (for template functions in nested template classes) ClassDef *cachedAnonymousType; // if the member has an anonymous compound // as its type then this is computed by - // getClassDefOfAnonymousType() and - // cached here. + // getClassDefOfAnonymousType() and + // cached here. SDict *classSectionSDict; // not accessible MemberDef *groupAlias; // Member containing the definition @@ -555,7 +555,7 @@ class MemberDefImpl ClassDef *cachedTypedefValue; QCString cachedTypedefTemplSpec; QCString cachedResolvedType; - + // inbody documentation //int inbodyLine; //QCString inbodyFile; @@ -568,7 +568,7 @@ class MemberDefImpl QCString explicitOutputFileBase; // objective-c - bool implOnly; // function found in implementation but not + bool implOnly; // function found in implementation but not // in the interface bool hasDocumentedParams; bool hasDocumentedReturnType; @@ -578,7 +578,7 @@ class MemberDefImpl bool proto; // is it a prototype; bool docEnumValues; // is an enum with documented enum values. bool annScope; // member is part of an annoymous scope - bool annUsed; + bool annUsed; bool hasCallGraph; bool hasCallerGraph; bool explExt; // member was explicitly declared external @@ -743,10 +743,10 @@ void MemberDefImpl::init(Definition *def, * \c Normal, \c Virtual, \c Pure. * \param s A boolean that is true iff the member is static. * \param r The relationship between the class and the member. - * \param mt The kind of member. See #MemberType for a list of + * \param mt The kind of member. See #MemberType for a list of * all types. * \param tal The template arguments of this member. - * \param al The arguments of this member. This is a structured form of + * \param al The arguments of this member. This is a structured form of * the string past as argument \a a. */ @@ -788,7 +788,7 @@ MemberDef *MemberDef::deepCopy() const result->m_impl->defTmpArgLists=0; result->m_impl->classSectionSDict=0; result->m_impl->declArgList=0; - // replace pointers owned by the object by deep copies + // replace pointers owned by the object by deep copies if (m_impl->redefinedBy) { MemberListIterator mli(*m_impl->redefinedBy); @@ -861,8 +861,8 @@ void MemberDef::moveTo(Definition *scope) { m_impl->nspace = (NamespaceDef*)scope; } - m_isLinkableCached = 0; - m_isConstructorCached = 0; + m_isLinkableCached = 0; + m_isConstructorCached = 0; } @@ -874,8 +874,8 @@ MemberDef::~MemberDef() m_impl=0; } -void MemberDef::setReimplements(MemberDef *md) -{ +void MemberDef::setReimplements(MemberDef *md) +{ m_impl->redefines = md; } @@ -886,20 +886,20 @@ void MemberDef::insertReimplementedBy(MemberDef *md) m_impl->templateMaster->insertReimplementedBy(md); } if (m_impl->redefinedBy==0) m_impl->redefinedBy = new MemberList(MemberListType_redefinedBy); - if (m_impl->redefinedBy->findRef(md)==-1) + if (m_impl->redefinedBy->findRef(md)==-1) { m_impl->redefinedBy->inSort(md); } } -MemberDef *MemberDef::reimplements() const -{ - return m_impl->redefines; +MemberDef *MemberDef::reimplements() const +{ + return m_impl->redefines; } -MemberList *MemberDef::reimplementedBy() const -{ - return m_impl->redefinedBy; +MemberList *MemberDef::reimplementedBy() const +{ + return m_impl->redefinedBy; } bool MemberDef::isReimplementedBy(ClassDef *cd) const @@ -934,7 +934,7 @@ bool MemberDef::addExample(const char *anchor,const char *nameStr, { //printf("%s::addExample(%s,%s,%s)\n",name().data(),anchor,nameStr,file); if (m_impl->exampleSDict==0) m_impl->exampleSDict = new ExampleSDict; - if (m_impl->exampleSDict->find(nameStr)==0) + if (m_impl->exampleSDict->find(nameStr)==0) { //printf("Add reference to example %s to member %s\n",nameStr,name.data()); Example *e=new Example; @@ -944,12 +944,12 @@ bool MemberDef::addExample(const char *anchor,const char *nameStr, m_impl->exampleSDict->inSort(nameStr,e); return TRUE; } - return FALSE; + return FALSE; } bool MemberDef::hasExamples() { - if (m_impl->exampleSDict==0) + if (m_impl->exampleSDict==0) return FALSE; else return m_impl->exampleSDict->count()>0; @@ -986,7 +986,7 @@ QCString MemberDef::getOutputFileBase() const { baseName=m_impl->fileDef->getOutputFileBase(); } - + if (baseName.isEmpty()) { warn(getDefFileName(),getDefLine(), @@ -1048,7 +1048,7 @@ QCString MemberDef::anchor() const { result.prepend(m_impl->enumScope->anchor()); } - if (m_impl->group) + if (m_impl->group) { if (m_impl->groupMember) { @@ -1067,7 +1067,7 @@ void MemberDef::_computeLinkableInProject() static bool extractStatic = Config_getBool("EXTRACT_STATIC"); m_isLinkableCached = 2; // linkable //printf("MemberDef::isLinkableInProject(name=%s)\n",name().data()); - if (isHidden()) + if (isHidden()) { //printf("is hidden\n"); m_isLinkableCached = 1; @@ -1079,51 +1079,51 @@ void MemberDef::_computeLinkableInProject() m_isLinkableCached = m_impl->templateMaster->isLinkableInProject() ? 2 : 1; return; } - if (name().isEmpty() || name().at(0)=='@') + if (name().isEmpty() || name().at(0)=='@') { //printf("name invalid\n"); m_isLinkableCached = 1; // not a valid or a dummy name return; } - if (!hasDocumentation() && !isReference()) + if (!hasDocumentation() && !isReference()) { //printf("no docs or reference\n"); m_isLinkableCached = 1; // no documentation return; } - if (m_impl->group && !m_impl->group->isLinkableInProject()) + if (m_impl->group && !m_impl->group->isLinkableInProject()) { //printf("group but group not linkable!\n"); m_isLinkableCached = 1; // group but group not linkable return; } - if (!m_impl->group && m_impl->classDef && !m_impl->classDef->isLinkableInProject()) + if (!m_impl->group && m_impl->classDef && !m_impl->classDef->isLinkableInProject()) { //printf("in a class but class not linkable!\n"); m_isLinkableCached = 1; // in class but class not linkable return; } - if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject()) + if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject()) { //printf("in a namespace but namespace not linkable!\n"); m_isLinkableCached = 1; // in namespace but namespace not linkable return; } - if (!m_impl->group && !m_impl->nspace && - !m_impl->related && !m_impl->classDef && - m_impl->fileDef && !m_impl->fileDef->isLinkableInProject()) + if (!m_impl->group && !m_impl->nspace && + !m_impl->related && !m_impl->classDef && + m_impl->fileDef && !m_impl->fileDef->isLinkableInProject()) { //printf("in a file but file not linkable!\n"); m_isLinkableCached = 1; // in file (and not in namespace) but file not linkable return; } - if (!protectionLevelVisible(m_impl->prot) && m_impl->mtype!=MemberType_Friend) + if (!protectionLevelVisible(m_impl->prot) && m_impl->mtype!=MemberType_Friend) { //printf("private and invisible!\n"); m_isLinkableCached = 1; // hidden due to protection return; } - if (m_impl->stat && m_impl->classDef==0 && !extractStatic) + if (m_impl->stat && m_impl->classDef==0 && !extractStatic) { //printf("static and invisible!\n"); m_isLinkableCached = 1; // hidden due to staticness @@ -1203,11 +1203,11 @@ void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, { n.prepend(m_impl->enumScope->displayName()+sep); } - if (m_impl->classDef && gd && !isRelated()) + if (m_impl->classDef && gd && !isRelated()) { n.prepend(m_impl->classDef->displayName()+sep); } - else if (m_impl->nspace && (gd || fd)) + else if (m_impl->nspace && (gd || fd)) { n.prepend(m_impl->nspace->displayName()+sep); } @@ -1243,12 +1243,12 @@ void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, /*! If this member has an anonymous class/struct/union as its type, then * this method will return the ClassDef that describes this return type. */ -ClassDef *MemberDef::getClassDefOfAnonymousType() +ClassDef *MemberDef::getClassDefOfAnonymousType() { if (m_impl->cachedAnonymousType) return m_impl->cachedAnonymousType; QCString cname; - if (getClassDef()!=0) + if (getClassDef()!=0) { cname=getClassDef()->name().copy(); } @@ -1277,7 +1277,7 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() QCString annName = ltype.mid(il,ir-il); // if inside a class or namespace try to prepend the scope name - if (!cname.isEmpty() && annName.left(cname.length()+2)!=cname+"::") + if (!cname.isEmpty() && annName.left(cname.length()+2)!=cname+"::") { QCString ts=stripAnonymousNamespaceScope(cname+"::"+annName); annoClassDef=getClass(ts); @@ -1292,7 +1292,7 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() m_impl->cachedAnonymousType = annoClassDef; return annoClassDef; } - + /*! This methods returns TRUE iff the brief section (also known as * declaration section) is visible in the documentation. */ @@ -1313,51 +1313,51 @@ bool MemberDef::isBriefSectionVisible() const MemberGroupInfo *info = Doxygen::memGrpInfoDict[m_impl->grpId]; //printf("name=%s m_impl->grpId=%d info=%p\n",name().data(),m_impl->grpId,info); //QCString *pMemGrp = Doxygen::memberDocDict[grpId]; - bool hasDocs = hasDocumentation() || + bool hasDocs = hasDocumentation() || // part of a documented member group (m_impl->grpId!=-1 && info && !(info->doc.isEmpty() && info->header.isEmpty())); - // only include static members with file/namespace scope if + // only include static members with file/namespace scope if // explicitly enabled in the config file - bool visibleIfStatic = !(getClassDef()==0 && - isStatic() && + bool visibleIfStatic = !(getClassDef()==0 && + isStatic() && !extractStatic ); - // only include members is the are documented or + // only include members is the are documented or // HIDE_UNDOC_MEMBERS is NO in the config file - bool visibleIfDocumented = (!hideUndocMembers || - hasDocs || + bool visibleIfDocumented = (!hideUndocMembers || + hasDocs || isDocumentedFriendClass() ); - // hide members with no detailed description and brief descriptions + // hide members with no detailed description and brief descriptions // explicitly disabled. - bool visibleIfEnabled = !(hideUndocMembers && + bool visibleIfEnabled = !(hideUndocMembers && documentation().isEmpty() && - !briefMemberDesc && + !briefMemberDesc && !repeatBrief ); // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true bool visibleIfFriendCompound = !(hideFriendCompounds && isFriend() && - (m_impl->type=="friend class" || + (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union" ) ); - + // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group - bool visibleIfPrivate = (protectionLevelVisible(protection()) || + bool visibleIfPrivate = (protectionLevelVisible(protection()) || m_impl->mtype==MemberType_Friend ); - + // hide member if it overrides a member in a superclass and has no // documentation of its own - //bool visibleIfDocVirtual = !reimplements() || - // !Config_getBool("INHERIT_DOCS") || + //bool visibleIfDocVirtual = !reimplements() || + // !Config_getBool("INHERIT_DOCS") || // hasDocs; // true if this member is a constructor or destructor @@ -1380,20 +1380,47 @@ bool MemberDef::isBriefSectionVisible() const // visibleIfStatic,visibleIfDocumented, // visibleIfEnabled,visibleIfPrivate,visibleIfNotDefaultCDTor, // visibleIfFriendCompound,!m_impl->annScope); - - bool visible = visibleIfStatic && visibleIfDocumented && + + bool visible = visibleIfStatic && visibleIfDocumented && visibleIfEnabled && visibleIfPrivate && - /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && - visibleIfFriendCompound && + /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && + visibleIfFriendCompound && !m_impl->annScope && !isHidden(); //printf("MemberDef::isBriefSectionVisible() %d\n",visible); return visible; } +QCString MemberDef::getDeclType() const +{ + QCString ltype(m_impl->type); + if (m_impl->mtype==MemberType_Typedef) + { + ltype.prepend("typedef "); + } + if (isAlias()) + { + ltype="using"; + } + // strip `friend' keyword from ltype + ltype.stripPrefix("friend "); + if (ltype=="@") // rename type from enum values + { + ltype=""; + } + else + { + if (isObjCMethod()) + { + ltype.prepend("("); + ltype.append(")"); + } + } + return ltype; +} void MemberDef::writeDeclaration(OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - bool inGroup, const DefType compoundType, + bool inGroup, const DefType compoundType, ClassDef *inheritedFrom,const char *inheritId) { //printf("%s MemberDef::writeDeclaration() inGroup=%d\n",qualifiedName().data(),inGroup); @@ -1431,7 +1458,7 @@ void MemberDef::writeDeclaration(OutputList &ol, // start a new member declaration bool isAnonymous = annoClassDef || m_impl->annMemb || m_impl->annEnumType; ///printf("startMemberItem for %s\n",name().data()); - ol.startMemberItem(anchor(), + ol.startMemberItem(anchor(), isAnonymous ? 1 : m_impl->tArgList ? 3 : 0, inheritId ); @@ -1441,7 +1468,7 @@ void MemberDef::writeDeclaration(OutputList &ol, if (!detailsVisible && !m_impl->annMemb) { QCString doxyName=name().copy(); - if (!cname.isEmpty()) + if (!cname.isEmpty()) { doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage())); } @@ -1458,7 +1485,7 @@ void MemberDef::writeDeclaration(OutputList &ol, if (annoClassDef || m_impl->annMemb) { int j; - for (j=0;j>>>>>>>>>>>>> startMemberItem(2)\n"); ol.startMemberItem(anchor(),2,inheritId); int j; - for (j=0;j< s_indentLevel-1;j++) + for (j=0;j< s_indentLevel-1;j++) { ol.writeNonBreakableSpace(3); } QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); //printf(">>>>>> indDepth=%d ltype=`%s' varName=`%s'\n",indDepth,ltype.data(),varName.data()); ol.docify("}"); - if (varName.isEmpty() && (name().isEmpty() || name().at(0)=='@')) + if (varName.isEmpty() && (name().isEmpty() || name().at(0)=='@')) { - ol.docify(";"); + ol.docify(";"); } endAnonScopeNeeded=TRUE; } @@ -1522,10 +1549,10 @@ void MemberDef::writeDeclaration(OutputList &ol, this, // self ltype.left(i), // text TRUE // autoBreak - ); + ); getAnonymousEnumType()->writeEnumDeclaration(ol,cd,nd,fd,gd,compoundType); //ol+=*getAnonymousEnumType()->enumDecl(); - linkifyText(TextGeneratorOLImpl(ol),d,m_impl->fileDef,this,ltype.right(ltype.length()-i-l),TRUE); + linkifyText(TextGeneratorOLImpl(ol),d,m_impl->fileDef,this,ltype.right(ltype.length()-i-l),TRUE); } else { @@ -1536,7 +1563,7 @@ void MemberDef::writeDeclaration(OutputList &ol, this, // self ltype, // text TRUE // autoBreak - ); + ); } } } @@ -1565,12 +1592,12 @@ void MemberDef::writeDeclaration(OutputList &ol, ol.disable(OutputGenerator::Html); } if (!ltype.isEmpty()) ol.docify(" "); - if (htmlOn) + if (htmlOn) { ol.enable(OutputGenerator::Html); } - if (m_impl->annMemb) + if (m_impl->annMemb) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1583,7 +1610,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } // *** write name - if (!name().isEmpty() && name().at(0)!='@') // hide anonymous stuff + if (!name().isEmpty() && name().at(0)!='@') // hide anonymous stuff { //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable()); if (!(name().isEmpty() || name().at(0)=='@') && // name valid @@ -1608,27 +1635,27 @@ void MemberDef::writeDeclaration(OutputList &ol, { //printf("writeLink %s->%d\n",name.data(),hasDocumentation()); ClassDef *rcd = cd; - if (isReference() && m_impl->classDef) rcd = m_impl->classDef; + if (isReference() && m_impl->classDef) rcd = m_impl->classDef; writeLink(ol,rcd,nd,fd,gd); } } else if (isDocumentedFriendClass()) - // if the member is an undocumented friend declaration for some class, + // if the member is an undocumented friend declaration for some class, // then maybe we can link to the class { writeLink(ol,getClass(name()),0,0,0); } else - // there is a brief member description and brief member + // there is a brief member description and brief member // descriptions are enabled or there is no detailed description. { - if (m_impl->annMemb) + if (m_impl->annMemb) { m_impl->annMemb->setAnonymousUsed(); setAnonymousUsed(); } ClassDef *rcd = cd; - if (isReference() && m_impl->classDef) rcd = m_impl->classDef; + if (isReference() && m_impl->classDef) rcd = m_impl->classDef; writeLink(ol,rcd,nd,fd,gd,TRUE); } } @@ -1654,7 +1681,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } // *** write arguments - if (argsString() && !isObjCMethod()) + if (argsString() && !isObjCMethod()) { if (!isDefine()) ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol), // out @@ -1678,20 +1705,20 @@ void MemberDef::writeDeclaration(OutputList &ol, // *** write bitfields if (!m_impl->bitfields.isEmpty()) // add bitfields { - linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_impl->bitfields.simplifyWhiteSpace()); + linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_impl->bitfields); } else if (hasOneLineInitializer() //!init.isEmpty() && initLines==0 && // one line initializer //((maxInitLines>0 && userInitLines==-1) || userInitLines>0) // enabled by default or explicitly ) // add initializer { - if (!isDefine()) + if (!isDefine()) { - //ol.writeString(" = "); - ol.writeString(" "); + //ol.writeString(" = "); + ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_impl->initializer.simplifyWhiteSpace()); } - else + else { ol.writeNonBreakableSpace(3); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_impl->initializer); @@ -1699,7 +1726,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } else if (isAlias()) // using template alias { - ol.writeString(" = "); + ol.writeString(" = "); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_impl->type); } @@ -1758,14 +1785,14 @@ void MemberDef::writeDeclaration(OutputList &ol, //printf("endMember %s annoClassDef=%p annEnumType=%p\n", // name().data(),annoClassDef,annEnumType); ol.endMemberItem(); - if (endAnonScopeNeeded) + if (endAnonScopeNeeded) { ol.endAnonTypeScope(--s_indentLevel); } // write brief description - if (!briefDescription().isEmpty() && - Config_getBool("BRIEF_MEMBER_DESC") + if (!briefDescription().isEmpty() && + Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */ ) { @@ -1777,7 +1804,7 @@ void MemberDef::writeDeclaration(OutputList &ol, { ol.startMemberDescription(anchor(),inheritId); ol.writeDoc(rootNode,getOuterScope()?getOuterScope():d,this); - if (detailsVisible) + if (detailsVisible) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1812,8 +1839,8 @@ void MemberDef::writeDeclaration(OutputList &ol, warnIfUndocumented(); } -bool MemberDef::isDetailedSectionLinkable() const -{ +bool MemberDef::isDetailedSectionLinkable() const +{ static bool extractAll = Config_getBool("EXTRACT_ALL"); static bool alwaysDetailedSec = Config_getBool("ALWAYS_DETAILED_SEC"); static bool repeatBrief = Config_getBool("REPEAT_BRIEF"); @@ -1822,27 +1849,27 @@ bool MemberDef::isDetailedSectionLinkable() const static bool extractStatic = Config_getBool("EXTRACT_STATIC"); // the member has details documentation for any of the following reasons - bool docFilter = + bool docFilter = // treat everything as documented - extractAll || + extractAll || // has detailed docs - !documentation().isEmpty() || + !documentation().isEmpty() || // has inbody docs !inbodyDocumentation().isEmpty() || // is an enum with values that are documented - (m_impl->mtype==MemberType_Enumeration && m_impl->docEnumValues) || + (m_impl->mtype==MemberType_Enumeration && m_impl->docEnumValues) || // is documented enum value - (m_impl->mtype==MemberType_EnumValue && !briefDescription().isEmpty()) || + (m_impl->mtype==MemberType_EnumValue && !briefDescription().isEmpty()) || // has brief description that is part of the detailed description (!briefDescription().isEmpty() && // has brief docs (alwaysDetailedSec && // they are visible in (repeatBrief || // detailed section or !briefMemberDesc // they are explicitly not ) // shown in brief section - ) + ) ) || // has a multi-line initialization block - //(initLines>0 && initLines0 && initLinesdefArgList!=0 && m_impl->defArgList->hasDocumentation()) || @@ -1850,11 +1877,11 @@ bool MemberDef::isDetailedSectionLinkable() const (m_impl->memSpec & (Entry::Attribute|Entry::Property)) || // has user comments Doxygen::userComments - ; - + ; + // this is not a global static or global statics should be extracted - bool staticFilter = getClassDef()!=0 || !isStatic() || extractStatic; - + bool staticFilter = getClassDef()!=0 || !isStatic() || extractStatic; + // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group bool privateFilter = protectionLevelVisible(protection()) || m_impl->mtype==MemberType_Friend; @@ -1868,29 +1895,29 @@ bool MemberDef::isDetailedSectionLinkable() const // is true bool friendCompoundFilter = !(Config_getBool("HIDE_FRIEND_COMPOUNDS") && isFriend() && - (m_impl->type=="friend class" || + (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union" ) ); - - + + bool result = ((docFilter && staticFilter && privateFilter && friendCompoundFilter && !isHidden())); //printf("%s::isDetailedSectionLinkable: %d\n",name().data(),result); return result; } -bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const -{ +bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const +{ static bool separateMemPages = Config_getBool("SEPARATE_MEMBER_PAGES"); static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS"); static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); - bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages; + bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages; bool fileFilter = getNamespaceDef()==0 || !inFile; - bool simpleFilter = !hideUndocMembers && inlineSimpleStructs && + bool simpleFilter = !hideUndocMembers && inlineSimpleStructs && getClassDef()!=0 && getClassDef()->isSimple(); - bool visible = isDetailedSectionLinkable() && groupFilter && fileFilter && + bool visible = isDetailedSectionLinkable() && groupFilter && fileFilter && !isReference(); bool result = visible || simpleFilter; //printf("%s::isDetailedSectionVisble: %d groupFilter=%d fileFilter=%d\n", @@ -1905,12 +1932,12 @@ void MemberDef::_getLabels(QStrList &sl,Definition *container) const Specifier lvirt=virtualness(); if ((!isObjCMethod() || isOptional() || isRequired()) && (protection()!=Public || lvirt!=Normal || - isFriend() || isRelated() || + isFriend() || isRelated() || (isInline() && inlineInfo) || isSignal() || isSlot() || - isStatic() || + isStatic() || (m_impl->classDef && m_impl->classDef!=container && container->definitionType()==TypeClass) || - (m_impl->memSpec & ~Entry::Inline)!=0 + (m_impl->memSpec & ~Entry::Inline)!=0 ) ) { @@ -1991,11 +2018,11 @@ void MemberDef::_getLabels(QStrList &sl,Definition *container) const sl.append("implementation"); } } - if (m_impl->classDef && - container->definitionType()==TypeClass && + if (m_impl->classDef && + container->definitionType()==TypeClass && m_impl->classDef!=container && !isRelated() - ) + ) { sl.append("inherited"); } @@ -2010,7 +2037,7 @@ void MemberDef::_getLabels(QStrList &sl,Definition *container) const void MemberDef::_writeCallGraph(OutputList &ol) { // write call graph - if ((m_impl->hasCallGraph || Config_getBool("CALL_GRAPH")) + if ((m_impl->hasCallGraph || Config_getBool("CALL_GRAPH")) && (isFunction() || isSlot() || isSignal()) && Config_getBool("HAVE_DOT") ) { @@ -2027,7 +2054,7 @@ void MemberDef::_writeCallGraph(OutputList &ol) ol.startCallGraph(); ol.parseText(theTranslator->trCallGraph()); ol.endCallGraph(callGraph); - ol.endParagraph(); + ol.endParagraph(); ol.enableAll(); } } @@ -2035,7 +2062,7 @@ void MemberDef::_writeCallGraph(OutputList &ol) void MemberDef::_writeCallerGraph(OutputList &ol) { - if ((m_impl->hasCallerGraph || Config_getBool("CALLER_GRAPH")) + if ((m_impl->hasCallerGraph || Config_getBool("CALLER_GRAPH")) && (isFunction() || isSlot() || isSignal()) && Config_getBool("HAVE_DOT") ) { @@ -2068,7 +2095,7 @@ void MemberDef::_writeReimplements(OutputList &ol) if (bcd->isLinkable()) { ol.startParagraph(); - QCString reimplFromLine; + QCString reimplFromLine; if (bmd->virtualness()!=Pure && bcd->compoundType()!=ClassDef::Interface) { reimplFromLine = theTranslator->trReimplementedFromList(1); @@ -2090,7 +2117,7 @@ void MemberDef::_writeReimplements(OutputList &ol) //ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), // bmd->anchor(),bcd->name()); - if ( bmd->isLinkableInProject() ) + if ( bmd->isLinkableInProject() ) { writePageRef(ol,bmd->getOutputFileBase(),bmd->anchor()); } @@ -2130,7 +2157,7 @@ void MemberDef::_writeReimplementedBy(OutputList &ol) { // count the members that directly inherit from md and for // which the member and class are visible in the docs. - if ( bmd->isLinkable() && bcd->isLinkable() ) + if ( bmd->isLinkable() && bcd->isLinkable() ) { count++; } @@ -2164,7 +2191,7 @@ void MemberDef::_writeReimplementedBy(OutputList &ol) // find the entryIndex-th documented entry in the inheritance list. for (mli.toLast();(bmd=mli.current()) && (bcd=bmd->getClassDef());--mli) { - if ( bmd->isLinkable() && bcd->isLinkable()) + if ( bmd->isLinkable() && bcd->isLinkable()) { if (count==entryIndex) break; count++; @@ -2178,14 +2205,14 @@ void MemberDef::_writeReimplementedBy(OutputList &ol) ol.writeObjectLink(bmd->getReference(),bmd->getOutputFileBase(), bmd->anchor(),bcd->displayName()); - if (bmd->isLinkableInProject() ) + if (bmd->isLinkableInProject() ) { writePageRef(ol,bmd->getOutputFileBase(),bmd->anchor()); } } ++mli; index=newIndex+matchLen; - } + } ol.parseText(reimplInLine.right(reimplInLine.length()-index)); ol.endParagraph(); } @@ -2213,7 +2240,7 @@ void MemberDef::_writeCategoryRelation(OutputList &ol) { if (m_impl->category) { - // this member is in a normal class and implements method categoryRelation from category + // this member is in a normal class and implements method categoryRelation from category // so link to method 'categoryRelation' with 'provided by category 'category' text. text = theTranslator->trProvidedByCategory(); name = m_impl->category->displayName(); @@ -2322,19 +2349,19 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, bool hasDetails = !fmd->documentation().isEmpty(); if (hasBrief) - { + { ol.generateDoc(fmd->briefFile(),fmd->briefLine(), getOuterScope()?getOuterScope():container, fmd,fmd->briefDescription(),TRUE,FALSE); } // FIXME:PARA - //if (!fmd->briefDescription().isEmpty() && + //if (!fmd->briefDescription().isEmpty() && // !fmd->documentation().isEmpty()) //{ // ol.newParagraph(); //} if (hasDetails) - { + { ol.generateDoc(fmd->docFile(),fmd->docLine(), getOuterScope()?getOuterScope():container, fmd,fmd->documentation()+"\n",TRUE,FALSE); @@ -2344,13 +2371,13 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, fmd=fmdl->next(); } } - if (!first) - { - //ol.endItemList(); + if (!first) + { + //ol.endItemList(); ol.endDescTable(); //ol.endDescForItem(); //ol.endSimpleSect(); - //ol.writeChar('\n'); + //ol.writeChar('\n'); } } } @@ -2415,7 +2442,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, QCString ldef = definition(); QCString title = name(); //printf("member `%s' def=`%s'\n",name().data(),ldef.data()); - if (isEnumerate()) + if (isEnumerate()) { if (title.at(0)=='@') { @@ -2463,7 +2490,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,ldef.left(i)); vmd->writeEnumDeclaration(ol,getClassDef(),getNamespaceDef(),getFileDef(),getGroupDef(),definitionType()); linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,ldef.right(ldef.length()-i-l)); - + found=TRUE; } } @@ -2475,7 +2502,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, // search for the last anonymous compound name in the definition int si=ldef.find(' '),pi,ei=i+l; if (si==-1) si=0; - while ((pi=r.match(ldef,i+l,&l))!=-1) + while ((pi=r.match(ldef,i+l,&l))!=-1) { i=pi; ei=i+l; @@ -2500,7 +2527,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { bool first=TRUE; SrcLangExt lang = getLanguage(); - if (m_impl->defTmpArgLists && lang==SrcLangExt_Cpp) + if (m_impl->defTmpArgLists && lang==SrcLangExt_Cpp) // definition has explicit template parameter declarations { QListIterator ali(*m_impl->defTmpArgLists); @@ -2563,7 +2590,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { // strip scope name int ep = ldef.find("::"); - if (ep!=-1) + if (ep!=-1) { int sp=ldef.findRev(' ',ep); if (sp!=-1) @@ -2609,14 +2636,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (hasOneLineInitializer()) // add initializer { - if (!isDefine()) + if (!isDefine()) { - //ol.docify(" = "); - ol.docify(" "); + //ol.docify(" = "); + ol.docify(" "); QCString init = m_impl->initializer.simplifyWhiteSpace(); linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,init); } - else + else { ol.writeNonBreakableSpace(3); linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,m_impl->initializer); @@ -2645,7 +2672,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } ol.popGeneratorState(); - if (hasParameterList) + if (hasParameterList) { ol.endParameterList(); ol.endMemberDoc(TRUE); @@ -2717,12 +2744,12 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } /* write brief description */ - if (!brief.isEmpty() && - (Config_getBool("REPEAT_BRIEF") || + if (!brief.isEmpty() && + (Config_getBool("REPEAT_BRIEF") || !Config_getBool("BRIEF_MEMBER_DESC") - ) - ) - { + ) + ) + { ol.startParagraph(); ol.generateDoc(briefFile(),briefLine(), getOuterScope()?getOuterScope():container,this, @@ -2731,11 +2758,11 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } /* write detailed description */ - if (!detailed.isEmpty() || + if (!detailed.isEmpty() || !inbodyDocumentation().isEmpty()) - { + { // write vhdl inline code with or without option INLINE_SOURCE - if (optVhdl && VhdlDocGen::isMisc(this)) + if (optVhdl && VhdlDocGen::isMisc(this)) { VhdlDocGen::writeSource(this,ol,cname); return; @@ -2744,7 +2771,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { ol.generateDoc(docFile(),docLine(),getOuterScope()?getOuterScope():container,this,detailed+"\n",TRUE,FALSE); } - + if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(), @@ -2763,7 +2790,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //printf("***** defArgList=%p name=%s docs=%s hasDocs=%d\n", - // defArgList, + // defArgList, // defArgList?defArgList->hasDocumentation():-1); if (docArgList!=0 && docArgList->hasDocumentation()) { @@ -2818,7 +2845,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.endIndent(); // enable LaTeX again - //if (Config_getBool("EXTRACT_ALL") && !hasDocs) ol.enable(OutputGenerator::Latex); + //if (Config_getBool("EXTRACT_ALL") && !hasDocs) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); //------------------------------------------------ @@ -2864,7 +2891,7 @@ static QCString simplifyTypeForTable(const QCString &s) } #if 0 -/** Returns the type definition corresponding to a member's return type. +/** Returns the type definition corresponding to a member's return type. * @param[in] scope The scope in which to search for the class definition. * @param[in] type The string representing the member's return type. * @param[in] lang The programming language in which the class is defined. @@ -2887,7 +2914,7 @@ static Definition *getClassFromType(Definition *scope,const QCString &type,SrcLa cd = getResolvedClass(scope,0,name+templSpec,&md); } cd = getResolvedClass(scope,0,name); - if (cd) + if (cd) { start=i; length=l; @@ -2965,20 +2992,20 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) this, // self ts, // text TRUE // autoBreak - ); + ); } ol.endDoxyAnchor(cfname,memAnchor); ol.endInlineMemberType(); ol.startInlineMemberName(); ol.docify(doxyName); - if (isVariable() && argsString() && !isObjCMethod()) + if (isVariable() && argsString() && !isObjCMethod()) { linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,argsString()); } if (!m_impl->bitfields.isEmpty()) // add bitfields { - linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,m_impl->bitfields.simplifyWhiteSpace()); + linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,m_impl->bitfields); } ol.endInlineMemberName(); @@ -2988,8 +3015,8 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) QCString detailed = documentation(); /* write brief description */ - if (!brief.isEmpty()) - { + if (!brief.isEmpty()) + { ol.generateDoc(briefFile(),briefLine(), getOuterScope()?getOuterScope():container,this, brief,FALSE,FALSE,0,TRUE,FALSE); @@ -2997,11 +3024,11 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) /* write detailed description */ if (!detailed.isEmpty()) - { + { ol.generateDoc(docFile(),docLine(), getOuterScope()?getOuterScope():container,this, detailed+"\n",FALSE,FALSE,0,FALSE,FALSE); - + } ol.endInlineMemberDoc(); @@ -3015,7 +3042,7 @@ QCString MemberDef::memberTypeName() const case MemberType_Function: return "function"; case MemberType_Variable: return "variable"; case MemberType_Typedef: return "typedef"; - case MemberType_Enumeration: return "enumeration"; + case MemberType_Enumeration: return "enumeration"; case MemberType_EnumValue: return "enumvalue"; case MemberType_Signal: return "signal"; case MemberType_Slot: return "slot"; @@ -3038,10 +3065,10 @@ void MemberDef::warnIfUndocumented() GroupDef *gd = getGroupDef(); Definition *d=0; const char *t=0; - if (cd) - t="class", d=cd; - else if (nd) - t="namespace", d=nd; + if (cd) + t="class", d=cd; + else if (nd) + t="namespace", d=nd; else if (gd) t="group", d=gd; else @@ -3053,7 +3080,7 @@ void MemberDef::warnIfUndocumented() // d->isLinkable(),isLinkable(),isDocumentedFriendClass(), // name().data(),prot); if ((!hasUserDocumentation() && !extractAll) && - !isFriendClass() && + !isFriendClass() && name().find('@')==-1 && d && d->name().find('@')==-1 && protectionLevelVisible(m_impl->prot) && !isReference() @@ -3068,8 +3095,8 @@ void MemberDef::warnIfUndocumented() bool MemberDef::isFriendClass() const { - return (isFriend() && - (m_impl->type=="friend class" || m_impl->type=="friend struct" || + return (isFriend() && + (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union")); } @@ -3080,12 +3107,12 @@ bool MemberDef::isDocumentedFriendClass() const int i=baseName.find('<'); if (i!=-1) baseName=baseName.left(i); return (isFriendClass() && - (fcd=getClass(baseName)) && fcd->isLinkable()); + (fcd=getClass(baseName)) && fcd->isLinkable()); } bool MemberDef::hasDocumentation() const -{ - return Definition::hasDocumentation() || +{ + return Definition::hasDocumentation() || (m_impl->mtype==MemberType_Enumeration && m_impl->docEnumValues) || // has enum values (m_impl->defArgList!=0 && m_impl->defArgList->hasDocumentation()); // has doc arguments } @@ -3104,10 +3131,10 @@ void MemberDef::setMemberGroup(MemberGroup *grp) m_impl->memberGroup = grp; } -bool MemberDef::visibleMemberGroup(bool hideNoHeader) -{ - return m_impl->memberGroup!=0 && - (!hideNoHeader || m_impl->memberGroup->header()!="[NOHEADER]"); +bool MemberDef::visibleMemberGroup(bool hideNoHeader) +{ + return m_impl->memberGroup!=0 && + (!hideNoHeader || m_impl->memberGroup->header()!="[NOHEADER]"); } QCString MemberDef::getScopeString() const @@ -3152,17 +3179,17 @@ void MemberDef::setAnchor() // twice, which is silly, but we keep it this way for backward // compatibility. - // include number of template arguments as well, + // include number of template arguments as well, // to distinguish between two template // specializations that only differ in the template parameters. - if (m_impl->tArgList) + if (m_impl->tArgList) { char buf[20]; qsnprintf(buf,20,"%d:",m_impl->tArgList->count()); buf[19]='\0'; memAnchor.prepend(buf); } - + // convert to md5 hash uchar md5_sig[16]; QCString sigStr(33); @@ -3183,12 +3210,12 @@ void MemberDef::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, m_impl->groupStartLine=startLine; m_impl->groupHasDocs=hasDocs; m_impl->groupMember=member; - m_isLinkableCached = 0; + m_isLinkableCached = 0; } -void MemberDef::setEnumScope(MemberDef *md,bool livesInsideEnum) -{ - m_impl->enumScope=md; +void MemberDef::setEnumScope(MemberDef *md,bool livesInsideEnum) +{ + m_impl->enumScope=md; m_impl->livesInsideEnum=livesInsideEnum; if (md->getGroupDef()) { @@ -3197,22 +3224,22 @@ void MemberDef::setEnumScope(MemberDef *md,bool livesInsideEnum) m_impl->groupFileName=md->getGroupFileName(); m_impl->groupStartLine=md->getGroupStartLine(); m_impl->groupHasDocs=md->getGroupHasDocs(); - m_isLinkableCached = 0; + m_isLinkableCached = 0; } } -void MemberDef::setMemberClass(ClassDef *cd) -{ - m_impl->classDef=cd; - m_isLinkableCached = 0; - m_isConstructorCached = 0; - setOuterScope(cd); +void MemberDef::setMemberClass(ClassDef *cd) +{ + m_impl->classDef=cd; + m_isLinkableCached = 0; + m_isConstructorCached = 0; + setOuterScope(cd); } -void MemberDef::setNamespace(NamespaceDef *nd) -{ - m_impl->nspace=nd; - setOuterScope(nd); +void MemberDef::setNamespace(NamespaceDef *nd) +{ + m_impl->nspace=nd; + setOuterScope(nd); } MemberDef *MemberDef::createTemplateInstanceMember( @@ -3231,7 +3258,7 @@ MemberDef *MemberDef::createTemplateInstanceMember( { arg->type = substituteTemplateArgumentsInString(arg->type,formalArgs,actualArgs); } - actualArgList->trailingReturnType = + actualArgList->trailingReturnType = substituteTemplateArgumentsInString(actualArgList->trailingReturnType,formalArgs,actualArgs); } @@ -3243,9 +3270,9 @@ MemberDef *MemberDef::createTemplateInstanceMember( MemberDef *imd = new MemberDef( getDefFileName(),getDefLine(),getDefColumn(), - substituteTemplateArgumentsInString(m_impl->type,formalArgs,actualArgs), - methodName, - substituteTemplateArgumentsInString(m_impl->args,formalArgs,actualArgs), + substituteTemplateArgumentsInString(m_impl->type,formalArgs,actualArgs), + methodName, + substituteTemplateArgumentsInString(m_impl->args,formalArgs,actualArgs), m_impl->exception, m_impl->prot, m_impl->virt, m_impl->stat, m_impl->related, m_impl->mtype, 0, 0 ); @@ -3257,7 +3284,7 @@ MemberDef *MemberDef::createTemplateInstanceMember( // TODO: init other member variables (if needed). // TODO: reimplemented info - return imd; + return imd; } bool MemberDef::hasOneLineInitializer() const @@ -3273,15 +3300,15 @@ bool MemberDef::hasMultiLineInitializer() const { //printf("initLines=%d userInitLines=%d maxInitLines=%d\n", // initLines,userInitLines,maxInitLines); - return m_impl->initLines>0 && + return m_impl->initLines>0 && ((m_impl->initLinesmaxInitLines && m_impl->userInitLines==-1) // implicitly enabled || m_impl->initLinesuserInitLines // explicitly enabled ); } -void MemberDef::setInitializer(const char *initializer) -{ - m_impl->initializer=initializer; +void MemberDef::setInitializer(const char *initializer) +{ + m_impl->initializer=initializer; int l=m_impl->initializer.length(); int p=l-1; while (p>=0 && isspace((uchar)m_impl->initializer.at(p))) p--; @@ -3295,12 +3322,12 @@ void MemberDef::addListReference(Definition *) static bool optimizeOutputForC = Config_getBool("OPTIMIZE_OUTPUT_FOR_C"); //static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES"); //static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); - //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); + //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); SrcLangExt lang = getLanguage(); visited=TRUE; if (!isLinkableInProject()) return; QCString memLabel; - if (optimizeOutputForC) + if (optimizeOutputForC) { memLabel=theTranslator->trGlobal(TRUE,TRUE); } @@ -3314,11 +3341,11 @@ void MemberDef::addListReference(Definition *) } QCString memName = name(); Definition *pd=getOuterScope(); - QCString pdName = pd->definitionType()==Definition::TypeClass ? + QCString pdName = pd->definitionType()==Definition::TypeClass ? ((ClassDef*)pd)->displayName() : pd->name(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); QCString memArgs; - if (!isRelated() + if (!isRelated() /* && commented out as a result of bug 597016 ( (!hideScopeNames && // there is a scope @@ -3334,7 +3361,7 @@ void MemberDef::addListReference(Definition *) { memName = "[" + pd->name() + " " + name() + "]"; } - else + else { if (pd!=Doxygen::globalScope) memName.prepend(pdName+sep); memArgs = argsString(); @@ -3350,19 +3377,19 @@ void MemberDef::addListReference(Definition *) } } -MemberList *MemberDef::getSectionList(Definition *d) const -{ +MemberList *MemberDef::getSectionList(Definition *d) const +{ char key[20]; sprintf(key,"%p",d); return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0; } -void MemberDef::setSectionList(Definition *d, MemberList *sl) -{ +void MemberDef::setSectionList(Definition *d, MemberList *sl) +{ //printf("MemberDef::setSectionList(%p,%p) name=%s\n",d,sl,name().data()); char key[20]; sprintf(key,"%p",d); - if (m_impl->classSectionSDict==0) + if (m_impl->classSectionSDict==0) { m_impl->classSectionSDict = new SDict(7); } @@ -3371,7 +3398,7 @@ void MemberDef::setSectionList(Definition *d, MemberList *sl) Specifier MemberDef::virtualness(int count) const { - if (count>25) + if (count>25) { warn(getDefFileName(),getDefLine(), "Internal inconsistency: recursion detected in overload relation for member %s!" @@ -3390,7 +3417,7 @@ Specifier MemberDef::virtualness(int count) const } void MemberDef::_writeTagData(const DefType compoundType) -{ +{ unsigned typeMask = 1 << compoundType; if ((m_impl->tagDataWritten) & typeMask) return; // member already written for this type if (m_impl->mtype==MemberType_EnumValue && m_impl->enumScope && @@ -3422,13 +3449,13 @@ void MemberDef::_writeTagData(const DefType compoundType) Doxygen::tagFile << "\" protection=\""; if (m_impl->prot==Protected) Doxygen::tagFile << "protected"; else if (m_impl->prot==Package) Doxygen::tagFile << "package"; - else /* Private */ Doxygen::tagFile << "private"; + else /* Private */ Doxygen::tagFile << "private"; } if (m_impl->virt!=Normal) { Doxygen::tagFile << "\" virtualness=\""; if (m_impl->virt==Virtual) Doxygen::tagFile << "virtual"; - else /* Pure */ Doxygen::tagFile << "pure"; + else /* Pure */ Doxygen::tagFile << "pure"; } if (isStatic()) { @@ -3459,11 +3486,11 @@ void MemberDef::_writeTagData(const DefType compoundType) Doxygen::tagFile << " anchor()); QCString idStr = fmd->id(); - if (!idStr.isEmpty()) + if (!idStr.isEmpty()) { Doxygen::tagFile << "\" clangid=\"" << convertToXML(idStr); } - Doxygen::tagFile << "\">" << convertToXML(fmd->name()) << "" << endl; + Doxygen::tagFile << "\">" << convertToXML(fmd->name()) << "" << endl; } } } @@ -3478,7 +3505,7 @@ void MemberDef::_writeTagData(const DefType compoundType) void MemberDef::_computeIsConstructor() { m_isConstructorCached=1; // FALSE - if (m_impl->classDef) + if (m_impl->classDef) { if (m_impl->isDMember) // for D { @@ -3486,11 +3513,11 @@ void MemberDef::_computeIsConstructor() return; } else if (getLanguage()==SrcLangExt_PHP) // for PHP - { + { m_isConstructorCached = name()=="__construct" ? 2 : 1; return; } - else if (name()=="__init__" && + else if (name()=="__init__" && getLanguage()==SrcLangExt_Python) // for Python { m_isConstructorCached = 2; // TRUE @@ -3518,8 +3545,8 @@ void MemberDef::_computeIsConstructor() } } -bool MemberDef::isConstructor() const -{ +bool MemberDef::isConstructor() const +{ if (m_isConstructorCached==0) { MemberDef *that = (MemberDef*)this; @@ -3538,14 +3565,14 @@ void MemberDef::_computeIsDestructor() isDestructor = name()=="~this"; } else if (getLanguage()==SrcLangExt_PHP) // for PHP - { + { isDestructor = name()=="__destruct"; } else if (getLanguage()==SrcLangExt_Tcl) // for Tcl - { + { isDestructor = name()=="destructor"; } - else if (name()=="__del__" && + else if (name()=="__del__" && getLanguage()==SrcLangExt_Python) // for Python { isDestructor=TRUE; @@ -3554,13 +3581,13 @@ void MemberDef::_computeIsDestructor() { isDestructor = (name().find('~')!=-1 || name().find('!')!=-1) // The ! is for C++/CLI - && name().find("operator")==-1; + && name().find("operator")==-1; } m_isDestructorCached = isDestructor ? 2 : 1; } bool MemberDef::isDestructor() const -{ +{ if (m_isDestructorCached==0) { MemberDef *that=(MemberDef*)this; @@ -3571,7 +3598,7 @@ bool MemberDef::isDestructor() const } void MemberDef::writeEnumDeclaration(OutputList &typeDecl, - ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, const DefType compoundType) { int enumMemCount=0; @@ -3587,7 +3614,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, fmd=fmdl->next(); } } - if (numVisibleEnumValues==0 && !isBriefSectionVisible()) + if (numVisibleEnumValues==0 && !isBriefSectionVisible()) { return; } @@ -3638,7 +3665,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, typeDecl.pushGeneratorState(); typeDecl.disableAllBut(OutputGenerator::Html); typeDecl.enable(OutputGenerator::Latex); - typeDecl.lineBreak(); + typeDecl.lineBreak(); typeDecl.disable(OutputGenerator::Latex); typeDecl.writeString("  "); typeDecl.popGeneratorState(); @@ -3665,7 +3692,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, bool prevVisible = fmdVisible; fmd=fmdl->next(); - if (fmd && (fmdVisible=fmd->isBriefSectionVisible())) + if (fmd && (fmdVisible=fmd->isBriefSectionVisible())) { typeDecl.writeString(", "); } @@ -3681,7 +3708,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, { typeDecl.pushGeneratorState(); typeDecl.disableAllBut(OutputGenerator::Html); - typeDecl.lineBreak(); + typeDecl.lineBreak(); typeDecl.popGeneratorState(); } } @@ -3689,8 +3716,8 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, } } -void MemberDef::setArgumentList(ArgumentList *al) -{ +void MemberDef::setArgumentList(ArgumentList *al) +{ if (m_impl->defArgList) delete m_impl->defArgList; m_impl->defArgList = al; } @@ -3728,25 +3755,25 @@ void MemberDef::setAccessorType(ClassDef *cd,const char *t) void MemberDef::findSectionsInDocumentation() { - docFindSections(documentation(),this,0,docFile()); + docFindSections(documentation(),this,0,docFile()); } -void MemberDef::enableCallGraph(bool e) -{ - m_impl->hasCallGraph=e; +void MemberDef::enableCallGraph(bool e) +{ + m_impl->hasCallGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } -void MemberDef::enableCallerGraph(bool e) -{ - m_impl->hasCallerGraph=e; +void MemberDef::enableCallerGraph(bool e) +{ + m_impl->hasCallerGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } #if 0 bool MemberDef::protectionVisible() const { - return m_impl->prot==Public || + return m_impl->prot==Public || (m_impl->prot==Private && Config_getBool("EXTRACT_PRIVATE")) || (m_impl->prot==Protected && Config_getBool("EXTRACT_PROTECTED")) || (m_impl->prot==Package && Config_getBool("EXTRACT_PACKAGE")); @@ -3767,13 +3794,13 @@ void MemberDef::setInbodyDocumentation(const char *docs, bool MemberDef::isObjCMethod() const { if (m_impl->classDef && m_impl->classDef->isObjectiveC() && isFunction()) return TRUE; - return FALSE; + return FALSE; } bool MemberDef::isObjCProperty() const { if (m_impl->classDef && m_impl->classDef->isObjectiveC() && isProperty()) return TRUE; - return FALSE; + return FALSE; } QCString MemberDef::qualifiedName() const @@ -3797,7 +3824,7 @@ QCString MemberDef::qualifiedName() const else { return Definition::qualifiedName(); - } + } } void MemberDef::setTagInfo(TagInfo *ti) @@ -3829,12 +3856,12 @@ QCString MemberDef::objCMethodName(bool localLink,bool showStatic) const } const char *MemberDef::declaration() const -{ - return m_impl->decl; +{ + return m_impl->decl; } const char *MemberDef::definition() const -{ +{ return m_impl->def; } @@ -3844,133 +3871,133 @@ const char *MemberDef::extraTypeChars() const } const char *MemberDef::typeString() const -{ - return m_impl->type; +{ + return m_impl->type; } const char *MemberDef::argsString() const -{ - return m_impl->args; +{ + return m_impl->args; } const char *MemberDef::excpString() const -{ - return m_impl->exception; +{ + return m_impl->exception; } const char *MemberDef::bitfieldString() const -{ - return m_impl->bitfields; +{ + return m_impl->bitfields; } const QCString &MemberDef::initializer() const -{ - return m_impl->initializer; +{ + return m_impl->initializer; } int MemberDef::initializerLines() const -{ - return m_impl->initLines; +{ + return m_impl->initLines; } uint64 MemberDef::getMemberSpecifiers() const -{ - return m_impl->memSpec; +{ + return m_impl->memSpec; } ClassDef *MemberDef::getClassDef() const -{ - return m_impl->classDef; +{ + return m_impl->classDef; } FileDef *MemberDef::getFileDef() const -{ - return m_impl->fileDef; +{ + return m_impl->fileDef; } NamespaceDef* MemberDef::getNamespaceDef() const -{ - return m_impl->nspace; +{ + return m_impl->nspace; } const char *MemberDef::getReadAccessor() const -{ - return m_impl->read; +{ + return m_impl->read; } const char *MemberDef::getWriteAccessor() const -{ - return m_impl->write; +{ + return m_impl->write; } GroupDef *MemberDef::getGroupDef() const -{ - return m_impl->group; +{ + return m_impl->group; } Grouping::GroupPri_t MemberDef::getGroupPri() const -{ - return m_impl->grouppri; +{ + return m_impl->grouppri; } const char *MemberDef::getGroupFileName() const -{ - return m_impl->groupFileName; +{ + return m_impl->groupFileName; } int MemberDef::getGroupStartLine() const -{ - return m_impl->groupStartLine; +{ + return m_impl->groupStartLine; } bool MemberDef::getGroupHasDocs() const -{ - return m_impl->groupHasDocs; +{ + return m_impl->groupHasDocs; } Protection MemberDef::protection() const -{ - return m_impl->prot; +{ + return m_impl->prot; } MemberType MemberDef::memberType() const -{ - return m_impl->mtype; +{ + return m_impl->mtype; } bool MemberDef::isSignal() const -{ - return m_impl->mtype==MemberType_Signal; +{ + return m_impl->mtype==MemberType_Signal; } bool MemberDef::isSlot() const -{ - return m_impl->mtype==MemberType_Slot; +{ + return m_impl->mtype==MemberType_Slot; } bool MemberDef::isVariable() const -{ - return m_impl->mtype==MemberType_Variable; +{ + return m_impl->mtype==MemberType_Variable; } bool MemberDef::isEnumerate() const -{ - return m_impl->mtype==MemberType_Enumeration; +{ + return m_impl->mtype==MemberType_Enumeration; } bool MemberDef::isEnumValue() const -{ - return m_impl->mtype==MemberType_EnumValue; +{ + return m_impl->mtype==MemberType_EnumValue; } bool MemberDef::isTypedef() const -{ - return m_impl->mtype==MemberType_Typedef; +{ + return m_impl->mtype==MemberType_Typedef; } bool MemberDef::isFunction() const -{ - return m_impl->mtype==MemberType_Function; +{ + return m_impl->mtype==MemberType_Function; } bool MemberDef::isFunctionPtr() const @@ -3979,175 +4006,175 @@ bool MemberDef::isFunctionPtr() const } bool MemberDef::isDefine() const -{ - return m_impl->mtype==MemberType_Define; +{ + return m_impl->mtype==MemberType_Define; } bool MemberDef::isFriend() const -{ - return m_impl->mtype==MemberType_Friend; +{ + return m_impl->mtype==MemberType_Friend; } bool MemberDef::isDCOP() const -{ - return m_impl->mtype==MemberType_DCOP; +{ + return m_impl->mtype==MemberType_DCOP; } bool MemberDef::isProperty() const -{ - return m_impl->mtype==MemberType_Property; +{ + return m_impl->mtype==MemberType_Property; } bool MemberDef::isEvent() const -{ - return m_impl->mtype==MemberType_Event; +{ + return m_impl->mtype==MemberType_Event; } bool MemberDef::isRelated() const -{ +{ return m_impl->related == Related; } bool MemberDef::isForeign() const -{ - return m_impl->related == Foreign; +{ + return m_impl->related == Foreign; } bool MemberDef::isStatic() const -{ - return m_impl->stat; +{ + return m_impl->stat; } bool MemberDef::isInline() const -{ - return (m_impl->memSpec&Entry::Inline)!=0; +{ + return (m_impl->memSpec&Entry::Inline)!=0; } bool MemberDef::isExplicit() const -{ - return (m_impl->memSpec&Entry::Explicit)!=0; +{ + return (m_impl->memSpec&Entry::Explicit)!=0; } bool MemberDef::isMutable() const -{ - return (m_impl->memSpec&Entry::Mutable)!=0; +{ + return (m_impl->memSpec&Entry::Mutable)!=0; } bool MemberDef::isGettable() const -{ - return (m_impl->memSpec&Entry::Gettable)!=0; +{ + return (m_impl->memSpec&Entry::Gettable)!=0; } bool MemberDef::isSettable() const -{ - return (m_impl->memSpec&Entry::Settable)!=0; +{ + return (m_impl->memSpec&Entry::Settable)!=0; } bool MemberDef::isAddable() const -{ - return (m_impl->memSpec&Entry::Addable)!=0; +{ + return (m_impl->memSpec&Entry::Addable)!=0; } bool MemberDef::isRemovable() const -{ - return (m_impl->memSpec&Entry::Removable)!=0; +{ + return (m_impl->memSpec&Entry::Removable)!=0; } bool MemberDef::isRaisable() const -{ - return (m_impl->memSpec&Entry::Raisable)!=0; +{ + return (m_impl->memSpec&Entry::Raisable)!=0; } bool MemberDef::isReadable() const -{ - return (m_impl->memSpec&Entry::Readable)!=0; +{ + return (m_impl->memSpec&Entry::Readable)!=0; } bool MemberDef::isWritable() const -{ - return (m_impl->memSpec&Entry::Writable)!=0; +{ + return (m_impl->memSpec&Entry::Writable)!=0; } bool MemberDef::isFinal() const -{ - return (m_impl->memSpec&Entry::Final)!=0; +{ + return (m_impl->memSpec&Entry::Final)!=0; } bool MemberDef::isNew() const -{ - return (m_impl->memSpec&Entry::New)!=0; +{ + return (m_impl->memSpec&Entry::New)!=0; } bool MemberDef::isSealed() const -{ - return (m_impl->memSpec&Entry::Sealed)!=0; +{ + return (m_impl->memSpec&Entry::Sealed)!=0; } bool MemberDef::isOverride() const -{ - return (m_impl->memSpec&Entry::Override)!=0; +{ + return (m_impl->memSpec&Entry::Override)!=0; } bool MemberDef::isInitonly() const -{ - return (m_impl->memSpec&Entry::Initonly)!=0; +{ + return (m_impl->memSpec&Entry::Initonly)!=0; } bool MemberDef::isAbstract() const -{ - return (m_impl->memSpec&Entry::Abstract)!=0; +{ + return (m_impl->memSpec&Entry::Abstract)!=0; } bool MemberDef::isOptional() const -{ - return (m_impl->memSpec&Entry::Optional)!=0; +{ + return (m_impl->memSpec&Entry::Optional)!=0; } bool MemberDef::isRequired() const -{ - return (m_impl->memSpec&Entry::Required)!=0; +{ + return (m_impl->memSpec&Entry::Required)!=0; } bool MemberDef::isNonAtomic() const -{ - return (m_impl->memSpec&Entry::NonAtomic)!=0; +{ + return (m_impl->memSpec&Entry::NonAtomic)!=0; } bool MemberDef::isCopy() const -{ - return (m_impl->memSpec&Entry::Copy)!=0; +{ + return (m_impl->memSpec&Entry::Copy)!=0; } bool MemberDef::isAssign() const -{ - return (m_impl->memSpec&Entry::Assign)!=0; +{ + return (m_impl->memSpec&Entry::Assign)!=0; } bool MemberDef::isRetain() const -{ - return (m_impl->memSpec&Entry::Retain)!=0; +{ + return (m_impl->memSpec&Entry::Retain)!=0; } bool MemberDef::isWeak() const { - return (m_impl->memSpec&Entry::Weak)!=0; + return (m_impl->memSpec&Entry::Weak)!=0; } bool MemberDef::isStrong() const { - return (m_impl->memSpec&Entry::Strong)!=0; + return (m_impl->memSpec&Entry::Strong)!=0; } bool MemberDef::isStrongEnumValue() const { return m_impl->mtype==MemberType_EnumValue && - m_impl->enumScope && + m_impl->enumScope && m_impl->enumScope->isStrong(); } bool MemberDef::isUnretained() const { - return (m_impl->memSpec&Entry::Unretained)!=0; + return (m_impl->memSpec&Entry::Unretained)!=0; } bool MemberDef::isAlias() const @@ -4222,356 +4249,356 @@ bool MemberDef::isPublished() const bool MemberDef::isImplementation() const -{ - return m_impl->implOnly; +{ + return m_impl->implOnly; } bool MemberDef::isExternal() const -{ - return m_impl->explExt; +{ + return m_impl->explExt; } bool MemberDef::isTemplateSpecialization() const -{ - return m_impl->tspec; +{ + return m_impl->tspec; } bool MemberDef::hasDocumentedParams() const -{ - return m_impl->hasDocumentedParams; +{ + return m_impl->hasDocumentedParams; } bool MemberDef::hasDocumentedReturnType() const -{ - return m_impl->hasDocumentedReturnType; +{ + return m_impl->hasDocumentedReturnType; } bool MemberDef::showInCallGraph() const { - return isFunction() || - isSlot() || + return isFunction() || + isSlot() || isConstructor() || - isDestructor() || + isDestructor() || isObjCMethod(); } ClassDef *MemberDef::relatedAlso() const -{ - return m_impl->relatedAlso; +{ + return m_impl->relatedAlso; } bool MemberDef::hasDocumentedEnumValues() const -{ - return m_impl->docEnumValues; +{ + return m_impl->docEnumValues; } MemberDef *MemberDef::getAnonymousEnumType() const -{ - return m_impl->annEnumType; +{ + return m_impl->annEnumType; } bool MemberDef::isDocsForDefinition() const -{ - return m_impl->docsForDefinition; +{ + return m_impl->docsForDefinition; } MemberDef *MemberDef::getEnumScope() const -{ - return m_impl->enumScope; +{ + return m_impl->enumScope; } MemberList *MemberDef::enumFieldList() const -{ - return m_impl->enumFields; +{ + return m_impl->enumFields; } ExampleSDict *MemberDef::getExamples() const -{ - return m_impl->exampleSDict; +{ + return m_impl->exampleSDict; } bool MemberDef::isPrototype() const -{ - return m_impl->proto; +{ + return m_impl->proto; } ArgumentList *MemberDef::argumentList() const -{ - return m_impl->defArgList; +{ + return m_impl->defArgList; } ArgumentList *MemberDef::declArgumentList() const -{ - return m_impl->declArgList; +{ + return m_impl->declArgList; } ArgumentList *MemberDef::templateArguments() const -{ - return m_impl->tArgList; +{ + return m_impl->tArgList; } QList *MemberDef::definitionTemplateParameterLists() const -{ - return m_impl->defTmpArgLists; +{ + return m_impl->defTmpArgLists; } int MemberDef::getMemberGroupId() const -{ - return m_impl->grpId; +{ + return m_impl->grpId; } MemberGroup *MemberDef::getMemberGroup() const -{ - return m_impl->memberGroup; +{ + return m_impl->memberGroup; } bool MemberDef::fromAnonymousScope() const -{ - return m_impl->annScope; +{ + return m_impl->annScope; } bool MemberDef::anonymousDeclShown() const -{ - return m_impl->annUsed; +{ + return m_impl->annUsed; } -void MemberDef::setAnonymousUsed() +void MemberDef::setAnonymousUsed() { m_impl->annUsed = TRUE; } bool MemberDef::hasCallGraph() const -{ - return m_impl->hasCallGraph; +{ + return m_impl->hasCallGraph; } bool MemberDef::hasCallerGraph() const -{ - return m_impl->hasCallerGraph; +{ + return m_impl->hasCallerGraph; } MemberDef *MemberDef::templateMaster() const -{ - return m_impl->templateMaster; +{ + return m_impl->templateMaster; } bool MemberDef::isTypedefValCached() const -{ - return m_impl->isTypedefValCached; +{ + return m_impl->isTypedefValCached; } ClassDef *MemberDef::getCachedTypedefVal() const -{ - return m_impl->cachedTypedefValue; +{ + return m_impl->cachedTypedefValue; } QCString MemberDef::getCachedTypedefTemplSpec() const -{ - return m_impl->cachedTypedefTemplSpec; +{ + return m_impl->cachedTypedefTemplSpec; } QCString MemberDef::getCachedResolvedTypedef() const -{ +{ //printf("MemberDef::getCachedResolvedTypedef()=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); - return m_impl->cachedResolvedType; + return m_impl->cachedResolvedType; } MemberDef *MemberDef::memberDefinition() const -{ - return m_impl->memDef; +{ + return m_impl->memDef; } MemberDef *MemberDef::memberDeclaration() const -{ - return m_impl->memDec; +{ + return m_impl->memDec; } MemberDef *MemberDef::inheritsDocsFrom() const -{ - return m_impl->docProvider; +{ + return m_impl->docProvider; } MemberDef *MemberDef::getGroupAlias() const -{ - return m_impl->groupAlias; +{ + return m_impl->groupAlias; } void MemberDef::setMemberType(MemberType t) -{ - m_impl->mtype=t; +{ + m_impl->mtype=t; m_isLinkableCached = 0; } void MemberDef::setDefinition(const char *d) -{ - m_impl->def=d; +{ + m_impl->def=d; } void MemberDef::setFileDef(FileDef *fd) -{ - m_impl->fileDef=fd; +{ + m_impl->fileDef=fd; m_isLinkableCached = 0; m_isConstructorCached = 0; m_isDestructorCached = 0; } void MemberDef::setProtection(Protection p) -{ - m_impl->prot=p; +{ + m_impl->prot=p; m_isLinkableCached = 0; } void MemberDef::setMemberSpecifiers(uint64 s) -{ - m_impl->memSpec=s; +{ + m_impl->memSpec=s; } void MemberDef::mergeMemberSpecifiers(uint64 s) -{ - m_impl->memSpec|=s; +{ + m_impl->memSpec|=s; } void MemberDef::setBitfields(const char *s) -{ - m_impl->bitfields = s; +{ + m_impl->bitfields = QCString(s).simplifyWhiteSpace(); } void MemberDef::setMaxInitLines(int lines) -{ +{ if (lines!=-1) { - m_impl->userInitLines=lines; + m_impl->userInitLines=lines; } } void MemberDef::setExplicitExternal(bool b) -{ - m_impl->explExt=b; +{ + m_impl->explExt=b; } void MemberDef::setReadAccessor(const char *r) -{ - m_impl->read=r; +{ + m_impl->read=r; } void MemberDef::setWriteAccessor(const char *w) -{ - m_impl->write=w; +{ + m_impl->write=w; } void MemberDef::setTemplateSpecialization(bool b) -{ - m_impl->tspec=b; +{ + m_impl->tspec=b; } void MemberDef::makeRelated() -{ - m_impl->related = Related; +{ + m_impl->related = Related; m_isLinkableCached = 0; } void MemberDef::makeForeign() -{ - m_impl->related = Foreign; +{ + m_impl->related = Foreign; m_isLinkableCached = 0; } void MemberDef::setHasDocumentedParams(bool b) -{ - m_impl->hasDocumentedParams = b; +{ + m_impl->hasDocumentedParams = b; } void MemberDef::setHasDocumentedReturnType(bool b) -{ - m_impl->hasDocumentedReturnType = b; +{ + m_impl->hasDocumentedReturnType = b; } void MemberDef::setInheritsDocsFrom(MemberDef *md) -{ - m_impl->docProvider = md; +{ + m_impl->docProvider = md; } void MemberDef::setArgsString(const char *as) -{ - m_impl->args = as; +{ + m_impl->args = as; } void MemberDef::setRelatedAlso(ClassDef *cd) -{ - m_impl->relatedAlso=cd; +{ + m_impl->relatedAlso=cd; } void MemberDef::setEnumClassScope(ClassDef *cd) -{ - m_impl->classDef = cd; - m_isLinkableCached = 0; - m_isConstructorCached = 0; +{ + m_impl->classDef = cd; + m_isLinkableCached = 0; + m_isConstructorCached = 0; } void MemberDef::setDocumentedEnumValues(bool value) -{ - m_impl->docEnumValues=value; +{ + m_impl->docEnumValues=value; } void MemberDef::setAnonymousEnumType(MemberDef *md) -{ - m_impl->annEnumType = md; +{ + m_impl->annEnumType = md; } void MemberDef::setPrototype(bool p) -{ - m_impl->proto=p; +{ + m_impl->proto=p; } void MemberDef::setMemberGroupId(int id) -{ - m_impl->grpId=id; +{ + m_impl->grpId=id; } void MemberDef::makeImplementationDetail() -{ - m_impl->implOnly=TRUE; +{ + m_impl->implOnly=TRUE; } void MemberDef::setFromAnonymousScope(bool b) -{ - m_impl->annScope=b; +{ + m_impl->annScope=b; } void MemberDef::setFromAnonymousMember(MemberDef *m) -{ - m_impl->annMemb=m; +{ + m_impl->annMemb=m; } void MemberDef::setTemplateMaster(MemberDef *mt) -{ - m_impl->templateMaster=mt; - m_isLinkableCached = 0; +{ + m_impl->templateMaster=mt; + m_isLinkableCached = 0; } void MemberDef::setDocsForDefinition(bool b) -{ - m_impl->docsForDefinition = b; +{ + m_impl->docsForDefinition = b; } void MemberDef::setGroupAlias(MemberDef *md) -{ - m_impl->groupAlias = md; +{ + m_impl->groupAlias = md; } void MemberDef::invalidateTypedefValCache() -{ - m_impl->isTypedefValCached=FALSE; +{ + m_impl->isTypedefValCached=FALSE; } void MemberDef::setMemberDefinition(MemberDef *md) -{ - m_impl->memDef=md; +{ + m_impl->memDef=md; } void MemberDef::setMemberDeclaration(MemberDef *md) -{ - m_impl->memDec=md; +{ + m_impl->memDec=md; } ClassDef *MemberDef::category() const @@ -4607,9 +4634,9 @@ QCString MemberDef::enumBaseType() const void MemberDef::cacheTypedefVal(ClassDef*val, const QCString & templSpec, const QCString &resolvedType) { - m_impl->isTypedefValCached=TRUE; - m_impl->cachedTypedefValue=val; - m_impl->cachedTypedefTemplSpec=templSpec; + m_impl->isTypedefValCached=TRUE; + m_impl->cachedTypedefValue=val; + m_impl->cachedTypedefTemplSpec=templSpec; m_impl->cachedResolvedType=resolvedType; //printf("MemberDef::cacheTypedefVal=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); } @@ -4665,9 +4692,9 @@ void MemberDef::invalidateCachedArgumentTypes() //---------------- -QCString MemberDef::displayName(bool) const -{ - return Definition::name(); +QCString MemberDef::displayName(bool) const +{ + return Definition::name(); } void MemberDef::_addToSearchIndex() diff --git a/src/memberdef.h b/src/memberdef.h index fc2bb44..bb6fb0e 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -241,6 +241,7 @@ class MemberDef : public Definition MemberDef *categoryRelation() const; QCString displayName(bool=TRUE) const; + QCString getDeclType() const; //----------------------------------------------------------------------------------- // ---- setters ----- diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index b0ba6b4..81b9a51 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -115,14 +115,15 @@ void NamespaceDef::findSectionsInDocumentation() } } -void NamespaceDef::insertUsedFile(const char *f) +void NamespaceDef::insertUsedFile(FileDef *fd) { - if (files.find(f)==-1) + if (fd==0) return; + if (files.find(fd)==-1) { if (Config_getBool("SORT_MEMBER_DOCS")) - files.inSort(f); + files.inSort(fd); else - files.append(f); + files.append(fd); } } diff --git a/src/namespacedef.h b/src/namespacedef.h index 06d9d1d..2037d23 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -22,6 +22,7 @@ #include #include "sortdict.h" #include "definition.h" +#include "filedef.h" class MemberList; class ClassDef; @@ -45,7 +46,7 @@ class NamespaceDef : public Definition DefType definitionType() const { return TypeNamespace; } QCString getOutputFileBase() const; QCString anchor() const { return QCString(); } - void insertUsedFile(const char *fname); + void insertUsedFile(FileDef *fd); void writeDocumentation(OutputList &ol); void writeMemberPages(OutputList &ol); @@ -117,7 +118,7 @@ class NamespaceDef : public Definition void addNamespaceAttributes(OutputList &ol); QCString fileName; - QStrList files; + FileList files; NamespaceSDict *usingDirList; SDict *usingDeclList; diff --git a/src/template.cpp b/src/template.cpp index 3c60304..bc564cc 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -36,7 +36,7 @@ static QValueList split(const QCString &str,const QCString &sep,bool a int j = 0; int i = str.find( sep, j ); - while (i!=-1) + while (i!=-1) { if ( str.mid(j,i-j).length() > 0 ) { @@ -109,58 +109,60 @@ class TemplateVariant::Private bool raw; }; -TemplateVariant::TemplateVariant() -{ +TemplateVariant::TemplateVariant() +{ p = new Private; p->type=None; } TemplateVariant::TemplateVariant(bool b) -{ +{ p = new Private; - p->type = Bool; - p->boolVal = b; + p->type = Bool; + p->boolVal = b; } -TemplateVariant::TemplateVariant(int v) -{ +TemplateVariant::TemplateVariant(int v) +{ p = new Private; - p->type = Integer; - p->intVal = v; + p->type = Integer; + p->intVal = v; } -TemplateVariant::TemplateVariant(const char *s) -{ +TemplateVariant::TemplateVariant(const char *s,bool raw) +{ p = new Private; - p->type = String; - p->strVal = s; + p->type = String; + p->strVal = s; + p->raw = raw; } -TemplateVariant::TemplateVariant(const QCString &s) -{ +TemplateVariant::TemplateVariant(const QCString &s,bool raw) +{ p = new Private; - p->type = String; - p->strVal = s; + p->type = String; + p->strVal = s; + p->raw = raw; } TemplateVariant::TemplateVariant(const TemplateStructIntf *s) -{ +{ p = new Private; - p->type = Struct; + p->type = Struct; p->strukt = s; } TemplateVariant::TemplateVariant(const TemplateListIntf *l) -{ +{ p = new Private; - p->type = List; - p->list = l; + p->type = List; + p->list = l; } TemplateVariant::TemplateVariant(const void *obj,FuncType f) -{ +{ p = new Private; - p->type = Function; - p->func = f; + p->type = Function; + p->func = f; p->obj = obj; } @@ -169,7 +171,7 @@ TemplateVariant::~TemplateVariant() delete p; } -TemplateVariant::TemplateVariant(const TemplateVariant &v) +TemplateVariant::TemplateVariant(const TemplateVariant &v) { p = new Private; p->type = v.p->type; @@ -182,13 +184,13 @@ TemplateVariant::TemplateVariant(const TemplateVariant &v) case String: p->strVal = v.p->strVal; break; case Struct: p->strukt = v.p->strukt; break; case List: p->list = v.p->list; break; - case Function: p->func = v.p->func; + case Function: p->func = v.p->func; p->obj = v.p->obj; break; } } -TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) -{ +TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) +{ p->type = v.p->type; p->raw = v.p->raw; switch (p->type) @@ -199,10 +201,10 @@ TemplateVariant &TemplateVariant::operator=(const TemplateVariant &v) case String: p->strVal = v.p->strVal; break; case Struct: p->strukt = v.p->strukt; break; case List: p->list = v.p->list; break; - case Function: p->func = v.p->func; + case Function: p->func = v.p->func; p->obj = v.p->obj; break; } - return *this; + return *this; } QCString TemplateVariant::toString() const @@ -301,17 +303,17 @@ const TemplateListIntf *TemplateVariant::toList() const return p->type==List ? p->list : 0; } -QCString TemplateVariant::call(const QValueList &args) +TemplateVariant TemplateVariant::call(const QValueList &args) { if (p->type==Function) return p->func(p->obj,args); - return QCString(); + return TemplateVariant(); } bool TemplateVariant::operator==(TemplateVariant &other) { - if (p->type==None) + if (p->type==None) { - return FALSE; + return FALSE; } if (p->type==TemplateVariant::List && other.p->type==TemplateVariant::List) { @@ -327,14 +329,14 @@ bool TemplateVariant::operator==(TemplateVariant &other) } } -TemplateVariant::Type TemplateVariant::type() const -{ - return p->type; +TemplateVariant::Type TemplateVariant::type() const +{ + return p->type; } -bool TemplateVariant::isValid() const -{ - return p->type!=None; +bool TemplateVariant::isValid() const +{ + return p->type!=None; } void TemplateVariant::setRaw(bool b) @@ -427,7 +429,7 @@ class TemplateListConstIterator : public TemplateListIntf::ConstIterator public: TemplateListConstIterator(const TemplateList &l) : m_list(l) { m_index=-1; } virtual ~TemplateListConstIterator() {} - virtual void toFirst() + virtual void toFirst() { m_it = m_list.p->elems.begin(); m_index=0; @@ -507,11 +509,12 @@ class Operator ==, !=, <, >, <=, >= | : + , */ enum Type { - Or, And, Not, In, Equal, NotEqual, Less, Greater, LessEqual, - GreaterEqual, Filter, Colon, Last + Or, And, Not, In, Equal, NotEqual, Less, Greater, LessEqual, + GreaterEqual, Filter, Colon, Comma, Last }; static const char *toString(Type op) @@ -530,6 +533,7 @@ class Operator case GreaterEqual: return ">="; case Filter: return "|"; case Colon: return ":"; + case Comma: return ","; case Last: return "?"; } return "?"; @@ -556,24 +560,26 @@ class TemplateBlockContext }; -/** @brief Internal class representing the implementation of a template +/** @brief Internal class representing the implementation of a template * context */ class TemplateContextImpl : public TemplateContext { public: TemplateContextImpl(); virtual ~TemplateContextImpl(); - + // TemplateContext methods void push(); void pop(); void set(const char *name,const TemplateVariant &v); TemplateVariant get(const QCString &name) const; const TemplateVariant *getRef(const QCString &name) const; - void setOutputDirectory(const QCString &dir) + void setOutputDirectory(const QCString &dir) { m_outputDir = dir; } void setEscapeIntf(TemplateEscapeIntf *intf) { m_escapeIntf = intf; } + void setSpacelessIntf(TemplateSpacelessIntf *intf) + { m_spacelessIntf = intf; } // internal methods TemplateBlockContext *blockContext(); @@ -584,6 +590,9 @@ class TemplateContextImpl : public TemplateContext int line() const { return m_line; } QCString outputDirectory() const { return m_outputDir; } TemplateEscapeIntf *escapeIntf() const { return m_escapeIntf; } + TemplateSpacelessIntf *spacelessIntf() const { return m_spacelessIntf; } + void enableSpaceless(bool b) { m_spacelessEnabled=b; } + bool spacelessEnabled() const { return m_spacelessEnabled && m_spacelessIntf; } private: QCString m_templateName; @@ -592,6 +601,8 @@ class TemplateContextImpl : public TemplateContext QList< QDict > m_contextStack; TemplateBlockContext m_blockContext; TemplateEscapeIntf *m_escapeIntf; + TemplateSpacelessIntf *m_spacelessIntf; + bool m_spacelessEnabled; }; //----------------------------------------------------------------------------- @@ -802,15 +813,15 @@ static TemplateFilterFactory::AutoRegister fAdd("add"); static TemplateFilterFactory::AutoRegister fPrepend("prepend"); static TemplateFilterFactory::AutoRegister fLength("length"); static TemplateFilterFactory::AutoRegister fDefault("default"); -static TemplateFilterFactory::AutoRegister fStripPath("strippath"); +static TemplateFilterFactory::AutoRegister fStripPath("stripPath"); static TemplateFilterFactory::AutoRegister fNoWrap("nowrap"); //-------------------------------------------------------------------- -/** @brief Base class for all nodes in the abstract syntax tree of an - * expression. +/** @brief Base class for all nodes in the abstract syntax tree of an + * expression. */ -class ExprAst +class ExprAst { public: virtual ~ExprAst() {} @@ -821,7 +832,7 @@ class ExprAst class ExprAstNumber : public ExprAst { public: - ExprAstNumber(int num) : m_number(num) + ExprAstNumber(int num) : m_number(num) { TRACE(("ExprAstNumber(%d)\n",num)); } int number() const { return m_number; } virtual TemplateVariant resolve(TemplateContext *) { return TemplateVariant(m_number); } @@ -833,13 +844,13 @@ class ExprAstNumber : public ExprAst class ExprAstVariable : public ExprAst { public: - ExprAstVariable(const char *name) : m_name(name) + ExprAstVariable(const char *name) : m_name(name) { TRACE(("ExprAstVariable(%s)\n",name)); } const QCString &name() const { return m_name; } - virtual TemplateVariant resolve(TemplateContext *c) - { + virtual TemplateVariant resolve(TemplateContext *c) + { TemplateContextImpl *ci = dynamic_cast(c); - TemplateVariant v = c->get(m_name); + TemplateVariant v = c->get(m_name); if (!v.isValid()) { warn(ci->templateName(),ci->line(),"undefined variable '%s' in expression",m_name.data()); @@ -850,6 +861,34 @@ class ExprAstVariable : public ExprAst QCString m_name; }; +class ExprAstFunctionVariable : public ExprAst +{ + public: + ExprAstFunctionVariable(ExprAst *var,const QList &args) + : m_var(var), m_args(args) + { TRACE(("ExprAstFunctionVariable(%s)\n",var->name().data())); + m_args.setAutoDelete(TRUE); + } + virtual TemplateVariant resolve(TemplateContext *c) + { + QValueList args; + for (uint i=0;iresolve(c); + args.append(v); + } + TemplateVariant v = m_var->resolve(c); + if (v.type()==TemplateVariant::Function) + { + v = v.call(args); + } + return v; + } + private: + ExprAst *m_var; + QList m_args; +}; + /** @brief Class representing a filter in the AST */ class ExprAstFilter : public ExprAst { @@ -882,11 +921,11 @@ class ExprAstFilterAppl : public ExprAst { public: ExprAstFilterAppl(ExprAst *expr,ExprAstFilter *filter) - : m_expr(expr), m_filter(filter) + : m_expr(expr), m_filter(filter) { TRACE(("ExprAstFilterAppl\n")); } ~ExprAstFilterAppl() { delete m_expr; delete m_filter; } - virtual TemplateVariant resolve(TemplateContext *c) - { + virtual TemplateVariant resolve(TemplateContext *c) + { return m_filter->apply(m_expr->resolve(c),c); } private: @@ -898,7 +937,7 @@ class ExprAstFilterAppl : public ExprAst class ExprAstLiteral : public ExprAst { public: - ExprAstLiteral(const char *lit) : m_literal(lit) + ExprAstLiteral(const char *lit) : m_literal(lit) { TRACE(("ExprAstLiteral(%s)\n",lit)); } const QCString &literal() const { return m_literal; } virtual TemplateVariant resolve(TemplateContext *) { return TemplateVariant(m_literal); } @@ -910,10 +949,10 @@ class ExprAstLiteral : public ExprAst class ExprAstNegate : public ExprAst { public: - ExprAstNegate(ExprAst *expr) : m_expr(expr) + ExprAstNegate(ExprAst *expr) : m_expr(expr) { TRACE(("ExprAstNegate\n")); } ~ExprAstNegate() { delete m_expr; } - virtual TemplateVariant resolve(TemplateContext *c) + virtual TemplateVariant resolve(TemplateContext *c) { return TemplateVariant(!m_expr->resolve(c).toBool()); } private: ExprAst *m_expr; @@ -924,10 +963,10 @@ class ExprAstBinary : public ExprAst { public: ExprAstBinary(Operator::Type op,ExprAst *lhs,ExprAst *rhs) - : m_operator(op), m_lhs(lhs), m_rhs(rhs) + : m_operator(op), m_lhs(lhs), m_rhs(rhs) { TRACE(("ExprAstBinary %s\n",Operator::toString(op))); } ~ExprAstBinary() { delete m_lhs; delete m_rhs; } - virtual TemplateVariant resolve(TemplateContext *c) + virtual TemplateVariant resolve(TemplateContext *c) { TemplateVariant lhs = m_lhs->resolve(c); TemplateVariant rhs = m_rhs ? m_rhs->resolve(c) : TemplateVariant(); @@ -994,11 +1033,11 @@ class ExprAstBinary : public ExprAst class ExpressionParser { public: - ExpressionParser(const QCString &templateName,int line) - : m_templateName(templateName), m_line(line), m_tokenStream(0) + ExpressionParser(const QCString &templateName,int line) + : m_templateName(templateName), m_line(line), m_tokenStream(0) { } - virtual ~ExpressionParser() + virtual ~ExpressionParser() { } @@ -1050,7 +1089,7 @@ class ExpressionParser { TRACE(("{parseOrExpression(%s)\n",m_tokenStream)); ExprAst *lhs = parseAndExpression(); - if (lhs) + if (lhs) { while (m_curToken.type==ExprToken::Operator && m_curToken.op==Operator::Or) @@ -1068,7 +1107,7 @@ class ExpressionParser { TRACE(("{parseAndExpression(%s)\n",m_tokenStream)); ExprAst *lhs = parseNotExpression(); - if (lhs) + if (lhs) { while (m_curToken.type==ExprToken::Operator && m_curToken.op==Operator::And) @@ -1189,11 +1228,38 @@ class ExpressionParser return lit; } + ExprAst *parseIdentifierOptionalArgs() + { + TRACE(("{parseIdentifierOptionalArgs(%s)\n",m_curToken.id.data())); + ExprAst *expr = parseIdentifier(); + if (expr) + { + if (m_curToken.type==ExprToken::Operator && + m_curToken.op==Operator::Colon) + { + getNextToken(); + ExprAst *argExpr = parsePrimaryExpression(); + QList args; + args.append(argExpr); + while (m_curToken.type==ExprToken::Operator && + m_curToken.op==Operator::Comma) + { + getNextToken(); + argExpr = parsePrimaryExpression(); + args.append(argExpr); + } + expr = new ExprAstFunctionVariable(expr,args); + } + } + TRACE(("}parseIdentifierOptionalArgs()\n")); + return expr; + } + ExprAst *parseFilteredVariable() { TRACE(("{parseFilteredVariable()\n")); - ExprAst *expr = parseIdentifier(); - if (expr) + ExprAst *expr = parseIdentifierOptionalArgs(); + if (expr) { while (m_curToken.type==ExprToken::Operator && m_curToken.op==Operator::Filter) @@ -1300,6 +1366,12 @@ class ExpressionParser m_curToken.op = Operator::Colon; p++; } + else if (c==',') + { + m_curToken.type = ExprToken::Operator; + m_curToken.op = Operator::Comma; + p++; + } else if ((c=='-' && *(p+1)>='0' && *(p+1)<='9') || (c>='0' && c<='9')) { m_curToken.type = ExprToken::Number; @@ -1321,17 +1393,17 @@ class ExpressionParser s[0]=c; m_curToken.id = s; p++; - while ((c=*p) && + while ((c=*p) && (c=='_' || c=='.' || - (c>='a' && c<='z') || - (c>='A' && c<='Z') || + (c>='a' && c<='z') || + (c>='A' && c<='Z') || (c>='0' && c<='9')) ) { s[0]=c; m_curToken.id+=s; p++; - } + } } else if (c=='"' || c=='\'') { @@ -1470,9 +1542,10 @@ class TemplateImpl : public TemplateNode, public Template //---------------------------------------------------------- -TemplateContextImpl::TemplateContextImpl() - : m_templateName(""), m_line(1), m_escapeIntf(0) -{ +TemplateContextImpl::TemplateContextImpl() + : m_templateName(""), m_line(1), m_escapeIntf(0), + m_spacelessIntf(0), m_spacelessEnabled(FALSE) +{ m_contextStack.setAutoDelete(TRUE); push(); } @@ -1497,7 +1570,7 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const int i=name.find('.'); if (i==-1) // simple name { - return getPrimary(name); + return getPrimary(name); } else // obj.prop { @@ -1576,7 +1649,7 @@ const TemplateVariant *TemplateContextImpl::getRef(const QCString &name) const TemplateVariant TemplateContextImpl::getPrimary(const QCString &name) const { const TemplateVariant *v = getRef(name); - return v ? *v : TemplateVariant(); + return v ? *v : TemplateVariant(); } void TemplateContextImpl::push() @@ -1605,16 +1678,24 @@ TemplateBlockContext *TemplateContextImpl::blockContext() class TemplateNodeText : public TemplateNode { public: - TemplateNodeText(TemplateParser *,TemplateNode *parent,int,const QCString &data) - : TemplateNode(parent), m_data(data) + TemplateNodeText(TemplateParser *,TemplateNode *parent,int,const QCString &data) + : TemplateNode(parent), m_data(data) { TRACE(("TemplateNodeText('%s')\n",replace(data,'\n',' ').data())); } - void render(FTextStream &ts, TemplateContext *) + void render(FTextStream &ts, TemplateContext *c) { //printf("TemplateNodeText::render(%s)\n",m_data.data()); - ts << m_data; + TemplateContextImpl* ci = dynamic_cast(c); + if (ci->spacelessEnabled()) + { + ts << ci->spacelessIntf()->remove(m_data); + } + else + { + ts << m_data; + } } private: QCString m_data; @@ -1626,30 +1707,12 @@ class TemplateNodeText : public TemplateNode class TemplateNodeVariable : public TemplateNode { public: - TemplateNodeVariable(TemplateParser *parser,TemplateNode *parent,int line,const QCString &var) + TemplateNodeVariable(TemplateParser *parser,TemplateNode *parent,int line,const QCString &var) : TemplateNode(parent), m_templateName(parser->templateName()), m_line(line) { TRACE(("TemplateNodeVariable(%s)\n",var.data())); ExpressionParser expParser(m_templateName,line); - int i=var.find(':'); - int j=var.find('|'); - if (i==-1 || (j!=-1 && j args = split(var.mid(i+1),","); - for (uint j=0;j(c); ci->setLocation(m_templateName,m_line); - QValueList args; - for (uint i=0;iresolve(c); - args.append(v); - } TemplateVariant v = m_var->resolve(c); - QCString value; if (v.type()==TemplateVariant::Function) { - value = v.call(args); - } - else - { - value = v.toString(); + v = v.call(QValueList()); } //printf("TemplateNodeVariable::render(%s) raw=%d\n",value.data(),v.raw()); if (ci->escapeIntf() && !v.raw()) { - ts << ci->escapeIntf()->escape(value); + ts << ci->escapeIntf()->escape(v.toString()); } else { - ts << value; + ts << v.toString(); } } @@ -1696,13 +1748,13 @@ class TemplateNodeVariable : public TemplateNode //---------------------------------------------------------- -/** @brief Helper class for creating template AST tag nodes and returning +/** @brief Helper class for creating template AST tag nodes and returning * the template for a given node. */ template class TemplateNodeCreator : public TemplateNode { public: - TemplateNodeCreator(TemplateParser *parser,TemplateNode *parent,int line) + TemplateNodeCreator(TemplateParser *parser,TemplateNode *parent,int line) : TemplateNode(parent), m_templateName(parser->templateName()), m_line(line) {} static TemplateNode *createInstance(TemplateParser *parser, TemplateNode *parent, @@ -1790,7 +1842,7 @@ class TemplateNodeIf : public TemplateNodeCreator class TemplateNodeFor : public TemplateNodeCreator { public: - TemplateNodeFor(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeFor(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("{TemplateNodeFor(%s)\n",data.data())); @@ -1899,7 +1951,7 @@ class TemplateNodeFor : public TemplateNodeCreator { c->set(m_vars[vi++],v); } - else if (m_vars.count()>1 && v.type()==TemplateVariant::Struct) + else if (m_vars.count()>1 && v.type()==TemplateVariant::Struct) // loop variables represent elements in a list item { for (uint i=0;i //---------------------------------------------------------- +/** @brief Class representing an 'markers' tag in a template */ +class TemplateNodeMsg : public TemplateNodeCreator +{ + public: + TemplateNodeMsg(TemplateParser *parser,TemplateNode *parent,int line,const QCString &) + : TemplateNodeCreator(parser,parent,line) + { + TRACE(("{TemplateNodeMsg()\n")); + QStrList stopAt; + stopAt.append("endmsg"); + parser->parse(this,line,stopAt,m_nodes); + parser->removeNextToken(); // skip over endmarkers + TRACE(("}TemplateNodeMsg()\n")); + } + void render(FTextStream &, TemplateContext *c) + { + TemplateContextImpl* ci = dynamic_cast(c); + TemplateEscapeIntf *escIntf = ci->escapeIntf(); + ci->setEscapeIntf(0); // avoid escaping things we send to standard out + FTextStream ts(stdout); + m_nodes.render(ts,c); + ts << endl; + ci->setEscapeIntf(escIntf); + } + private: + TemplateNodeList m_nodes; +}; + + +//---------------------------------------------------------- + /** @brief Class representing a 'block' tag in a template */ class TemplateNodeBlock : public TemplateNodeCreator { public: - TemplateNodeBlock(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeBlock(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("{TemplateNodeBlock(%s)\n",data.data())); @@ -2014,7 +2097,7 @@ class TemplateNodeBlock : public TemplateNodeCreator class TemplateNodeExtend : public TemplateNodeCreator { public: - TemplateNodeExtend(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeExtend(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("{TemplateNodeExtend(%s)\n",data.data())); @@ -2065,6 +2148,11 @@ class TemplateNodeExtend : public TemplateNodeCreator { bc->add(nb); } + TemplateNodeMsg *msg = dynamic_cast(n); + if (msg) + { + msg->render(ts,c); + } } // render the base template with the given context @@ -2090,7 +2178,7 @@ class TemplateNodeExtend : public TemplateNodeCreator class TemplateNodeInclude : public TemplateNodeCreator { public: - TemplateNodeInclude(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeInclude(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("TemplateNodeInclude(%s)\n",data.data())); @@ -2140,11 +2228,11 @@ class TemplateNodeInclude : public TemplateNodeCreator //---------------------------------------------------------- -/** @brief Class representing an 'instantiate' tag in a template */ +/** @brief Class representing an 'create' tag in a template */ class TemplateNodeCreate : public TemplateNodeCreator { public: - TemplateNodeCreate(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeCreate(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("TemplateNodeCreate(%s)\n",data.data())); @@ -2237,19 +2325,19 @@ class TemplateNodeCreate : public TemplateNodeCreator //---------------------------------------------------------- -/** @brief Class representing an 'instantiate' tag in a template */ +/** @brief Class representing an 'tree' tag in a template */ class TemplateNodeTree : public TemplateNodeCreator { struct TreeContext { - TreeContext(TemplateNodeTree *o,const TemplateListIntf *l,TemplateContext *c) + TreeContext(TemplateNodeTree *o,const TemplateListIntf *l,TemplateContext *c) : object(o), list(l), templateCtx(c) {} TemplateNodeTree *object; const TemplateListIntf *list; TemplateContext *templateCtx; }; public: - TemplateNodeTree(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeTree(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { TRACE(("{TemplateNodeTree(%s)\n",data.data())); @@ -2269,9 +2357,10 @@ class TemplateNodeTree : public TemplateNodeCreator { delete m_treeExpr; } - static QCString renderChildrenStub(const void *ctx, const QValueList &) + static TemplateVariant renderChildrenStub(const void *ctx, const QValueList &) { - return ((TreeContext*)ctx)->object->renderChildren((const TreeContext*)ctx); + return TemplateVariant(((TreeContext*)ctx)->object-> + renderChildren((const TreeContext*)ctx),TRUE); } QCString renderChildren(const TreeContext *ctx) { @@ -2305,7 +2394,7 @@ class TemplateNodeTree : public TemplateNodeCreator } } } - if (!hasChildren) + if (!hasChildren) { c->set("children",TemplateVariant("")); // provide default m_treeNodes.render(ss,c); @@ -2339,7 +2428,7 @@ class TemplateNodeTree : public TemplateNodeCreator //---------------------------------------------------------- -/** @brief Class representing an 'instantiate' tag in a template */ +/** @brief Class representing an 'with' tag in a template */ class TemplateNodeWith : public TemplateNodeCreator { struct Mapping @@ -2350,9 +2439,10 @@ class TemplateNodeWith : public TemplateNodeCreator ExprAst *value; }; public: - TemplateNodeWith(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + TemplateNodeWith(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator(parser,parent,line) { + TRACE(("{TemplateNodeWith(%s)\n",data.data())); m_args.setAutoDelete(TRUE); ExpressionParser expParser(parser->templateName(),line); QValueList args = split(data," "); @@ -2379,6 +2469,7 @@ class TemplateNodeWith : public TemplateNodeCreator stopAt.append("endwith"); parser->parse(this,line,stopAt,m_nodes); parser->removeNextToken(); // skip over endwith + TRACE(("}TemplateNodeWith(%s)\n",data.data())); } ~TemplateNodeWith() { @@ -2404,7 +2495,130 @@ class TemplateNodeWith : public TemplateNodeCreator //---------------------------------------------------------- -/** @brief Factory class for creating tag AST nodes found in a template */ +/** @brief Class representing an 'spaceless' tag in a template */ +class TemplateNodeSpaceless : public TemplateNodeCreator +{ + public: + TemplateNodeSpaceless(TemplateParser *parser,TemplateNode *parent,int line,const QCString &) + : TemplateNodeCreator(parser,parent,line) + { + TRACE(("{TemplateNodeSpaceless()\n")); + QStrList stopAt; + stopAt.append("endspaceless"); + parser->parse(this,line,stopAt,m_nodes); + parser->removeNextToken(); // skip over endwith + TRACE(("}TemplateNodeSpaceless()\n")); + } + void render(FTextStream &ts, TemplateContext *c) + { + TemplateContextImpl *ci = dynamic_cast(c); + bool wasSpaceless = ci->spacelessEnabled(); + ci->enableSpaceless(TRUE); + m_nodes.render(ts,c); + ci->enableSpaceless(wasSpaceless); + } + private: + TemplateNodeList m_nodes; +}; + +//---------------------------------------------------------- + +/** @brief Class representing an 'markers' tag in a template */ +class TemplateNodeMarkers : public TemplateNodeCreator +{ + public: + TemplateNodeMarkers(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) + : TemplateNodeCreator(parser,parent,line) + { + TRACE(("{TemplateNodeMarkers(%s)\n",data.data())); + int i = data.find(" in "); + int w = data.find(" with "); + if (i==-1 || w==-1 || w in with "); + } + else + { + ExpressionParser expParser(parser->templateName(),line); + m_var = data.left(i); + m_listExpr = expParser.parseVariable(data.mid(i+4,w-i-4)); + m_patternExpr = expParser.parseVariable(data.right(data.length()-w-6)); + } + QStrList stopAt; + stopAt.append("endmarkers"); + parser->parse(this,line,stopAt,m_nodes); + parser->removeNextToken(); // skip over endmarkers + TRACE(("}TemplateNodeMarkers(%s)\n",data.data())); + } + void render(FTextStream &ts, TemplateContext *c) + { + TemplateContextImpl *ci = dynamic_cast(c); + ci->setLocation(m_templateName,m_line); + if (!m_var.isEmpty() && m_listExpr && m_patternExpr) + { + TemplateVariant v = m_listExpr->resolve(c); + const TemplateListIntf *list = v.toList(); + TemplateVariant patternStr = m_patternExpr->resolve(c); + if (list) + { + if (patternStr.type()==TemplateVariant::String) + { + TemplateListIntf::ConstIterator *it = list->createIterator(); + c->push(); + QCString str = patternStr.toString(); + QRegExp marker("@[0-9]+"); // pattern for a marker, i.e. @0, @1 ... @12, etc + int index=0,newIndex,matchLen; + while ((newIndex=marker.match(str,index,&matchLen))!=-1) + { + ts << str.mid(index,newIndex-index); // write text before marker + bool ok; + uint entryIndex = str.mid(newIndex+1,matchLen-1).toUInt(&ok); // get marker id + TemplateVariant var; + uint i=0; + // search for list element at position id + for (it->toFirst(); (it->current(var)) && itoNext(),i++) {} + if (ok && i==entryIndex) // found element + { + c->set(m_var,var); // define local variable to hold element of list type + bool wasSpaceless = ci->spacelessEnabled(); + ci->enableSpaceless(TRUE); + m_nodes.render(ts,c); + ci->enableSpaceless(wasSpaceless); + } + else if (!ok) + { + warn(m_templateName,m_line,"markers pattern string has invalid markers '%s'",str.data()); + } + else if (ipop(); + } + else + { + warn(m_templateName,m_line,"markers requires a parameter of string type after 'with'!"); + } + } + else + { + warn(m_templateName,m_line,"markers requires a parameter of list type after 'in'!"); + } + } + } + private: + TemplateNodeList m_nodes; + QCString m_var; + ExprAst *m_listExpr; + ExprAst *m_patternExpr; +}; + +//---------------------------------------------------------- + +/** @brief Factory class for creating tag AST nodes found in a template */ class TemplateNodeFactory { public: @@ -2450,20 +2664,23 @@ class TemplateNodeFactory }; // register a handler for each start tag we support -static TemplateNodeFactory::AutoRegister autoRefIf("if"); -static TemplateNodeFactory::AutoRegister autoRefFor("for"); -static TemplateNodeFactory::AutoRegister autoRefTree("recursetree"); -static TemplateNodeFactory::AutoRegister autoRefWith("with"); -static TemplateNodeFactory::AutoRegister autoRefBlock("block"); -static TemplateNodeFactory::AutoRegister autoRefExtend("extend"); -static TemplateNodeFactory::AutoRegister autoRefCreate("create"); -static TemplateNodeFactory::AutoRegister autoRefInclude("include"); +static TemplateNodeFactory::AutoRegister autoRefIf("if"); +static TemplateNodeFactory::AutoRegister autoRefFor("for"); +static TemplateNodeFactory::AutoRegister autoRefMsg("msg"); +static TemplateNodeFactory::AutoRegister autoRefTree("recursetree"); +static TemplateNodeFactory::AutoRegister autoRefWith("with"); +static TemplateNodeFactory::AutoRegister autoRefBlock("block"); +static TemplateNodeFactory::AutoRegister autoRefExtend("extend"); +static TemplateNodeFactory::AutoRegister autoRefCreate("create"); +static TemplateNodeFactory::AutoRegister autoRefInclude("include"); +static TemplateNodeFactory::AutoRegister autoRefMarkers("markers"); +static TemplateNodeFactory::AutoRegister autoRefSpaceless("spaceless"); //---------------------------------------------------------- -TemplateBlockContext::TemplateBlockContext() : m_blocks(257) -{ - m_blocks.setAutoDelete(TRUE); +TemplateBlockContext::TemplateBlockContext() : m_blocks(257) +{ + m_blocks.setAutoDelete(TRUE); } TemplateNodeBlock *TemplateBlockContext::get(const QCString &name) const @@ -2552,7 +2769,7 @@ class TemplateLexer QCString m_data; }; -TemplateLexer::TemplateLexer(const QCString &fileName,const QCString &data) : +TemplateLexer::TemplateLexer(const QCString &fileName,const QCString &data) : m_fileName(fileName), m_data(data) { } @@ -2585,7 +2802,7 @@ void TemplateLexer::tokenize(QList &tokens) { switch (state) { - case StateText: + case StateText: if (c=='{') // {{ or {% or {# or something else { state=StateBeginTemplate; @@ -2728,7 +2945,7 @@ void TemplateLexer::tokenize(QList &tokens) { state=StateText; startLinePos=pos+1; - // if the current line only contain commands and whitespace, + // if the current line only contain commands and whitespace, // then skip it in the output by moving lastTokenPos if (markStartPos!=-1 && emptyOutputLine) lastTokenPos = startLinePos; // reset markers @@ -2813,10 +3030,11 @@ void TemplateParser::parse( { nodes.append(node); } - else if (command=="empty" || command=="else" || - command=="endif" || command=="endfor" || - command=="endblock" || command=="endwith" || - command=="endrecursetree") + else if (command=="empty" || command=="else" || + command=="endif" || command=="endfor" || + command=="endblock" || command=="endwith" || + command=="endrecursetree" || command=="endspaceless" || + command=="endmarkers" || command=="endmsg") { warn(m_templateName,tok->line,"Found tag '%s' without matching start tag",command.data()); } @@ -2888,8 +3106,8 @@ TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const QCS parser.parse(this,1,QStrList(),m_nodes); } -void TemplateImpl::render(FTextStream &ts, TemplateContext *c) -{ +void TemplateImpl::render(FTextStream &ts, TemplateContext *c) +{ if (!m_nodes.isEmpty()) { TemplateNodeExtend *ne = dynamic_cast(m_nodes.getFirst()); @@ -2908,7 +3126,7 @@ void TemplateImpl::render(FTextStream &ts, TemplateContext *c) } } } - m_nodes.render(ts,c); + m_nodes.render(ts,c); } } diff --git a/src/template.h b/src/template.h index 454a70b..f5598f1 100644 --- a/src/template.h +++ b/src/template.h @@ -42,8 +42,10 @@ class TemplateEngine; * - `for ... empty ... endfor` * - `if ... else ... endif` * - `block ... endblock` - * - `extends` + * - `extend` * - `include` + * - `with ... endwith` + * - `spaceless ... endspaceless` * * Supported Django filters: * - `default` @@ -53,6 +55,13 @@ class TemplateEngine; * Extension tags: * - `create` which instantiates a template and writes the result to a file. * The syntax is `{% create 'filename' from 'template' %}`. + * - `recursetree` + * - `markers` + * + * Extension filters: + * - `stripPath` + * - `nowrap` + * - `prepend` * * @{ */ @@ -62,7 +71,7 @@ class TemplateVariant { public: /** Signature of the callback function, used for function type variants */ - typedef QCString (*FuncType)(const void *obj, const QValueList &args); + typedef TemplateVariant (*FuncType)(const void *obj, const QValueList &args); /** Types of data that can be stored in a TemplateVariant */ enum Type { None, Bool, Integer, String, Struct, List, Function }; @@ -83,10 +92,10 @@ class TemplateVariant TemplateVariant(int v); /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const char *s); + TemplateVariant(const char *s,bool raw=FALSE); /** Constructs a new variant with a string value \a s. */ - TemplateVariant(const QCString &s); + TemplateVariant(const QCString &s,bool raw=FALSE); /** Constructs a new variant with a struct value \a s. * @note. Only a pointer to the struct is stored. The caller @@ -146,7 +155,7 @@ class TemplateVariant /** Return the result of apply this function with \a args. * Returns an empty string if the variant type is not a function. */ - QCString call(const QValueList &args); + TemplateVariant call(const QValueList &args); /** Sets whether or not the value of the Variant should be * escaped or written as-is (raw). @@ -283,6 +292,16 @@ class TemplateEscapeIntf //------------------------------------------------------------------------ +/** @brief Interface used to remove redundant spaces inside a spaceless block */ +class TemplateSpacelessIntf +{ + public: + /** Returns the \a input after removing redundant whitespace */ + virtual QCString remove(const QCString &input) = 0; +}; + +//------------------------------------------------------------------------ + /** @brief Abstract interface for a template context. * * A Context consists of a stack of dictionaries. @@ -333,6 +352,11 @@ class TemplateContext * of variable expansion before writing it to the output. */ virtual void setEscapeIntf(TemplateEscapeIntf *intf) = 0; + + /** Sets the interface that will be used inside a spaceless block + * to remove any redundant whitespace. + */ + virtual void setSpacelessIntf(TemplateSpacelessIntf *intf) = 0; }; //------------------------------------------------------------------------ -- cgit v0.12