From 1708261ebe54b03c45a4bfe3c1e78581779b2a80 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Fri, 1 May 2020 20:34:38 +0200 Subject: Refactoring: Introduce type names for commonly used container types --- src/arguments.h | 3 +- src/classdef.cpp | 20 ++-- src/classdef.h | 6 +- src/containers.h | 36 ++++++ src/definition.cpp | 298 +++++++++++++++++++++++++------------------------- src/definition.h | 80 +++++++------- src/definitionimpl.h | 20 ++-- src/docbookvisitor.h | 7 +- src/dotclassgraph.cpp | 29 +++-- src/doxygen.cpp | 22 ++-- src/doxygen.h | 12 +- src/entry.h | 6 +- src/filedef.cpp | 2 +- src/formula.cpp | 6 +- src/groupdef.cpp | 2 +- src/memberdef.cpp | 16 +-- src/memberdef.h | 6 +- src/membergroup.cpp | 64 +++++------ src/membergroup.h | 21 ++-- src/namespacedef.cpp | 2 +- src/pre.l | 27 ++--- src/reflist.cpp | 25 ++++- src/reflist.h | 24 +--- src/util.cpp | 4 +- src/util.h | 4 +- src/vhdljjparser.cpp | 15 +-- 26 files changed, 396 insertions(+), 361 deletions(-) create mode 100644 src/containers.h diff --git a/src/arguments.h b/src/arguments.h index 491b582..892de92 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -133,7 +133,8 @@ class ArgumentList RefQualifierType m_refQualifier = RefQualifierNone; /*! is it an explicit empty list */ bool m_noParameters = FALSE; - }; +using ArgumentLists = std::vector; + #endif diff --git a/src/classdef.cpp b/src/classdef.cpp index e637dab..5e300ce 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -106,9 +106,9 @@ class ClassDefImpl : public DefinitionImpl, public ClassDef virtual ConstraintClassDict *templateTypeConstraints() const; virtual bool isTemplateArgument() const; virtual Definition *findInnerCompound(const char *name) const; - virtual std::vector getTemplateParameterLists() const; + virtual ArgumentLists getTemplateParameterLists() const; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector *actualParams=0,uint *actualParamIndex=0) const; + const ArgumentLists *actualParams=0,uint *actualParamIndex=0) const; virtual bool isAbstract() const; virtual bool isObjectiveC() const; virtual bool isFortran() const; @@ -368,10 +368,10 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef { return getCdAlias()->isTemplateArgument(); } virtual Definition *findInnerCompound(const char *name) const { return getCdAlias()->findInnerCompound(name); } - virtual std::vector getTemplateParameterLists() const + virtual ArgumentLists getTemplateParameterLists() const { return getCdAlias()->getTemplateParameterLists(); } virtual QCString qualifiedNameWithTemplateParameters( - const std::vector *actualParams=0,uint *actualParamIndex=0) const + const ArgumentLists *actualParams=0,uint *actualParamIndex=0) const { return getCdAlias()->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } virtual bool isAbstract() const { return getCdAlias()->isAbstract(); } @@ -1348,7 +1348,7 @@ void ClassDefImpl::setIncludeFile(FileDef *fd, //} static void searchTemplateSpecs(/*in*/ const Definition *d, - /*out*/ std::vector &result, + /*out*/ ArgumentLists &result, /*out*/ QCString &name, /*in*/ SrcLangExt lang) { @@ -1385,7 +1385,7 @@ static void searchTemplateSpecs(/*in*/ const Definition *d, static void writeTemplateSpec(OutputList &ol,const Definition *d, const QCString &type,SrcLangExt lang) { - std::vector specs; + ArgumentLists specs; QCString name; searchTemplateSpecs(d,specs,name,lang); if (!specs.empty()) // class has template scope specifiers @@ -4215,9 +4215,9 @@ bool ClassDefImpl::isReference() const } } -std::vector ClassDefImpl::getTemplateParameterLists() const +ArgumentLists ClassDefImpl::getTemplateParameterLists() const { - std::vector result; + ArgumentLists result; Definition *d=getOuterScope(); while (d && d->definitionType()==Definition::TypeClass) { @@ -4232,7 +4232,7 @@ std::vector ClassDefImpl::getTemplateParameterLists() const } QCString ClassDefImpl::qualifiedNameWithTemplateParameters( - const std::vector *actualParams,uint *actualParamIndex) const + const ArgumentLists *actualParams,uint *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); static bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); @@ -4312,7 +4312,7 @@ void ClassDefImpl::addListReferences() if (!isLinkableInProject()) return; //printf("ClassDef(%s)::addListReferences()\n",name().data()); { - const std::vector &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), lang==SrcLangExt_Fortran ? theTranslator->trType(TRUE,TRUE) diff --git a/src/classdef.h b/src/classdef.h index 9c3aaa3..46a13c1 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -25,6 +25,7 @@ #include #include "definition.h" +#include "arguments.h" struct Argument; class MemberDef; @@ -49,7 +50,6 @@ class GroupDef; class StringDict; struct IncludeInfo; class ClassDefImpl; -class ArgumentList; class FTextStream; /** A abstract class representing of a compound symbol. @@ -229,10 +229,10 @@ class ClassDef : virtual public Definition * will return a list with one ArgumentList containing one argument * with type="class" and name="T". */ - virtual std::vector getTemplateParameterLists() const = 0; + virtual ArgumentLists getTemplateParameterLists() const = 0; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector *actualParams=0,uint *actualParamIndex=0) const = 0; + const ArgumentLists *actualParams=0,uint *actualParamIndex=0) const = 0; /** Returns TRUE if there is at least one pure virtual member in this * class. diff --git a/src/containers.h b/src/containers.h new file mode 100644 index 0000000..770f92d --- /dev/null +++ b/src/containers.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2020 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 + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef CONTAINERS_H +#define CONTAINERS_H + +#include +#include +#include +#include +#include +#include +#include + +using StringUnorderedMap = std::unordered_map; +using StringUnorderedSet = std::unordered_set; +using StringSet = std::set; +using StringVector = std::vector; +using BoolStack = std::stack; +using BoolVector = std::vector; +using IntMap = std::map; +using IntVector = std::vector; + +#endif diff --git a/src/definition.cpp b/src/definition.cpp index 22a1435..09b4f56 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 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. * @@ -60,7 +60,7 @@ class DefinitionImpl::IMPL MemberSDict *sourceRefByDict = 0; MemberSDict *sourceRefsDict = 0; - std::vector xrefListItems; + RefItemVector xrefListItems; GroupList *partOfGroups = 0; DocInfo *details = 0; // not exported @@ -168,9 +168,9 @@ static bool matchExcludedSymbols(const char *name) QCString pattern = pat; bool forceStart=FALSE; bool forceEnd=FALSE; - if (pattern.at(0)=='^') + if (pattern.at(0)=='^') pattern=pattern.mid(1),forceStart=TRUE; - if (pattern.at(pattern.length()-1)=='$') + if (pattern.at(pattern.length()-1)=='$') pattern=pattern.left(pattern.length()-1),forceEnd=TRUE; if (pattern.find('*')!=-1) // wildcard mode { @@ -206,7 +206,7 @@ static bool matchExcludedSymbols(const char *name) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); - return TRUE; + return TRUE; } } } @@ -222,7 +222,7 @@ static void addToMap(const char *name,Definition *d) QCString symbolName = name; int index=computeQualifiedIndex(symbolName); if (!vhdlOpt && index!=-1) symbolName=symbolName.mid(index+2); - if (!symbolName.isEmpty()) + if (!symbolName.isEmpty()) { //printf("******* adding symbol '%s' (%p)\n",symbolName.data(),d); DefinitionIntf *di=Doxygen::symbolMap->find(symbolName); @@ -266,7 +266,7 @@ static void addToMap(const char *name,Definition *d) static void removeFromMap(Definition *d) { QCString symbolName = d->_symbolName(); - if (!symbolName.isEmpty()) + if (!symbolName.isEmpty()) { //printf("******* removing symbol '%s' (%p)\n",symbolName.data(),d); DefinitionIntf *di=Doxygen::symbolMap->find(symbolName); @@ -306,7 +306,7 @@ DefinitionImpl::DefinitionImpl(const char *df,int dl,int dc, if (isSymbol) addToMap(name,this); _setBriefDescription(b,df,dl); _setDocumentation(d,df,dl,TRUE,FALSE); - if (matchExcludedSymbols(name)) + if (matchExcludedSymbols(name)) { m_impl->hidden = TRUE; } @@ -398,7 +398,7 @@ void DefinitionImpl::setId(const char *id) { if (id==0) return; m_impl->id = id; - if (Doxygen::clangUsrMap) + if (Doxygen::clangUsrMap) { //printf("DefinitionImpl::setId '%s'->'%s'\n",id,m_impl->name.data()); Doxygen::clangUsrMap->insert(id,this); @@ -595,7 +595,7 @@ void DefinitionImpl::setDocumentation(const char *d,const char *docFile,int docL #define uni_isupper(c) (QChar(c).category()==QChar::Letter_Uppercase) -// do a UTF-8 aware search for the last real character and return TRUE +// do a UTF-8 aware search for the last real character and return TRUE // if that is a multibyte one. static bool lastCharIsMultibyte(const QCString &s) { @@ -610,7 +610,7 @@ static bool lastCharIsMultibyte(const QCString &s) void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,int briefLine) { static QCString outputLanguage = Config_getEnum(OUTPUT_LANGUAGE); - static bool needsDot = outputLanguage!="Japanese" && + static bool needsDot = outputLanguage!="Japanese" && outputLanguage!="Chinese" && outputLanguage!="Korean"; QCString brief = b; @@ -623,8 +623,8 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in switch(c) { case '.': case '!': case '?': case '>': case ':': case ')': break; - default: - if (uni_isupper(brief.at(0)) && !lastCharIsMultibyte(brief)) brief+='.'; + default: + if (uni_isupper(brief.at(0)) && !lastCharIsMultibyte(brief)) brief+='.'; break; } } @@ -662,8 +662,8 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in } } -void DefinitionImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) -{ +void DefinitionImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) +{ if (b==0) return; _setBriefDescription(b,briefFile,briefLine); } @@ -825,7 +825,7 @@ static FilterCache g_filterCache; //----------------------------------------- -/*! Reads a fragment of code from file \a fileName starting at +/*! Reads a fragment of code from file \a fileName starting at * line \a startLine and ending at line \a endLine (inclusive). The fragment is * stored in \a result. If FALSE is returned the code fragment could not be * found. @@ -977,11 +977,11 @@ bool readCodeFragment(const char *fileName, } QCString DefinitionImpl::getSourceFileBase() const -{ +{ ASSERT(definitionType()!=Definition::TypeFile); // file overloads this method QCString fn; static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); - if (sourceBrowser && + if (sourceBrowser && m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->fileDef) { fn = m_impl->body->fileDef->getSourceFileBase(); @@ -1031,9 +1031,9 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const if (lineMarkerPosbody->fileDef->name()); ol.enableAll(); ol.disable(OutputGenerator::Html); - if (latexSourceCode) + if (latexSourceCode) { ol.disable(OutputGenerator::Latex); } @@ -1110,9 +1110,9 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const else // file marker before line marker { // write text left from file marker - ol.parseText(refText.left(fileMarkerPos)); + ol.parseText(refText.left(fileMarkerPos)); ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Man); if (!latexSourceCode) { ol.disable(OutputGenerator::Latex); @@ -1129,7 +1129,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.writeObjectLink(0,fn,0,m_impl->body->fileDef->name()); ol.enableAll(); ol.disable(OutputGenerator::Html); - if (latexSourceCode) + if (latexSourceCode) { ol.disable(OutputGenerator::Latex); } @@ -1144,14 +1144,14 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const // write normal text (RTF/Latex/Man only) ol.docify(m_impl->body->fileDef->name()); ol.popGeneratorState(); - + // write text between markers ol.parseText(refText.mid(fileMarkerPos+2, - lineMarkerPos-fileMarkerPos-2)); + lineMarkerPos-fileMarkerPos-2)); ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); - ol.disableAllBut(OutputGenerator::Html); + ol.disable(OutputGenerator::Man); + ol.disableAllBut(OutputGenerator::Html); if (latexSourceCode) { ol.enable(OutputGenerator::Latex); @@ -1168,7 +1168,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.writeObjectLink(0,fn,anchorStr,lineStr); ol.enableAll(); ol.disable(OutputGenerator::Html); - if (latexSourceCode) + if (latexSourceCode) { ol.disable(OutputGenerator::Latex); } @@ -1206,10 +1206,10 @@ void DefinitionImpl::setBodySegment(int defLine, int bls,int ble) m_impl->body->endLine = ble; } -void DefinitionImpl::setBodyDef(FileDef *fd) +void DefinitionImpl::setBodyDef(FileDef *fd) { if (m_impl->body==0) m_impl->body = new BodyInfo; - m_impl->body->fileDef=fd; + m_impl->body->fileDef=fd; } bool DefinitionImpl::hasSources() const @@ -1262,13 +1262,13 @@ void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const ol.popGeneratorState(); } -/*! Write a reference to the source code fragments in which this +/*! Write a reference to the source code fragments in which this * definition is used. */ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, const QCString &text,MemberSDict *members,bool /*funcOnly*/) const { - static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); + static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); static bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); @@ -1305,27 +1305,27 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, name.prepend(scope+getLanguageSpecificSeparator(m_impl->lang)); } if (!md->isObjCMethod() && - (md->isFunction() || md->isSlot() || + (md->isFunction() || md->isSlot() || md->isPrototype() || md->isSignal() ) - ) + ) { name+="()"; } //DefinitionImpl *d = md->getOutputFileBase(); //if (d==Doxygen::globalScope) d=md->getBodyDef(); if (sourceBrowser && - !(md->isLinkable() && !refLinkSource) && - md->getStartBodyLine()!=-1 && + !(md->isLinkable() && !refLinkSource) && + md->getStartBodyLine()!=-1 && md->getBodyDef() ) { - //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); + //printf("md->getBodyDef()=%p global=%p\n",md->getBodyDef(),Doxygen::globalScope); // for HTML write a real link ol.pushGeneratorState(); //ol.disableAllBut(OutputGenerator::Html); - ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Man); if (!latexSourceCode) { ol.disable(OutputGenerator::Latex); @@ -1367,8 +1367,8 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, { // for HTML write a real link ol.pushGeneratorState(); - //ol.disableAllBut(OutputGenerator::Html); - ol.disable(OutputGenerator::Man); + //ol.disableAllBut(OutputGenerator::Html); + ol.disable(OutputGenerator::Man); if (!latexSourceCode) { ol.disable(OutputGenerator::Latex); @@ -1411,7 +1411,7 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, } } index=(uint)newIndex+matchLen; - } + } ol.parseText(ldefLine.right(ldefLine.length()-index)); ol.writeString("."); ol.endParagraph(); @@ -1430,15 +1430,15 @@ void DefinitionImpl::writeSourceRefs(OutputList &ol,const char *scopeName) const } bool DefinitionImpl::hasDocumentation() const -{ - static bool extractAll = Config_getBool(EXTRACT_ALL); +{ + static bool extractAll = Config_getBool(EXTRACT_ALL); //static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); - bool hasDocs = + bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || // has detailed docs (m_impl->brief && !m_impl->brief->doc.isEmpty()) || // has brief description (m_impl->inbodyDocs && !m_impl->inbodyDocs->doc.isEmpty()) || // has inbody docs extractAll //|| // extract everything - // (sourceBrowser && m_impl->body && + // (sourceBrowser && m_impl->body && // m_impl->body->startLine!=-1 && m_impl->body->fileDef) ; // link to definition return hasDocs; @@ -1446,7 +1446,7 @@ bool DefinitionImpl::hasDocumentation() const bool DefinitionImpl::hasUserDocumentation() const { - bool hasDocs = + bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || (m_impl->brief && !m_impl->brief->doc.isEmpty()) || (m_impl->inbodyDocs && !m_impl->inbodyDocs->doc.isEmpty()); @@ -1514,24 +1514,24 @@ QCString DefinitionImpl::qualifiedName() const { //static int count=0; //count++; - if (!m_impl->qualifiedName.isEmpty()) + if (!m_impl->qualifiedName.isEmpty()) { //count--; return m_impl->qualifiedName; } - + //printf("start %s::qualifiedName() localName=%s\n",name().data(),m_impl->localName.data()); - if (m_impl->outerScope==0) + if (m_impl->outerScope==0) { - if (m_impl->localName=="") + if (m_impl->localName=="") { //count--; return ""; } - else + else { //count--; - return m_impl->localName; + return m_impl->localName; } } @@ -1580,7 +1580,7 @@ void DefinitionImpl::makePartOfGroup(GroupDef *gd) m_impl->partOfGroups->append(gd); } -void DefinitionImpl::setRefItems(const std::vector &sli) +void DefinitionImpl::setRefItems(const RefItemVector &sli) { m_impl->xrefListItems.insert(m_impl->xrefListItems.end(), sli.cbegin(), sli.cend()); } @@ -1623,7 +1623,7 @@ int DefinitionImpl::_getXRefListId(const char *listName) const return -1; } -const std::vector &DefinitionImpl::xrefListItems() const +const RefItemVector &DefinitionImpl::xrefListItems() const { return m_impl->xrefListItems; } @@ -1661,7 +1661,7 @@ QCString DefinitionImpl::pathFragment() const //---------------------------------------------------------------------------------------- // TODO: move to htmlgen -/*! Returns the string used in the footer for $navpath when +/*! Returns the string used in the footer for $navpath when * GENERATE_TREEVIEW is enabled */ QCString DefinitionImpl::navigationPathAsString() const @@ -1749,7 +1749,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const int level=1,l; char cs[2]; cs[1]='\0'; - std::vector inLi(maxLevel+1,false); + BoolVector inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1815,7 +1815,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const ol.writeString(" " + theTranslator->trRTFTableOfContents() + "\n"); int level=1,l; int maxLevel = localToc.docbookLevel(); - std::vector inLi(maxLevel+1,false); + BoolVector inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1881,26 +1881,26 @@ const SectionRefs &DefinitionImpl::getSectionRefs() const return m_impl->sectionRefs; } -QCString DefinitionImpl::symbolName() const -{ - return m_impl->symbolName; +QCString DefinitionImpl::symbolName() const +{ + return m_impl->symbolName; } //---------------------- -QCString DefinitionImpl::documentation() const -{ - return m_impl->details ? m_impl->details->doc : QCString(""); +QCString DefinitionImpl::documentation() const +{ + return m_impl->details ? m_impl->details->doc : QCString(""); } -int DefinitionImpl::docLine() const -{ - return m_impl->details ? m_impl->details->line : 1; +int DefinitionImpl::docLine() const +{ + return m_impl->details ? m_impl->details->line : 1; } -QCString DefinitionImpl::docFile() const -{ - return m_impl->details ? m_impl->details->file : QCString("<"+m_impl->name+">"); +QCString DefinitionImpl::docFile() const +{ + return m_impl->details ? m_impl->details->file : QCString("<"+m_impl->name+">"); } //---------------------------------------------------------------------------- @@ -1908,7 +1908,7 @@ QCString DefinitionImpl::docFile() const static bool stripWord(QCString &s,QCString w) { bool success=FALSE; - if (s.left(w.length())==w) + if (s.left(w.length())==w) { success=TRUE; s=s.right(s.length()-w.length()); @@ -1926,7 +1926,7 @@ QCString abbreviate(const char *s,const char *name) QCString result=s; result=result.stripWhiteSpace(); // strip trailing . - if (!result.isEmpty() && result.at(result.length()-1)=='.') + if (!result.isEmpty() && result.at(result.length()-1)=='.') result=result.left(result.length()-1); // strip any predefined prefix @@ -1954,12 +1954,12 @@ QCString abbreviate(const char *s,const char *name) //---------------------- -QCString DefinitionImpl::briefDescription(bool abbr) const -{ +QCString DefinitionImpl::briefDescription(bool abbr) const +{ //printf("%s::briefDescription(%d)='%s'\n",name().data(),abbr,m_impl->brief?m_impl->brief->doc.data():""); - return m_impl->brief ? + return m_impl->brief ? (abbr ? abbreviate(m_impl->brief->doc,displayName()) : m_impl->brief->doc) : - QCString(""); + QCString(""); } QCString DefinitionImpl::briefDescriptionAsTooltip() const @@ -1968,7 +1968,7 @@ QCString DefinitionImpl::briefDescriptionAsTooltip() const { if (m_impl->brief->tooltip.isEmpty() && !m_impl->brief->doc.isEmpty()) { - static bool reentering=FALSE; + static bool reentering=FALSE; if (!reentering) { const MemberDef *md = definitionType()==TypeMember ? dynamic_cast(this) : 0; @@ -1987,44 +1987,44 @@ QCString DefinitionImpl::briefDescriptionAsTooltip() const return QCString(""); } -int DefinitionImpl::briefLine() const -{ - return m_impl->brief ? m_impl->brief->line : 1; +int DefinitionImpl::briefLine() const +{ + return m_impl->brief ? m_impl->brief->line : 1; } -QCString DefinitionImpl::briefFile() const -{ - return m_impl->brief ? m_impl->brief->file : QCString("<"+m_impl->name+">"); +QCString DefinitionImpl::briefFile() const +{ + return m_impl->brief ? m_impl->brief->file : QCString("<"+m_impl->name+">"); } //---------------------- QCString DefinitionImpl::inbodyDocumentation() const { - return m_impl->inbodyDocs ? m_impl->inbodyDocs->doc : QCString(""); + return m_impl->inbodyDocs ? m_impl->inbodyDocs->doc : QCString(""); } -int DefinitionImpl::inbodyLine() const -{ - return m_impl->inbodyDocs ? m_impl->inbodyDocs->line : 1; +int DefinitionImpl::inbodyLine() const +{ + return m_impl->inbodyDocs ? m_impl->inbodyDocs->line : 1; } -QCString DefinitionImpl::inbodyFile() const -{ - return m_impl->inbodyDocs ? m_impl->inbodyDocs->file : QCString("<"+m_impl->name+">"); +QCString DefinitionImpl::inbodyFile() const +{ + return m_impl->inbodyDocs ? m_impl->inbodyDocs->file : QCString("<"+m_impl->name+">"); } //---------------------- -QCString DefinitionImpl::getDefFileName() const -{ - return m_impl->defFileName; +QCString DefinitionImpl::getDefFileName() const +{ + return m_impl->defFileName; } -QCString DefinitionImpl::getDefFileExtension() const -{ - return m_impl->defFileExt; +QCString DefinitionImpl::getDefFileExtension() const +{ + return m_impl->defFileExt; } bool DefinitionImpl::isHidden() const @@ -2032,14 +2032,14 @@ bool DefinitionImpl::isHidden() const return m_impl->hidden; } -bool DefinitionImpl::isVisibleInProject() const -{ - return isLinkableInProject() && !m_impl->hidden; +bool DefinitionImpl::isVisibleInProject() const +{ + return isLinkableInProject() && !m_impl->hidden; } bool DefinitionImpl::isVisible() const -{ - return isLinkable() && !m_impl->hidden; +{ + return isLinkable() && !m_impl->hidden; } bool DefinitionImpl::isArtificial() const @@ -2047,14 +2047,14 @@ bool DefinitionImpl::isArtificial() const return m_impl->isArtificial; } -QCString DefinitionImpl::getReference() const -{ - return m_impl->ref; +QCString DefinitionImpl::getReference() const +{ + return m_impl->ref; } -bool DefinitionImpl::isReference() const -{ - return !m_impl->ref.isEmpty(); +bool DefinitionImpl::isReference() const +{ + return !m_impl->ref.isEmpty(); } int DefinitionImpl::getStartDefLine() const @@ -2062,24 +2062,24 @@ int DefinitionImpl::getStartDefLine() const return m_impl->body ? m_impl->body->defLine : -1; } -int DefinitionImpl::getStartBodyLine() const -{ - return m_impl->body ? m_impl->body->startLine : -1; +int DefinitionImpl::getStartBodyLine() const +{ + return m_impl->body ? m_impl->body->startLine : -1; } -int DefinitionImpl::getEndBodyLine() const -{ - return m_impl->body ? m_impl->body->endLine : -1; +int DefinitionImpl::getEndBodyLine() const +{ + return m_impl->body ? m_impl->body->endLine : -1; } FileDef *DefinitionImpl::getBodyDef() const -{ - return m_impl->body ? m_impl->body->fileDef : 0; +{ + return m_impl->body ? m_impl->body->fileDef : 0; } -GroupList *DefinitionImpl::partOfGroups() const -{ - return m_impl->partOfGroups; +GroupList *DefinitionImpl::partOfGroups() const +{ + return m_impl->partOfGroups; } bool DefinitionImpl::isLinkableViaGroup() const @@ -2097,24 +2097,24 @@ bool DefinitionImpl::isLinkableViaGroup() const return FALSE; } -Definition *DefinitionImpl::getOuterScope() const -{ - return m_impl->outerScope; +Definition *DefinitionImpl::getOuterScope() const +{ + return m_impl->outerScope; } -MemberSDict *DefinitionImpl::getReferencesMembers() const -{ - return m_impl->sourceRefsDict; +MemberSDict *DefinitionImpl::getReferencesMembers() const +{ + return m_impl->sourceRefsDict; } -MemberSDict *DefinitionImpl::getReferencedByMembers() const -{ - return m_impl->sourceRefByDict; +MemberSDict *DefinitionImpl::getReferencedByMembers() const +{ + return m_impl->sourceRefByDict; } -void DefinitionImpl::setReference(const char *r) -{ - m_impl->ref=r; +void DefinitionImpl::setReference(const char *r) +{ + m_impl->ref=r; } SrcLangExt DefinitionImpl::getLanguage() const @@ -2122,9 +2122,9 @@ SrcLangExt DefinitionImpl::getLanguage() const return m_impl->lang; } -void DefinitionImpl::setHidden(bool b) -{ - m_impl->hidden = m_impl->hidden || b; +void DefinitionImpl::setHidden(bool b) +{ + m_impl->hidden = m_impl->hidden || b; } void DefinitionImpl::setArtificial(bool b) @@ -2132,20 +2132,20 @@ void DefinitionImpl::setArtificial(bool b) m_impl->isArtificial = b; } -void DefinitionImpl::setLocalName(const QCString name) -{ - m_impl->localName=name; +void DefinitionImpl::setLocalName(const QCString name) +{ + m_impl->localName=name; } -void DefinitionImpl::setLanguage(SrcLangExt lang) -{ - m_impl->lang=lang; +void DefinitionImpl::setLanguage(SrcLangExt lang) +{ + m_impl->lang=lang; } -void DefinitionImpl::_setSymbolName(const QCString &name) -{ - m_impl->symbolName=name; +void DefinitionImpl::_setSymbolName(const QCString &name) +{ + m_impl->symbolName=name; } QCString DefinitionImpl::_symbolName() const @@ -2223,13 +2223,13 @@ void DefinitionImpl::writeSummaryLinks(OutputList &) const //--------------------------------------------------------------------------------- DefinitionAliasImpl::DefinitionAliasImpl(const Definition *scope,const Definition *alias) - : m_scope(scope), m_def(alias), m_cookie(0) + : m_scope(scope), m_def(alias), m_cookie(0) { //printf("%s::addToMap(%s)\n",qPrint(name()),qPrint(alias->name())); addToMap(alias->name(),this); } -DefinitionAliasImpl::~DefinitionAliasImpl() +DefinitionAliasImpl::~DefinitionAliasImpl() { //printf("~DefinitionAliasImpl()\n"); removeFromMap(this); diff --git a/src/definition.h b/src/definition.h index 318a35b..2d167dc 100644 --- a/src/definition.h +++ b/src/definition.h @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 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. * @@ -23,6 +23,7 @@ #include #include "types.h" +#include "reflist.h" #if defined(_WIN32) && !defined(__CYGWIN__) // To disable 'inherits via dominance' warnings. @@ -40,12 +41,11 @@ class GroupList; class SectionInfo; class Definition; class FTextStream; -class RefItem; - + /** Data associated with a detailed description. */ struct DocInfo { - QCString doc; + QCString doc; int line; QCString file; }; @@ -53,8 +53,8 @@ struct DocInfo /** Data associated with a brief description. */ struct BriefInfo { - QCString doc; - QCString tooltip; + QCString doc; + QCString tooltip; int line; QCString file; }; @@ -67,7 +67,7 @@ struct BodyInfo int endLine; //!< line number of the end of the definition's body FileDef *fileDef; //!< file definition containing the function body }; - + /** Abstract interface for a Definition or DefinitionList */ class DefinitionIntf { @@ -75,23 +75,23 @@ class DefinitionIntf DefinitionIntf() {} virtual ~DefinitionIntf() {} /*! Types of derived classes */ - enum DefType - { - TypeClass = 0, - TypeFile = 1, - TypeNamespace = 2, - TypeMember = 3, - TypeGroup = 4, - TypePackage = 5, - TypePage = 6, - TypeDir = 7, + enum DefType + { + TypeClass = 0, + TypeFile = 1, + TypeNamespace = 2, + TypeMember = 3, + TypeGroup = 4, + TypePackage = 5, + TypePage = 6, + TypeDir = 7, TypeSymbolList = 8 }; /*! Use this for dynamic inspection of the type of the derived class */ virtual DefType definitionType() const = 0; }; -/** The common base class of all entity definitions found in the sources. +/** The common base class of all entity definitions found in the sources. * * This can be a class or a member function, or a file, or a namespace, etc. * Use definitionType() to find which type of definition this is. @@ -161,7 +161,7 @@ class Definition : public DefinitionIntf virtual QCString briefDescription(bool abbreviate=FALSE) const = 0; /*! Returns a plain text version of the brief description suitable for use - * as a tool tip. + * as a tool tip. */ virtual QCString briefDescriptionAsTooltip() const = 0; @@ -174,11 +174,11 @@ class Definition : public DefinitionIntf /*! Returns the file in which the in body documentation was found */ virtual QCString inbodyFile() const = 0; - /*! Returns the line at which the first in body documentation + /*! Returns the line at which the first in body documentation part was found */ virtual int inbodyLine() const = 0; - /*! Returns the file in which the brief description was found. + /*! Returns the file in which the brief description was found. * This can differ from getDefFileName(). */ virtual QCString briefFile() const = 0; @@ -195,8 +195,8 @@ class Definition : public DefinitionIntf /*! returns the column number at which the definition was found */ virtual int getDefColumn() const = 0; - /*! Returns TRUE iff the definition is documented - * (which could be generated documentation) + /*! Returns TRUE iff the definition is documented + * (which could be generated documentation) * @see hasUserDocumentation() */ virtual bool hasDocumentation() const = 0; @@ -205,17 +205,17 @@ class Definition : public DefinitionIntf virtual bool hasUserDocumentation() const = 0; /*! Returns TRUE iff it is possible to link to this item within this - * project. + * project. */ virtual bool isLinkableInProject() const = 0; /*! Returns TRUE iff it is possible to link to this item. This can - * be a link to another project imported via a tag file. + * be a link to another project imported via a tag file. */ virtual bool isLinkable() const = 0; - /*! Returns TRUE iff the name is part of this project and - * may appear in the output + /*! Returns TRUE iff the name is part of this project and + * may appear in the output */ virtual bool isVisibleInProject() const = 0; @@ -225,14 +225,14 @@ class Definition : public DefinitionIntf /*! Returns TRUE iff this item is supposed to be hidden from the output. */ virtual bool isHidden() const = 0; - /*! returns TRUE if this entity was artificially introduced, for - * instance because it is used to show a template instantiation relation. + /*! returns TRUE if this entity was artificially introduced, for + * instance because it is used to show a template instantiation relation. */ virtual bool isArtificial() const = 0; /*! If this definition was imported via a tag file, this function * returns the tagfile for the external project. This can be - * translated into an external link target via + * translated into an external link target via * Doxygen::tagDestinationDict */ virtual QCString getReference() const = 0; @@ -246,12 +246,12 @@ class Definition : public DefinitionIntf /*! Returns the first line of the implementation of this item. See also getDefLine() */ virtual int getStartDefLine() const = 0; - /*! Returns the first line of the body of this item (applicable to classes and + /*! Returns the first line of the body of this item (applicable to classes and * functions). */ virtual int getStartBodyLine() const = 0; - /*! Returns the last line of the body of this item (applicable to classes and + /*! Returns the last line of the body of this item (applicable to classes and * functions). */ virtual int getEndBodyLine() const = 0; @@ -267,7 +267,7 @@ class Definition : public DefinitionIntf virtual GroupList *partOfGroups() const = 0; virtual bool isLinkableViaGroup() const = 0; - virtual const std::vector &xrefListItems() const = 0; + virtual const RefItemVector &xrefListItems() const = 0; virtual Definition *findInnerCompound(const char *name) const = 0; virtual Definition *getOuterScope() const = 0; @@ -323,7 +323,7 @@ class Definition : public DefinitionIntf virtual void setBodySegment(int defLine, int bls,int ble) = 0; virtual void setBodyDef(FileDef *fd) = 0; - virtual void setRefItems(const std::vector &sli) = 0; + virtual void setRefItems(const RefItemVector &sli) = 0; virtual void setOuterScope(Definition *d) = 0; virtual void setHidden(bool b) = 0; @@ -338,7 +338,7 @@ class Definition : public DefinitionIntf virtual void makePartOfGroup(GroupDef *gd) = 0; - /*! Add the list of anchors that mark the sections that are found in the + /*! Add the list of anchors that mark the sections that are found in the * documentation. */ virtual void addSectionsToDefinition(const std::vector &anchorList) = 0; @@ -397,11 +397,11 @@ class DefinitionListIterator : public QListIterator }; /** Reads a fragment from file \a fileName starting with line \a startLine - * and ending with line \a endLine. The result is returned as a string - * via \a result. The function returns TRUE if successful and FALSE + * and ending with line \a endLine. The result is returned as a string + * via \a result. The function returns TRUE if successful and FALSE * in case of an error. */ -bool readCodeFragment(const char *fileName, +bool readCodeFragment(const char *fileName, int &startLine,int &endLine, QCString &result); #endif diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 28d60b6..c35a89e 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2019 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. * @@ -68,7 +68,7 @@ class DefinitionImpl : virtual public Definition virtual SrcLangExt getLanguage() const; virtual GroupList *partOfGroups() const; virtual bool isLinkableViaGroup() const; - virtual const std::vector &xrefListItems() const; + virtual const RefItemVector &xrefListItems() const; virtual Definition *findInnerCompound(const char *name) const; virtual Definition *getOuterScope() const; virtual MemberSDict *getReferencesMembers() const; @@ -90,7 +90,7 @@ class DefinitionImpl : virtual public Definition virtual void setBodyDef(FileDef *fd); virtual void addSourceReferencedBy(const MemberDef *d); virtual void addSourceReferences(const MemberDef *d); - virtual void setRefItems(const std::vector &sli); + virtual void setRefItems(const RefItemVector &sli); virtual void mergeRefItems(Definition *d); virtual void addInnerCompound(const Definition *d); virtual void setOuterScope(Definition *d); @@ -118,7 +118,7 @@ class DefinitionImpl : virtual public Definition DefinitionImpl(const DefinitionImpl &d); - private: + private: virtual void _setSymbolName(const QCString &name); virtual QCString _symbolName() const ; @@ -216,7 +216,7 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->partOfGroups(); } virtual bool isLinkableViaGroup() const { return m_def->isLinkableViaGroup(); } - virtual const std::vector &xrefListItems() const + virtual const RefItemVector &xrefListItems() const { return m_def->xrefListItems(); } virtual Definition *findInnerCompound(const char *name) const { return m_def->findInnerCompound(name); } @@ -236,9 +236,9 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->id(); } virtual const SectionRefs &getSectionRefs() const { return m_def->getSectionRefs(); } - virtual QCString navigationPathAsString() const + virtual QCString navigationPathAsString() const { return m_def->navigationPathAsString(); } - virtual QCString pathFragment() const + virtual QCString pathFragment() const { return m_def->pathFragment(); } virtual void setName(const char *) { } virtual void setId(const char *) { } @@ -252,7 +252,7 @@ class DefinitionAliasImpl : virtual public Definition virtual void setBodyDef(FileDef *) {} virtual void addSourceReferencedBy(const MemberDef *) {} virtual void addSourceReferences(const MemberDef *) {} - virtual void setRefItems(const std::vector &) {} + virtual void setRefItems(const RefItemVector &) {} virtual void mergeRefItems(Definition *) {} virtual void addInnerCompound(const Definition *) {} virtual void setOuterScope(Definition *) {} diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index a338bbf..ee07df5 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -16,8 +16,7 @@ #ifndef _DOCBOOKDOCVISITOR_H #define _DOCBOOKDOCVISITOR_H -#include - +#include "containers.h" #include "docvisitor.h" #include #include @@ -175,10 +174,10 @@ class DocbookDocVisitor : public DocVisitor CodeOutputInterface &m_ci; bool m_insidePre = false; bool m_hide = false; - std::stack m_enabled; + BoolStack m_enabled; QCString m_langExt; int m_colCnt = 0; - std::stack m_bodySet; // it is possible to have tables without a header, needs to be an array as we can have tables in tables + BoolStack m_bodySet; // it is possible to have tables without a header, needs to be an array as we can have tables in tables }; #endif diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index eb6c179..28967f4 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -13,8 +13,7 @@ * */ -#include - +#include "containers.h" #include "dotclassgraph.h" #include "dotnode.h" @@ -74,7 +73,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, QCString displayName=className; if (HIDE_SCOPE_NAMES) displayName=stripScope(displayName); QCString tmp_url; - if (cd->isLinkable() && !cd->isHidden()) + if (cd->isLinkable() && !cd->isHidden()) { tmp_url=cd->getReference()+"$"+cd->getOutputFileBase(); if (!cd->anchor().isEmpty()) @@ -123,9 +122,9 @@ void DotClassGraph::determineTruncatedNodes(QList &queue,bool includePa const DotNode *dn; for (li.toFirst();(dn=li.current());++li) { - if (!dn->isVisible()) + if (!dn->isVisible()) truncated = TRUE; - else + else queue.append(dn); } } @@ -135,9 +134,9 @@ void DotClassGraph::determineTruncatedNodes(QList &queue,bool includePa const DotNode *dn; for (li.toFirst();(dn=li.current());++li) { - if (!dn->isVisible()) + if (!dn->isVisible()) truncated = TRUE; - else + else queue.append(dn); } } @@ -151,11 +150,11 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, { QList childQueue; QList parentQueue; - std::vector childTreeWidth; - std::vector parentTreeWidth; + IntVector childTreeWidth; + IntVector parentTreeWidth; childQueue.append(rootNode); if (includeParents) parentQueue.append(rootNode); - bool firstNode=TRUE; // flag to force reprocessing rootNode in the parent loop + bool firstNode=TRUE; // flag to force reprocessing rootNode in the parent loop // despite being marked visible in the child loop while ((childQueue.count()>0 || parentQueue.count()>0) && maxNodes>0) { @@ -258,7 +257,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista //printf("-------- inheritance relation %s->%s templ='%s'\n", // cd->name().data(),bcd->classDef->name().data(),bcd->templSpecifiers.data()); addClass(bcd->classDef,n,bcd->prot,0,bcd->usedName, - bcd->templSpecifiers,base,distance); + bcd->templSpecifiers,base,distance); } } } @@ -284,7 +283,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista int maxLabels=10; for (;(s=dvi.currentKey()) && countdisplayName().data()); m_graphType = t; QCString tmp_url=""; - if (cd->isLinkable() && !cd->isHidden()) + if (cd->isLinkable() && !cd->isHidden()) { tmp_url=cd->getReference()+"$"+cd->getOutputFileBase(); if (!cd->anchor().isEmpty()) @@ -492,7 +491,7 @@ QCString DotClassGraph::getMapLabel() const return escapeCharsInString(m_startNode->label(),FALSE)+"_"+escapeCharsInString(mapName,FALSE); } -QCString DotClassGraph::getImgAltText() const +QCString DotClassGraph::getImgAltText() const { switch (m_graphType) { @@ -506,7 +505,7 @@ QCString DotClassGraph::getImgAltText() const ASSERT(0); break; } - return ""; + return ""; } QCString DotClassGraph::writeGraph(FTextStream &out, diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2709ea6..fb82bb2 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -865,7 +865,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr std::unique_ptr getTemplateArgumentsFromName( const QCString &name, - const std::vector &tArgLists) + const ArgumentLists &tArgLists) { // for each scope fragment, check if it is a template and advance through // the list if so. @@ -4874,7 +4874,7 @@ static void addListReferences() name = pd->getGroupDef()->getOutputFileBase(); } { - const std::vector &xrefItems = pd->xrefListItems(); + const RefItemVector &xrefItems = pd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trPage(TRUE,TRUE), @@ -4891,7 +4891,7 @@ static void addListReferences() //{ // name = dd->getGroupDef()->getOutputFileBase(); //} - const std::vector &xrefItems = dd->xrefListItems(); + const RefItemVector &xrefItems = dd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trDir(TRUE,TRUE), @@ -5229,8 +5229,8 @@ static bool findGlobalMember(const Entry *root, } static bool isSpecialization( - const std::vector &srcTempArgLists, - const std::vector &dstTempArgLists + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists ) { auto srcIt = srcTempArgLists.begin(); @@ -5256,8 +5256,8 @@ static bool scopeIsTemplate(const Definition *d) } static QCString substituteTemplatesInString( - const std::vector &srcTempArgLists, - const std::vector &dstTempArgLists, + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists, const QCString &src ) { @@ -5335,8 +5335,8 @@ static QCString substituteTemplatesInString( } static void substituteTemplatesInArgList( - const std::vector &srcTempArgLists, - const std::vector &dstTempArgLists, + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists, const ArgumentList &src, ArgumentList &dst ) @@ -5484,7 +5484,7 @@ static void addMemberFunction(const Entry *root, "4. class definition %s found\n",cd->name().data()); // get the template parameter lists found at the member declaration - std::vector declTemplArgs = cd->getTemplateParameterLists(); + ArgumentLists declTemplArgs = cd->getTemplateParameterLists(); const ArgumentList &templAl = md->templateArguments(); if (!templAl.empty()) { @@ -5492,7 +5492,7 @@ static void addMemberFunction(const Entry *root, } // get the template parameter lists found at the member definition - const std::vector &defTemplArgs = root->tArgLists; + const ArgumentLists &defTemplArgs = root->tArgLists; //printf("defTemplArgs=%p\n",defTemplArgs); // do we replace the decl argument lists with the def argument lists? diff --git a/src/doxygen.h b/src/doxygen.h index 275e1b9..3335974 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -22,10 +22,7 @@ #include #include -#include -#include -#include - +#include "containers.h" #include "ftextstream.h" #include "sortdict.h" #include "membergroup.h" @@ -85,11 +82,6 @@ struct LookupInfo QCString resolvedType; }; -using StringUnorderedMap = std::unordered_map; -using StringUnorderedSet = std::unordered_set; -using StringSet = std::set; -using StringVector = std::vector; - extern QCString g_spaces; /*! \brief This class serves as a namespace for global variables used by doxygen. @@ -107,7 +99,7 @@ class Doxygen static bool insideMainPage; static FileNameLinkedMap *includeNameLinkedMap; static FileNameLinkedMap *exampleNameLinkedMap; - static std::set inputPaths; + static StringSet inputPaths; static FileNameLinkedMap *inputNameLinkedMap; static FileNameLinkedMap *imageNameLinkedMap; static FileNameLinkedMap *dotFileNameLinkedMap; diff --git a/src/entry.h b/src/entry.h index 71c555c..bdc8ab8 100644 --- a/src/entry.h +++ b/src/entry.h @@ -25,11 +25,11 @@ #include "types.h" #include "arguments.h" +#include "reflist.h" class SectionInfo; class QFile; class FileDef; -class RefItem; /** This class stores information about an inheritance relation */ @@ -257,7 +257,7 @@ class Entry QCString args; //!< member argument string QCString bitfields; //!< member's bit fields ArgumentList argList; //!< member arguments as a list - std::vector tArgLists; //!< template argument declarations + ArgumentLists tArgLists; //!< template argument declarations QGString program; //!< the program text QGString initializer; //!< initial value (for variables) QCString includeFile; //!< include file (2 arg of \\class, must be unique) @@ -288,7 +288,7 @@ class Entry QCString fileName; //!< file this entry was extracted from int startLine; //!< start line of entry in the source int startColumn; //!< start column of entry in the source - std::vector sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in + RefItemVector sli; //!< special lists (test/todo/bug/deprecated/..) this entry is in SrcLangExt lang; //!< programming language in which this entry was found bool hidden; //!< does this represent an entity that is hidden from the output bool artificial; //!< Artificially introduced item diff --git a/src/filedef.cpp b/src/filedef.cpp index 454712b..7e8afdc 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1682,7 +1682,7 @@ bool FileDefImpl::generateSourceFile() const void FileDefImpl::addListReferences() { { - const std::vector &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trFile(TRUE,TRUE), diff --git a/src/formula.cpp b/src/formula.cpp index 6fd34e9..cb28aba 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -53,8 +53,8 @@ struct FormulaManager::Private } return DisplaySize(-1,-1); } - std::vector formulas; - std::map formulaMap; + StringVector formulas; + IntMap formulaMap; std::map displaySizeMap; }; @@ -163,7 +163,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c QDir thisDir; // generate a latex file containing one formula per page. QCString texName="_formulas.tex"; - std::vector formulasToGenerate; + IntVector formulasToGenerate; QFile f(texName); bool formulaError=FALSE; if (f.open(IO_WriteOnly)) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 0f8ca97..df053ed 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -1629,7 +1629,7 @@ QCString GroupDefImpl::getOutputFileBase() const void GroupDefImpl::addListReferences() { { - const std::vector &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trGroup(TRUE,TRUE), diff --git a/src/memberdef.cpp b/src/memberdef.cpp index c400412..ac7605d 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -205,7 +205,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual ArgumentList &argumentList(); virtual const ArgumentList &declArgumentList() const; virtual const ArgumentList &templateArguments() const; - virtual const std::vector &definitionTemplateParameterLists() const; + virtual const ArgumentLists &definitionTemplateParameterLists() const; virtual int getMemberGroupId() const; virtual MemberGroup *getMemberGroup() const; virtual bool fromAnonymousScope() const; @@ -277,7 +277,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual void setDeclFile(const QCString &df,int line,int column); virtual void moveArgumentList(std::unique_ptr al); virtual void moveDeclArgumentList(std::unique_ptr al); - virtual void setDefinitionTemplateParameterLists(const std::vector &lists); + virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists); virtual void setTypeConstraints(const ArgumentList &al); virtual void setType(const char *t); virtual void setAccessorType(ClassDef *cd,const char *t); @@ -666,7 +666,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef { return getMdAlias()->declArgumentList(); } virtual const ArgumentList &templateArguments() const { return getMdAlias()->templateArguments(); } - virtual const std::vector &definitionTemplateParameterLists() const + virtual const ArgumentLists &definitionTemplateParameterLists() const { return getMdAlias()->definitionTemplateParameterLists(); } virtual int getMemberGroupId() const { return getMdAlias()->getMemberGroupId(); } @@ -789,7 +789,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef virtual void setDeclFile(const QCString &df,int line,int column) {} virtual void moveArgumentList(std::unique_ptr al) {} virtual void moveDeclArgumentList(std::unique_ptr al) {} - virtual void setDefinitionTemplateParameterLists(const std::vector &lists) {} + virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) {} virtual void setTypeConstraints(const ArgumentList &al) {} virtual void setType(const char *t) {} virtual void setAccessorType(ClassDef *cd,const char *t) {} @@ -1324,7 +1324,7 @@ class MemberDefImpl::IMPL ArgumentList tArgList; // template argument list of function template ArgumentList typeConstraints; // type constraints for template parameters MemberDef *templateMaster; - std::vector defTmpArgLists; // lists of template argument lists + ArgumentLists defTmpArgLists; // lists of template argument lists // (for template functions in nested template classes) QCString metaData; // Slice metadata. @@ -1960,7 +1960,7 @@ bool MemberDefImpl::isLinkable() const } -void MemberDefImpl::setDefinitionTemplateParameterLists(const std::vector &lists) +void MemberDefImpl::setDefinitionTemplateParameterLists(const ArgumentLists &lists) { m_impl->defTmpArgLists = lists; } @@ -4454,7 +4454,7 @@ void MemberDefImpl::addListReference(Definition *) memArgs = argsString(); } } - const std::vector &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName()+argsString(), // argsString is needed for overloaded functions (see bug 609624) memLabel, @@ -5480,7 +5480,7 @@ const ArgumentList &MemberDefImpl::templateArguments() const return m_impl->tArgList; } -const std::vector &MemberDefImpl::definitionTemplateParameterLists() const +const ArgumentLists &MemberDefImpl::definitionTemplateParameterLists() const { return m_impl->defTmpArgLists; } diff --git a/src/memberdef.h b/src/memberdef.h index 4deb04a..4a488d9 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -26,6 +26,7 @@ #include "types.h" #include "definition.h" +#include "arguments.h" class ClassDef; class NamespaceDef; @@ -37,7 +38,6 @@ class ExampleSDict; class OutputList; class GroupDef; class QTextStream; -class ArgumentList; class QStrList; struct TagInfo; @@ -228,7 +228,7 @@ class MemberDef : virtual public Definition virtual ArgumentList &argumentList() = 0; virtual const ArgumentList &declArgumentList() const = 0; virtual const ArgumentList &templateArguments() const = 0; - virtual const std::vector &definitionTemplateParameterLists() const = 0; + virtual const ArgumentLists &definitionTemplateParameterLists() const = 0; // member group related members virtual int getMemberGroupId() const = 0; @@ -336,7 +336,7 @@ class MemberDef : virtual public Definition // argument related members virtual void moveArgumentList(std::unique_ptr al) = 0; virtual void moveDeclArgumentList(std::unique_ptr al) = 0; - virtual void setDefinitionTemplateParameterLists(const std::vector &lists) = 0; + virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) = 0; virtual void setTypeConstraints(const ArgumentList &al) = 0; virtual void setType(const char *t) = 0; virtual void setAccessorType(ClassDef *cd,const char *t) = 0; diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 930426b..523b577 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 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. * @@ -253,49 +253,49 @@ int MemberGroup::varCount() const return memberList->varCount(); } -int MemberGroup::funcCount() const -{ - return memberList->funcCount(); +int MemberGroup::funcCount() const +{ + return memberList->funcCount(); } -int MemberGroup::enumCount() const -{ - return memberList->enumCount(); +int MemberGroup::enumCount() const +{ + return memberList->enumCount(); } -int MemberGroup::enumValueCount() const -{ - return memberList->enumValueCount(); +int MemberGroup::enumValueCount() const +{ + return memberList->enumValueCount(); } -int MemberGroup::typedefCount() const -{ - return memberList->typedefCount(); +int MemberGroup::typedefCount() const +{ + return memberList->typedefCount(); } -int MemberGroup::sequenceCount() const -{ - return memberList->sequenceCount(); +int MemberGroup::sequenceCount() const +{ + return memberList->sequenceCount(); } -int MemberGroup::dictionaryCount() const -{ - return memberList->dictionaryCount(); +int MemberGroup::dictionaryCount() const +{ + return memberList->dictionaryCount(); } -int MemberGroup::protoCount() const -{ - return memberList->protoCount(); +int MemberGroup::protoCount() const +{ + return memberList->protoCount(); } -int MemberGroup::defineCount() const -{ - return memberList->defineCount(); +int MemberGroup::defineCount() const +{ + return memberList->defineCount(); } -int MemberGroup::friendCount() const -{ - return memberList->friendCount(); +int MemberGroup::friendCount() const +{ + return memberList->friendCount(); } #endif @@ -356,7 +356,7 @@ void MemberGroup::findSectionsInDocumentation(const Definition *d) memberList->findSectionsInDocumentation(d); } -void MemberGroup::setRefItems(const std::vector &sli) +void MemberGroup::setRefItems(const RefItemVector &sli) { m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend()); } @@ -368,7 +368,7 @@ void MemberGroup::writeTagFile(FTextStream &tagFile) //-------------------------------------------------------------------------- -void MemberGroupInfo::setRefItems(const std::vector &sli) +void MemberGroupInfo::setRefItems(const RefItemVector &sli) { m_sli.insert(m_sli.end(), sli.cbegin(), sli.cend()); } diff --git a/src/membergroup.h b/src/membergroup.h index c1433cf..3b8e0fc 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 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. * @@ -23,6 +23,7 @@ #include #include "sortdict.h" #include "types.h" +#include "reflist.h" #define DOX_NOGROUP -1 @@ -38,7 +39,7 @@ class FTextStream; class RefItem; /** A class representing a group of members. */ -class MemberGroup +class MemberGroup { public: MemberGroup(); @@ -81,14 +82,14 @@ class MemberGroup int countInheritableMembers(const ClassDef *inheritedFrom) const; void setInGroup(bool b); void addListReferences(Definition *d); - void setRefItems(const std::vector &sli); + void setRefItems(const RefItemVector &sli); MemberList *members() const { return memberList; } QCString anchor() const; QCString docFile() const { return m_docFile; } int docLine() const { return m_docLine; } - private: + private: MemberList *memberList = 0; // list of all members in the group MemberList *inDeclSection = 0; int grpId = 0; @@ -100,7 +101,7 @@ class MemberGroup int m_numDocMembers = 0; QCString m_docFile; int m_docLine = 0; - std::vector m_xrefListItems; + RefItemVector m_xrefListItems; }; /** A list of MemberGroup objects. */ @@ -112,7 +113,7 @@ class MemberGroupList : public QList class MemberGroupListIterator : public QListIterator { public: - MemberGroupListIterator(const MemberGroupList &l) : + MemberGroupListIterator(const MemberGroupList &l) : QListIterator(l) {} }; @@ -132,13 +133,13 @@ class MemberGroupSDict : public SIntDict /** Data collected for a member group */ struct MemberGroupInfo { - void setRefItems(const std::vector &sli); + void setRefItems(const RefItemVector &sli); QCString header; QCString doc; QCString docFile; int docLine = -1; QCString compoundName; - std::vector m_sli; + RefItemVector m_sli; }; #endif diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 50e50a6..51454e0 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -1261,7 +1261,7 @@ void NamespaceDefImpl::addListReferences() { //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); { - const std::vector &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), getLanguage()==SrcLangExt_Fortran ? diff --git a/src/pre.l b/src/pre.l index e83a204..da67db5 100644 --- a/src/pre.l +++ b/src/pre.l @@ -29,10 +29,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -44,6 +40,7 @@ #include #include +#include "containers.h" #include "pre.h" #include "constexp.h" #include "define.h" @@ -134,11 +131,11 @@ class DefineManager { m_includedFiles.insert(fileName); } - void collectDefines(DefineMapRef &map,std::set &includeStack); + void collectDefines(DefineMapRef &map,StringSet &includeStack); private: DefineManager *m_parent; DefineMapOwning m_defines; - std::set m_includedFiles; + StringSet m_includedFiles; }; public: @@ -197,7 +194,7 @@ class DefineManager else { //printf("existing file!\n"); - std::set includeStack; + StringSet includeStack; it->second->collectDefines(m_contextDefines,includeStack); } } @@ -279,7 +276,7 @@ class DefineManager auto it = m_fileMap.find(fileName); if (it!=m_fileMap.end()) { - std::set includeStack; + StringSet includeStack; it->second->collectDefines(map,includeStack); } } @@ -305,7 +302,7 @@ class DefineManager * case there is a cyclic include dependency. */ void DefineManager::DefinesPerFile::collectDefines( - DefineMapRef &map,std::set &includeStack) + DefineMapRef &map,StringSet &includeStack) { //printf("DefinesPerFile::collectDefines #defines=%d\n",m_defines.count()); { @@ -335,7 +332,7 @@ void DefineManager::DefinesPerFile::collectDefines( * * global state */ -static std::unordered_set g_allIncludes; +static StringUnorderedSet g_allIncludes; static DefineManager g_defineManager; @@ -391,13 +388,13 @@ struct preYY_state yy_size_t fenceSize = 0; bool ccomment = false; QCString delimiter; - std::vector pathList; - std::map argMap; - std::stack levelGuard; + StringVector pathList; + IntMap argMap; + BoolStack levelGuard; std::stack< std::unique_ptr > condStack; std::deque< std::unique_ptr > includeStack; - std::map expandedDict; - std::unordered_set expanded; + std::unordered_map expandedDict; + StringUnorderedSet expanded; ConstExpressionParser constExpParser; }; diff --git a/src/reflist.cpp b/src/reflist.cpp index 26d20ae..feced5c 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -17,11 +17,34 @@ #include #include "reflist.h" +#include "util.h" #include "ftextstream.h" #include "definition.h" #include "sortdict.h" #include "config.h" +RefList::RefList(const char *listName, const char *pageTitle, const char *secTitle) : + m_listName(listName), m_fileName(convertNameToFile(listName,FALSE,TRUE)), + m_pageTitle(pageTitle), m_secTitle(secTitle) +{ +} + +RefItem *RefList::add() +{ + m_id++; + std::unique_ptr item = std::make_unique(m_id,this); + RefItem *result = item.get(); + m_entries.push_back(std::move(item)); + m_lookup.insert({m_id,result}); + return result; +} + +RefItem *RefList::find(int itemId) +{ + auto it = m_lookup.find(itemId); + return it!=m_lookup.end() ? it->second : nullptr; +} + bool RefList::isEnabled() const { if (m_listName=="todo" && !Config_getBool(GENERATE_TODOLIST)) return false; @@ -96,6 +119,6 @@ void RefList::generatePage() } doc += "\n"; //printf("generatePage('%s')\n",doc.data()); - addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,std::vector(),0,0,TRUE); + addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,RefItemVector(),0,0,TRUE); } diff --git a/src/reflist.h b/src/reflist.h index 19636f1..0ced63b 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -22,7 +22,6 @@ #include #include -#include "util.h" #include "linkedmap.h" class Definition; @@ -85,34 +84,19 @@ class RefList * @param pageTitle String representing the title of the list page. * @param secTitle String representing the title of the section. */ - RefList(const char *listName, const char *pageTitle, const char *secTitle) : - m_listName(listName), m_fileName(convertNameToFile(listName,FALSE,TRUE)), - m_pageTitle(pageTitle), m_secTitle(secTitle) {} - + RefList(const char *listName, const char *pageTitle, const char *secTitle); bool isEnabled() const; /*! Adds a new item to the list. * @returns A unique id for this item. */ - RefItem *add() - { - m_id++; - std::unique_ptr item = std::make_unique(m_id,this); - RefItem *result = item.get(); - m_entries.push_back(std::move(item)); - m_lookup.insert({m_id,result}); - return result; - } + RefItem *add(); /*! Returns an item given it's id that is obtained with addRefItem() * @param itemId item's identifier. * @returns A pointer to the todo item's structure. */ - RefItem *find(int itemId) - { - auto it = m_lookup.find(itemId); - return it!=m_lookup.end() ? it->second : nullptr; - } + RefItem *find(int itemId); QCString listName() const { return m_listName; } QCString fileName() const { return m_fileName; } @@ -146,4 +130,6 @@ class RefListManager : public LinkedMap RefListManager &operator=(const RefListManager &other) = delete; }; +using RefItemVector = std::vector; + #endif diff --git a/src/util.cpp b/src/util.cpp index 58094d9..5b409ea 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6131,7 +6131,7 @@ found: PageDef *addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc, const char *fileName,int startLine, - const std::vector &sli, + const RefItemVector &sli, GroupDef *gd, const TagInfo *tagInfo, bool xref, @@ -6218,7 +6218,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- -void addRefItem(const std::vector &sli, +void addRefItem(const RefItemVector &sli, const char *key, const char *prefix, const char *name,const char *title,const char *args,const Definition *scope) { diff --git a/src/util.h b/src/util.h index da17ff2..f8befa2 100644 --- a/src/util.h +++ b/src/util.h @@ -327,7 +327,7 @@ int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); -void addRefItem(const std::vector &sli, +void addRefItem(const RefItemVector &sli, const char *key, const char *prefix, const char *name, @@ -339,7 +339,7 @@ PageDef *addRelatedPage(const char *name, const QCString &ptitle, const QCString &doc, const char *fileName,int startLine, - const std::vector &sli = std::vector(), + const RefItemVector &sli = RefItemVector(), GroupDef *gd=0, const TagInfo *tagInfo=0, bool xref=FALSE, diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index 725349e..ea60dd6 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -13,6 +13,7 @@ #include #include #include +#include "containers.h" #include "vhdljjparser.h" #include "vhdldocgen.h" #include "message.h" @@ -63,7 +64,7 @@ struct VHDLOutlineParser::Private QCString yyFileName; int yyLineNr = 1; - std::vector lineParse; + IntVector lineParse; int iDocLine = -1; QCString inputString; Entry* gBlock = 0; @@ -84,7 +85,7 @@ struct VHDLOutlineParser::Private }; void VHDLOutlineParser::Private::parseVhdlfile(const char *fileName, - const char* inputBuffer,bool inLine) + const char* inputBuffer,bool inLine) { JAVACC_STRING_TYPE s =inputBuffer; CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1); @@ -237,15 +238,15 @@ static int idCounter; /** returns a unique id for each record member. * -* type first_rec is record +* type first_rec is record * RE: data_type; * end; -* -* type second_rec is record +* +* type second_rec is record * RE: data_type; * end; */ - + QString VHDLOutlineParser::getNameID(){ return QString::number(idCounter++,10); } @@ -300,7 +301,7 @@ void VHDLOutlineParser::handleCommentBlock(const char* doc1,bool brief) { s->current->docLine = p->yyLineNr; } - + int j=doc.find("[plant]"); if (j>=0) { -- cgit v0.12