diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-05-09 18:27:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 18:27:43 (GMT) |
commit | 63142f066154202822b311ffb0a8c3ac67fb8196 (patch) | |
tree | 5ffb3c67bf9e659626efa05c848acf843bdc9ab5 | |
parent | eb96e89aa0038feacdf822f13e1c55e5c35f968b (diff) | |
parent | e24bad3c5d841435f42bd3ff7a39bdf551471c34 (diff) | |
download | Doxygen-63142f066154202822b311ffb0a8c3ac67fb8196.zip Doxygen-63142f066154202822b311ffb0a8c3ac67fb8196.tar.gz Doxygen-63142f066154202822b311ffb0a8c3ac67fb8196.tar.bz2 |
Merge branch 'master' into feature/issue_7738
40 files changed, 771 insertions, 586 deletions
diff --git a/doc/index.doc b/doc/index.doc index 97aca86..f55a504 100644 --- a/doc/index.doc +++ b/doc/index.doc @@ -153,9 +153,8 @@ know and I'll add them. Although doxygen is successfully used by large number of companies and open source projects already, there is always room for improvement. <p> -You can submit enhancement requests in +You can also submit enhancement requests in <a href="https://github.com/doxygen/doxygen/issues">the bug tracker</a>. -Make sure the severity of the bug report is set to "enhancement". <h2>Acknowledgments</h2> \addindex acknowledgments diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 146f67f..780352a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -283,6 +283,13 @@ add_library(_doxygen STATIC xmlgen.cpp ) +# LLVM/clang headers give a lot of warnings with -Wshadow and -Wcast-align so we disable them for +# the one file that includes them + +if (NOT MSVC) +set_source_files_properties(clangparser.cpp PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-cast-align") +endif() + ##foreach(lex_file ${LEX_FILES}) ##add_library(_doxygen STATIC ${GENERATED_SRC}/${lex_file}.l.h) ##endforeach() diff --git a/src/arguments.h b/src/arguments.h index 491b582..181a8d3 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -90,7 +90,7 @@ class ArgumentList const_iterator cbegin() const { return m_args.cbegin(); } const_iterator cend() const { return m_args.cend(); } bool empty() const { return m_args.empty(); } - int size() const { return m_args.size(); } + size_t size() const { return m_args.size(); } void clear() { m_args.clear(); } void push_back(const Argument &a) { m_args.push_back(a); } Argument &back() { return m_args.back(); } @@ -133,7 +133,8 @@ class ArgumentList RefQualifierType m_refQualifier = RefQualifierNone; /*! is it an explicit empty list */ bool m_noParameters = FALSE; - }; +using ArgumentLists = std::vector<ArgumentList>; + #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<ArgumentList> getTemplateParameterLists() const; + virtual ArgumentLists getTemplateParameterLists() const; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *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<ArgumentList> getTemplateParameterLists() const + virtual ArgumentLists getTemplateParameterLists() const { return getCdAlias()->getTemplateParameterLists(); } virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *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<ArgumentList> &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<ArgumentList> 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<ArgumentList> ClassDefImpl::getTemplateParameterLists() const +ArgumentLists ClassDefImpl::getTemplateParameterLists() const { - std::vector<ArgumentList> result; + ArgumentLists result; Definition *d=getOuterScope(); while (d && d->definitionType()==Definition::TypeClass) { @@ -4232,7 +4232,7 @@ std::vector<ArgumentList> ClassDefImpl::getTemplateParameterLists() const } QCString ClassDefImpl::qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *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<RefItem*> &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 <qptrdict.h> #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<ArgumentList> getTemplateParameterLists() const = 0; + virtual ArgumentLists getTemplateParameterLists() const = 0; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *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. @@ -396,7 +396,7 @@ CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" -LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" +LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>" BITOP "&"|"|"|"^"|"<<"|">>"|"~" OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" diff --git a/src/commentcnv.l b/src/commentcnv.l index 63ecaaf..e05634a 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -71,7 +71,7 @@ struct commentcnvYY_state { BufStr * inBuf = 0; BufStr * outBuf = 0; - int inBufPos = 0; + yy_size_t inBufPos = 0; int col = 0; int blockHeadCol = 0; bool mlBrief = FALSE; 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 <vector> +#include <string> +#include <set> +#include <map> +#include <unordered_set> +#include <unordered_map> +#include <stack> + +using StringUnorderedMap = std::unordered_map<std::string,std::string>; +using StringUnorderedSet = std::unordered_set<std::string>; +using StringSet = std::set<std::string>; +using StringVector = std::vector<std::string>; +using BoolStack = std::stack<bool>; +using BoolVector = std::vector<bool>; +using IntMap = std::map<std::string,int>; +using IntVector = std::vector<int>; + +#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<RefItem*> 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 (lineMarkerPos<fileMarkerPos) // line marker before file marker { // write text left from linePos marker - ol.parseText(refText.left(lineMarkerPos)); + ol.parseText(refText.left(lineMarkerPos)); ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Man); if (!latexSourceCode) { ol.disable(OutputGenerator::Latex); @@ -1050,7 +1050,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); } @@ -1065,13 +1065,13 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const // write normal text (Man, Latex optionally, RTF optionally) ol.docify(lineStr); ol.popGeneratorState(); - + // write text between markers ol.parseText(refText.mid(lineMarkerPos+2, fileMarkerPos-lineMarkerPos-2)); ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Man); if (!latexSourceCode) { ol.disable(OutputGenerator::Latex); @@ -1088,7 +1088,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); } @@ -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=="<globalScope>") + if (m_impl->localName=="<globalScope>") { //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<RefItem*> &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<RefItem*> &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<bool> 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(" <title>" + theTranslator->trRTFTableOfContents() + "</title>\n"); int level=1,l; int maxLevel = localToc.docbookLevel(); - std::vector<bool> 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():"<none>"); - 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<const MemberDef*>(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 <qdict.h> #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<RefItem*> &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<RefItem*> &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<const SectionInfo*> &anchorList) = 0; @@ -397,11 +397,11 @@ class DefinitionListIterator : public QListIterator<Definition> }; /** 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<RefItem*> &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<RefItem*> &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<RefItem*> &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<RefItem*> &) {} + 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 <stack> - +#include "containers.h" #include "docvisitor.h" #include <qstack.h> #include <qlist.h> @@ -175,10 +174,10 @@ class DocbookDocVisitor : public DocVisitor CodeOutputInterface &m_ci; bool m_insidePre = false; bool m_hide = false; - std::stack<bool> m_enabled; + BoolStack m_enabled; QCString m_langExt; int m_colCnt = 0; - std::stack<bool> 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/doctokenizer.l b/src/doctokenizer.l index de7d162..5317de5 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -55,7 +55,7 @@ // context for tokenizer phase static int g_commentState; TokenInfo *g_token = 0; -static int g_inputPos = 0; +static yy_size_t g_inputPos = 0; static const char *g_inputString; static QCString g_fileName; static bool g_insidePre; @@ -395,7 +395,7 @@ FUNCARG "("{FUNCPART}")"({BLANK}*("volatile"|"const"){BLANK})? FUNCARG2 "("{FUNCPART}")"({BLANK}*("volatile"|"const"))? OPNEW {BLANK}+"new"({BLANK}*"[]")? OPDEL {BLANK}+"delete"({BLANK}*"[]")? -OPNORM {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()" +OPNORM {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()"|"<=>" OPCAST {BLANK}+[^<(\r\n.,][^(\r\n.,]* OPMASK ({BLANK}*{OPNORM}{FUNCARG}) OPMASKOPT ({BLANK}*{OPNORM}{FUNCARG}?)|({OPCAST}{FUNCARG}) diff --git a/src/dot.cpp b/src/dot.cpp index acf4db9..675ead6 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -83,6 +83,12 @@ DotManager *DotManager::instance() return m_theInstance; } +void DotManager::deleteInstance() +{ + delete m_theInstance; + m_theInstance=0; +} + DotManager::DotManager() : m_runners(), m_filePatchers() { m_queue = new DotRunnerQueue; @@ -92,18 +98,17 @@ DotManager::DotManager() : m_runners(), m_filePatchers() { for (i=0;i<dotNumThreads;i++) { - DotWorkerThread *thread = new DotWorkerThread(m_queue); + std::unique_ptr<DotWorkerThread> thread = std::make_unique<DotWorkerThread>(m_queue); thread->start(); if (thread->isRunning()) { - m_workers.append(thread); + m_workers.push_back(std::move(thread)); } else // no more threads available! { - delete thread; } } - ASSERT(m_workers.count()>0); + ASSERT(m_workers.size()>0); } } @@ -140,7 +145,7 @@ DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName) auto patcher = m_filePatchers.find(fileName); if (patcher != m_filePatchers.end()) return &(patcher->second); - + auto rv = m_filePatchers.emplace(fileName, fileName.c_str()); assert(rv.second); return &(rv.first->second); @@ -148,20 +153,20 @@ DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName) bool DotManager::run() const { - uint numDotRuns = m_runners.size(); - uint numFilePatchers = m_filePatchers.size(); + size_t numDotRuns = m_runners.size(); + size_t numFilePatchers = m_filePatchers.size(); if (numDotRuns+numFilePatchers>1) { - if (m_workers.count()==0) + if (m_workers.size()==0) { msg("Generating dot graphs in single threaded mode...\n"); } else { - msg("Generating dot graphs using %d parallel threads...\n",QMIN(numDotRuns+numFilePatchers,m_workers.count())); + msg("Generating dot graphs using %zu parallel threads...\n",QMIN(numDotRuns+numFilePatchers,m_workers.size())); } } - int i=1; + size_t i=1; bool setPath=FALSE; if (Config_getBool(GENERATE_HTML)) @@ -186,12 +191,12 @@ bool DotManager::run() const } Portable::sysTimerStart(); // fill work queue with dot operations - int prev=1; - if (m_workers.count()==0) // no threads to work with + size_t prev=1; + if (m_workers.size()==0) // no threads to work with { for (auto & dr : m_runners) { - msg("Running dot for graph %d/%d\n",prev,numDotRuns); + msg("Running dot for graph %zu/%zu\n",prev,numDotRuns); dr.second->run(); prev++; } @@ -203,28 +208,28 @@ bool DotManager::run() const m_queue->enqueue(dr.second.get()); } // wait for the queue to become empty - while ((i=m_queue->count())>0) + while ((i=m_queue->size())>0) { i = numDotRuns - i; while (i>=prev) { - msg("Running dot for graph %d/%d\n",prev,numDotRuns); + msg("Running dot for graph %zu/%zu\n",prev,numDotRuns); prev++; } Portable::sleep(100); } - while ((int)numDotRuns>=prev) + while (numDotRuns>=prev) { - msg("Running dot for graph %d/%d\n",prev,numDotRuns); + msg("Running dot for graph %zu/%zu\n",prev,numDotRuns); prev++; } // signal the workers we are done - for (i=0;i<(int)m_workers.count();i++) + for (i=0;i<m_workers.size();i++) { m_queue->enqueue(0); // add terminator for each worker } // wait for the workers to finish - for (i=0;i<(int)m_workers.count();i++) + for (i=0;i<m_workers.size();i++) { m_workers.at(i)->wait(); } @@ -239,13 +244,13 @@ bool DotManager::run() const i=1; // since patching the svg files may involve patching the header of the SVG // (for zoomable SVGs), and patching the .html files requires reading that - // header after the SVG is patched, we first process the .svg files and - // then the other files. + // header after the SVG is patched, we first process the .svg files and + // then the other files. for (auto & fp : m_filePatchers) { if (fp.second.isSVGFile()) { - msg("Patching output file %d/%d\n",i,numFilePatchers); + msg("Patching output file %zu/%zu\n",i,numFilePatchers); if (!fp.second.run()) return FALSE; i++; } @@ -254,7 +259,7 @@ bool DotManager::run() const { if (!fp.second.isSVGFile()) { - msg("Patching output file %d/%d\n",i,numFilePatchers); + msg("Patching output file %zu/%zu\n",i,numFilePatchers); if (!fp.second.run()) return FALSE; i++; } @@ -16,7 +16,6 @@ #ifndef DOT_H #define DOT_H -#include <qlist.h> #include <qcstring.h> #include <map> @@ -35,6 +34,7 @@ class DotManager { public: static DotManager *instance(); + static void deleteInstance(); DotRunner* createRunner(const std::string& absDotName, const std::string& md5Hash); DotFilePatcher *createFilePatcher(const std::string &fileName); bool run() const; @@ -47,7 +47,7 @@ class DotManager std::map<std::string, DotFilePatcher> m_filePatchers; static DotManager *m_theInstance; DotRunnerQueue *m_queue; - QList<DotWorkerThread> m_workers; + std::vector< std::unique_ptr<DotWorkerThread> > m_workers; }; void writeDotGraphFromFile(const char *inFile,const char *outDir, 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 <vector> - +#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<DotNode> &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<DotNode> &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<DotNode> childQueue; QList<DotNode> parentQueue; - std::vector<int> childTreeWidth; - std::vector<int> 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()) && count<maxLabels;++dvi,++count) { - if (first) + if (first) { label=s; first=FALSE; @@ -379,7 +378,7 @@ DotClassGraph::DotClassGraph(const ClassDef *cd,GraphType t) //printf("--------------- DotClassGraph::DotClassGraph '%s'\n",cd->displayName().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/dotrunner.cpp b/src/dotrunner.cpp index c9ff284..8cf09fa 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -272,7 +272,7 @@ DotRunner *DotRunnerQueue::dequeue() return result; } -uint DotRunnerQueue::count() const +size_t DotRunnerQueue::size() const { std::lock_guard<std::mutex> locker(m_mutex); return m_queue.size(); @@ -285,6 +285,14 @@ DotWorkerThread::DotWorkerThread(DotRunnerQueue *queue) { } +DotWorkerThread::~DotWorkerThread() +{ + if (isRunning()) + { + wait(); + } +} + void DotWorkerThread::run() { DotRunner *runner; diff --git a/src/dotrunner.h b/src/dotrunner.h index 555ea78..1b54617 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -16,7 +16,6 @@ #ifndef DOTRUNNER_H #define DOTRUNNER_H -#include <qglobal.h> //uint #include <string> #include <thread> #include <list> @@ -72,7 +71,7 @@ class DotRunnerQueue public: void enqueue(DotRunner *runner); DotRunner *dequeue(); - uint count() const; + size_t size() const; private: std::condition_variable m_bufferNotEmpty; std::queue<DotRunner *> m_queue; @@ -80,10 +79,11 @@ class DotRunnerQueue }; /** Worker thread to execute a dot run */ -class DotWorkerThread +class DotWorkerThread { public: DotWorkerThread(DotRunnerQueue *queue); + ~DotWorkerThread(); void run(); void start(); bool isRunning() { return m_thread && m_thread->joinable(); } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 8c72b65..41d7b0a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -127,16 +127,16 @@ GroupSDict *Doxygen::groupSDict = 0; PageSDict *Doxygen::pageSDict = 0; PageSDict *Doxygen::exampleSDict = 0; StringDict Doxygen::aliasDict(257); // aliases -std::set<std::string> Doxygen::inputPaths; +StringSet Doxygen::inputPaths; FileNameLinkedMap *Doxygen::includeNameLinkedMap = 0; // include names FileNameLinkedMap *Doxygen::exampleNameLinkedMap = 0; // examples FileNameLinkedMap *Doxygen::imageNameLinkedMap = 0; // images FileNameLinkedMap *Doxygen::dotFileNameLinkedMap = 0; // dot files FileNameLinkedMap *Doxygen::mscFileNameLinkedMap = 0; // msc files FileNameLinkedMap *Doxygen::diaFileNameLinkedMap = 0; // dia files -StringMap Doxygen::namespaceAliasMap; // all namespace aliases +StringUnorderedMap Doxygen::namespaceAliasMap; // all namespace aliases StringDict Doxygen::tagDestinationDict(257); // all tag locations -std::unordered_set<std::string> Doxygen::expandAsDefinedSet; // all macros that should be expanded +StringUnorderedSet Doxygen::expandAsDefinedSet; // all macros that should be expanded QIntDict<MemberGroupInfo> Doxygen::memGrpInfoDict(1009); // dictionary of the member groups heading PageDef *Doxygen::mainPage = 0; bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page? @@ -168,7 +168,7 @@ Preprocessor *Doxygen::preprocessor = 0; // locally accessible globals static std::unordered_map< std::string, const Entry* > g_classEntries; -static StringList g_inputFiles; +static StringVector g_inputFiles; static QDict<void> g_compoundKeywordDict(7); // keywords recognised as compounds static OutputList *g_outputList = 0; // list of output generating objects static QDict<FileDef> g_usingDeclarations(1009); // used classes @@ -865,7 +865,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr std::unique_ptr<ArgumentList> getTemplateArgumentsFromName( const QCString &name, - const std::vector<ArgumentList> &tArgLists) + const ArgumentLists &tArgLists) { // for each scope fragment, check if it is a template and advance through // the list if so. @@ -3018,8 +3018,13 @@ static void addMethodToClass(const Entry *root,ClassDef *cd, else mtype=MemberType_Function; // strip redundant template specifier for constructors + int j = -1; if ((fd==0 || fd->getLanguage()==SrcLangExt_Cpp) && - name.left(9)!="operator " && (i=name.find('<'))!=-1 && name.find('>')!=-1) + name.left(9)!="operator " && // not operator + (i=name.find('<'))!=-1 && // containing < + (j=name.find('>'))!=-1 && // or > + (j!=i+2 || name.at(i+1)!='=') // but not the C++20 spaceship operator <=> + ) { name=name.left(i); } @@ -4704,7 +4709,7 @@ static void computeClassRelations() { findBaseClassesForClass(root,cd,cd,cd,DocumentedOnly,FALSE); } - int numMembers = cd ? cd->memberNameInfoLinkedMap().size() : 0; + size_t numMembers = cd ? cd->memberNameInfoLinkedMap().size() : 0; if ((cd==0 || (!cd->hasDocumentation() && !cd->isReference())) && numMembers>0 && bName.right(2)!="::") { @@ -4874,7 +4879,7 @@ static void addListReferences() name = pd->getGroupDef()->getOutputFileBase(); } { - const std::vector<RefItem*> &xrefItems = pd->xrefListItems(); + const RefItemVector &xrefItems = pd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trPage(TRUE,TRUE), @@ -4891,7 +4896,7 @@ static void addListReferences() //{ // name = dd->getGroupDef()->getOutputFileBase(); //} - const std::vector<RefItem*> &xrefItems = dd->xrefListItems(); + const RefItemVector &xrefItems = dd->xrefListItems(); addRefItem(xrefItems, name, theTranslator->trDir(TRUE,TRUE), @@ -5229,8 +5234,8 @@ static bool findGlobalMember(const Entry *root, } static bool isSpecialization( - const std::vector<ArgumentList> &srcTempArgLists, - const std::vector<ArgumentList> &dstTempArgLists + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists ) { auto srcIt = srcTempArgLists.begin(); @@ -5256,8 +5261,8 @@ static bool scopeIsTemplate(const Definition *d) } static QCString substituteTemplatesInString( - const std::vector<ArgumentList> &srcTempArgLists, - const std::vector<ArgumentList> &dstTempArgLists, + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists, const QCString &src ) { @@ -5335,8 +5340,8 @@ static QCString substituteTemplatesInString( } static void substituteTemplatesInArgList( - const std::vector<ArgumentList> &srcTempArgLists, - const std::vector<ArgumentList> &dstTempArgLists, + const ArgumentLists &srcTempArgLists, + const ArgumentLists &dstTempArgLists, const ArgumentList &src, ArgumentList &dst ) @@ -5484,7 +5489,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<ArgumentList> declTemplArgs = cd->getTemplateParameterLists(); + ArgumentLists declTemplArgs = cd->getTemplateParameterLists(); const ArgumentList &templAl = md->templateArguments(); if (!templAl.empty()) { @@ -5492,7 +5497,7 @@ static void addMemberFunction(const Entry *root, } // get the template parameter lists found at the member definition - const std::vector<ArgumentList> &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? @@ -8435,7 +8440,7 @@ static void checkPageRelations() static void resolveUserReferences() { - for (auto &si : SectionManager::instance()) + for (const auto &si : SectionManager::instance()) { //printf("si->label='%s' si->definition=%s si->fileName='%s'\n", // si->label.data(),si->definition?si->definition->name().data():"<none>", @@ -8978,8 +8983,10 @@ static void generateDiskNames() // as the common prefix between the first and last entry const FileEntry &first = fileEntries[0]; const FileEntry &last = fileEntries[size-1]; + int first_path_size = static_cast<int>(first.path.size()); + int last_path_size = static_cast<int>(last.path.size()); int j=0; - for (size_t i=0;i<first.path.size() && i<last.path.size();i++) + for (int i=0;i<first_path_size && i<last_path_size;i++) { if (first.path[i]=='/') j=i; if (first.path[i]!=last.path[i]) break; @@ -9091,25 +9098,23 @@ static void parseFiles(const std::shared_ptr<Entry> &root) // create a dictionary with files to process QDict<void> g_filesToProcess(10007); - StringListIterator it(g_inputFiles); - QCString *s; - for (;(s=it.current());++it) + for (const auto &s : g_inputFiles) { - g_filesToProcess.insert(*s,(void*)0x8); + g_filesToProcess.insert(s.c_str(),(void*)0x8); } // process source files (and their include dependencies) - for (it.toFirst();(s=it.current());++it) + for (const auto &s : g_inputFiles) { bool ambig; - FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s.c_str(),ambig); ASSERT(fd!=0); if (fd->isSource() && !fd->isReference()) // this is a source file { QStrList filesInSameTu; - OutlineParserInterface &parser = getParserForFile(s->data()); - parser.startTranslationUnit(s->data()); - parseFile(parser,root,fd,s->data(),FALSE,filesInSameTu); + OutlineParserInterface &parser = getParserForFile(s.c_str()); + parser.startTranslationUnit(s.c_str()); + parseFile(parser,root,fd,s.c_str(),FALSE,filesInSameTu); //printf(" got %d extra files in tu\n",filesInSameTu.count()); // Now process any include files in the same translation unit @@ -9117,13 +9122,13 @@ static void parseFiles(const std::shared_ptr<Entry> &root) char *incFile = filesInSameTu.first(); while (incFile && g_filesToProcess.find(incFile)) { - if (qstrcmp(incFile,s->data()) && !g_processedFiles.find(incFile)) + if (qstrcmp(incFile,s.c_str()) && !g_processedFiles.find(incFile)) { FileDef *ifd=findFileDef(Doxygen::inputNameLinkedMap,incFile,ambig); if (ifd && !ifd->isReference()) { QStrList moreFiles; - //printf(" Processing %s in same translation unit as %s\n",incFile,s->data()); + //printf(" Processing %s in same translation unit as %s\n",incFile,s->c_str()); parseFile(parser,root,ifd,incFile,TRUE,moreFiles); g_processedFiles.insert(incFile,(void*)0x8); } @@ -9131,40 +9136,38 @@ static void parseFiles(const std::shared_ptr<Entry> &root) incFile = filesInSameTu.next(); } parser.finishTranslationUnit(); - g_processedFiles.insert(*s,(void*)0x8); + g_processedFiles.insert(s.c_str(),(void*)0x8); } } // process remaining files - for (it.toFirst();(s=it.current());++it) + for (const auto &s : g_inputFiles) { - if (!g_processedFiles.find(*s)) // not yet processed + if (!g_processedFiles.find(s.c_str())) // not yet processed { bool ambig; QStrList filesInSameTu; - FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s.c_str(),ambig); ASSERT(fd!=0); - OutlineParserInterface &parser = getParserForFile(s->data()); - parser.startTranslationUnit(s->data()); - parseFile(parser,root,fd,s->data(),FALSE,filesInSameTu); + OutlineParserInterface &parser = getParserForFile(s.c_str()); + parser.startTranslationUnit(s.c_str()); + parseFile(parser,root,fd,s.c_str(),FALSE,filesInSameTu); parser.finishTranslationUnit(); - g_processedFiles.insert(*s,(void*)0x8); + g_processedFiles.insert(s.c_str(),(void*)0x8); } } } else // normal processing #endif { - StringListIterator it(g_inputFiles); - QCString *s; - for (;(s=it.current());++it) + for (const auto &s : g_inputFiles) { bool ambig; QStrList filesInSameTu; - FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s.c_str(),ambig); ASSERT(fd!=0); - OutlineParserInterface &parser = getParserForFile(s->data()); - parser.startTranslationUnit(s->data()); - parseFile(parser,root,fd,s->data(),FALSE,filesInSameTu); + OutlineParserInterface &parser = getParserForFile(s.c_str()); + parser.startTranslationUnit(s.c_str()); + parseFile(parser,root,fd,s.c_str(),FALSE,filesInSameTu); } } } @@ -9247,15 +9250,15 @@ static QDict<void> g_pathsVisited(1009); static int readDir(QFileInfo *fi, FileNameLinkedMap *fnMap, - StringDict *exclDict, + StringUnorderedSet *exclSet, QStrList *patList, QStrList *exclPatList, - StringList *resultList, - StringDict *resultDict, + StringVector *resultList, + StringUnorderedSet *resultSet, bool errorIfNotExist, bool recursive, - std::unordered_set<std::string> *killSet, - std::set<std::string> *paths + StringUnorderedSet *killSet, + StringSet *paths ) { QCString dirName = fi->absFilePath().utf8(); @@ -9284,7 +9287,7 @@ static int readDir(QFileInfo *fi, while ((cfi=it.current())) { - if (exclDict==0 || exclDict->find(cfi->absFilePath().utf8())==0) + if (exclSet==0 || exclSet->find(cfi->absFilePath().utf8().data())==exclSet->end()) { // file should not be excluded //printf("killSet->find(%s)\n",cfi->absFilePath().data()); if (!cfi->exists() || !cfi->isReadable()) @@ -9314,13 +9317,8 @@ static int readDir(QFileInfo *fi, fn->push_back(std::move(fd)); } } - QCString *rs=0; - if (resultList || resultDict) - { - rs=new QCString(cfi->absFilePath().utf8()); - } - if (resultList) resultList->append(rs); - if (resultDict) resultDict->insert(cfi->absFilePath().utf8(),rs); + if (resultList) resultList->push_back(cfi->absFilePath().utf8().data()); + if (resultSet) resultSet->insert(cfi->absFilePath().utf8().data()); if (killSet) killSet->insert(cfi->absFilePath().utf8().data()); } else if (recursive && @@ -9330,8 +9328,8 @@ static int readDir(QFileInfo *fi, cfi->fileName().at(0)!='.') // skip "." ".." and ".dir" { cfi->setFile(cfi->absFilePath()); - totalSize+=readDir(cfi,fnMap,exclDict, - patList,exclPatList,resultList,resultDict,errorIfNotExist, + totalSize+=readDir(cfi,fnMap,exclSet, + patList,exclPatList,resultList,resultSet,errorIfNotExist, recursive,killSet,paths); } } @@ -9348,15 +9346,15 @@ static int readDir(QFileInfo *fi, int readFileOrDirectory(const char *s, FileNameLinkedMap *fnMap, - StringDict *exclDict, + StringUnorderedSet *exclSet, QStrList *patList, QStrList *exclPatList, - StringList *resultList, - StringDict *resultDict, + StringVector *resultList, + StringUnorderedSet *resultSet, bool recursive, bool errorIfNotExist, - std::unordered_set<std::string> *killSet, - std::set<std::string> *paths + StringUnorderedSet *killSet, + StringSet *paths ) { //printf("killSet count=%d\n",killSet ? (int)killSet->size() : -1); @@ -9370,7 +9368,7 @@ int readFileOrDirectory(const char *s, //printf("readFileOrDirectory(%s)\n",s); int totalSize=0; { - if (exclDict==0 || exclDict->find(fi.absFilePath().utf8())==0) + if (exclSet==0 || exclSet->find(fi.absFilePath().utf8().data())==exclSet->end()) { if (!fi.exists() || !fi.isReadable()) { @@ -9405,12 +9403,10 @@ int readFileOrDirectory(const char *s, fn->push_back(std::move(fd)); } } - QCString *rs=0; - if (resultList || resultDict) + if (resultList || resultSet) { - rs=new QCString(filePath); - if (resultList) resultList->append(rs); - if (resultDict) resultDict->insert(filePath,rs); + if (resultList) resultList->push_back(filePath.data()); + if (resultSet) resultSet->insert(filePath.data()); } if (killSet) killSet->insert(fi.absFilePath().utf8().data()); @@ -9418,8 +9414,8 @@ int readFileOrDirectory(const char *s, } else if (fi.isDir()) // readable dir { - totalSize+=readDir(&fi,fnMap,exclDict,patList, - exclPatList,resultList,resultDict,errorIfNotExist, + totalSize+=readDir(&fi,fnMap,exclSet,patList, + exclPatList,resultList,resultSet,errorIfNotExist, recursive,killSet,paths); } } @@ -9799,6 +9795,8 @@ void cleanUpDoxygen() delete Doxygen::namespaceSDict; delete Doxygen::directories; + DotManager::deleteInstance(); + //delete Doxygen::symbolMap; <- we cannot do this unless all static lists // (such as Doxygen::namespaceSDict) // with objects based on Definition are made @@ -10473,12 +10471,11 @@ static QCString getQchFileName() void searchInputFiles() { - std::unordered_set<std::string> killSet; + StringUnorderedSet killSet; QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); bool alwaysRecursive = Config_getBool(RECURSIVE); - StringDict excludeNameDict(1009); - excludeNameDict.setAutoDelete(TRUE); + StringUnorderedSet excludeNameSet; // gather names of all files in the include path g_s.begin("Searching for include files...\n"); @@ -10492,10 +10489,16 @@ void searchInputFiles() { pl = Config_getList(FILE_PATTERNS); } - readFileOrDirectory(s,Doxygen::includeNameLinkedMap,0,&pl, - &exclPatterns,0,0, - alwaysRecursive, - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::includeNameLinkedMap, // fnDict + 0, // exclSet + &pl, // patList + &exclPatterns, // exclPatList + 0, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=includePathList.next(); } g_s.end(); @@ -10506,11 +10509,16 @@ void searchInputFiles() s=examplePathList.first(); while (s) { - readFileOrDirectory(s,Doxygen::exampleNameLinkedMap,0, - &Config_getList(EXAMPLE_PATTERNS), - 0,0,0, - (alwaysRecursive || Config_getBool(EXAMPLE_RECURSIVE)), - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::exampleNameLinkedMap, // fnDict + 0, // exclSet + &Config_getList(EXAMPLE_PATTERNS), // patList + 0, // exclPatList + 0, // resultList + 0, // resultSet + (alwaysRecursive || Config_getBool(EXAMPLE_RECURSIVE)), // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=examplePathList.next(); } g_s.end(); @@ -10521,10 +10529,16 @@ void searchInputFiles() s=imagePathList.first(); while (s) { - readFileOrDirectory(s,Doxygen::imageNameLinkedMap,0,0, - 0,0,0, - alwaysRecursive, - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::imageNameLinkedMap, // fnDict + 0, // exclSet + 0, // patList + 0, // exclPatList + 0, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=imagePathList.next(); } g_s.end(); @@ -10535,10 +10549,16 @@ void searchInputFiles() s=dotFileList.first(); while (s) { - readFileOrDirectory(s,Doxygen::dotFileNameLinkedMap,0,0, - 0,0,0, - alwaysRecursive, - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::dotFileNameLinkedMap, // fnDict + 0, // exclSet + 0, // patList + 0, // exclPatList + 0, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=dotFileList.next(); } g_s.end(); @@ -10549,10 +10569,16 @@ void searchInputFiles() s=mscFileList.first(); while (s) { - readFileOrDirectory(s,Doxygen::mscFileNameLinkedMap,0,0, - 0,0,0, - alwaysRecursive, - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::mscFileNameLinkedMap, // fnDict + 0, // exclSet + 0, // patList + 0, // exclPatList + 0, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=mscFileList.next(); } g_s.end(); @@ -10563,10 +10589,16 @@ void searchInputFiles() s=diaFileList.first(); while (s) { - readFileOrDirectory(s,Doxygen::diaFileNameLinkedMap,0,0, - 0,0,0, - alwaysRecursive, - TRUE,&killSet); + readFileOrDirectory(s, // s + Doxygen::diaFileNameLinkedMap, // fnDict + 0, // exclSet + 0, // patList + 0, // exclPatList + 0, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet); // killSet s=diaFileList.next(); } g_s.end(); @@ -10576,11 +10608,16 @@ void searchInputFiles() s=excludeList.first(); while (s) { - readFileOrDirectory(s,0,0,&Config_getList(FILE_PATTERNS), - 0,0,&excludeNameDict, - alwaysRecursive, - FALSE); - s=excludeList.next(); + readFileOrDirectory(s, // s + 0, // fnDict + 0, // exclSet + &Config_getList(FILE_PATTERNS), // patList + 0, // exclPatList + 0, // resultList + &excludeNameSet, // resultSet + alwaysRecursive, // recursive + FALSE); // errorIfNotExist + s=excludeList.next(); // killSet } g_s.end(); @@ -10592,7 +10629,6 @@ void searchInputFiles() killSet.clear(); Doxygen::inputPaths.clear(); QStrList &inputList=Config_getList(INPUT); - g_inputFiles.setAutoDelete(TRUE); s=inputList.first(); while (s) { @@ -10604,16 +10640,17 @@ void searchInputFiles() if (path.at(l-1)=='\\' || path.at(l-1)=='/') path=path.left(l-1); readFileOrDirectory( - path, - Doxygen::inputNameLinkedMap, - &excludeNameDict, - &Config_getList(FILE_PATTERNS), - &exclPatterns, - &g_inputFiles,0, - alwaysRecursive, - TRUE, - &killSet, - &Doxygen::inputPaths); + path, // s + Doxygen::inputNameLinkedMap, // fnDict + &excludeNameSet, // exclSet + &Config_getList(FILE_PATTERNS), // patList + &exclPatterns, // exclPatList + &g_inputFiles, // resultList + 0, // resultSet + alwaysRecursive, // recursive + TRUE, // errorIfNotExist + &killSet, // killSet + &Doxygen::inputPaths); // paths } s=inputList.next(); } diff --git a/src/doxygen.h b/src/doxygen.h index 30d136f..3335974 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -22,10 +22,7 @@ #include <qdict.h> #include <qintdict.h> -#include <set> -#include <unordered_set> -#include <unordered_map> - +#include "containers.h" #include "ftextstream.h" #include "sortdict.h" #include "membergroup.h" @@ -85,8 +82,6 @@ struct LookupInfo QCString resolvedType; }; -using StringMap = std::unordered_map<std::string,std::string>; - extern QCString g_spaces; /*! \brief This class serves as a namespace for global variables used by doxygen. @@ -104,7 +99,7 @@ class Doxygen static bool insideMainPage; static FileNameLinkedMap *includeNameLinkedMap; static FileNameLinkedMap *exampleNameLinkedMap; - static std::set<std::string> inputPaths; + static StringSet inputPaths; static FileNameLinkedMap *inputNameLinkedMap; static FileNameLinkedMap *imageNameLinkedMap; static FileNameLinkedMap *dotFileNameLinkedMap; @@ -113,13 +108,13 @@ class Doxygen static MemberNameLinkedMap *memberNameLinkedMap; static MemberNameLinkedMap *functionNameLinkedMap; static QStrList tagfileList; - static StringMap namespaceAliasMap; + static StringUnorderedMap namespaceAliasMap; static GroupSDict *groupSDict; static NamespaceSDict *namespaceSDict; static StringDict tagDestinationDict; static StringDict aliasDict; static QIntDict<MemberGroupInfo> memGrpInfoDict; - static std::unordered_set<std::string> expandAsDefinedSet; + static StringUnorderedSet expandAsDefinedSet; static NamespaceDef *globalScope; static QCString htmlFileExtension; static bool parseSourcesNeeded; @@ -151,7 +146,6 @@ void initDoxygen(); void readConfiguration(int argc, char **argv); void checkConfiguration(); void adjustConfiguration(); -void searchInputFiles(StringList &inputFiles); void parseInput(); void generateOutput(); void readAliases(); @@ -159,15 +153,15 @@ void readFormulaRepository(QCString dir, bool cmp = FALSE); void cleanUpDoxygen(); int readFileOrDirectory(const char *s, FileNameLinkedMap *fnDict, - StringDict *exclDict, + StringUnorderedSet *exclSet, QStrList *patList, QStrList *exclPatList, - StringList *resultList, - StringDict *resultDict, + StringVector *resultList, + StringUnorderedSet *resultSet, bool recursive, bool errorIfNotExist=TRUE, - std::unordered_set<std::string> *killSet = 0, - std::set<std::string> *paths = 0 + StringUnorderedSet *killSet = 0, + StringSet *paths = 0 ); void copyAndFilterFile(const char *fileName,BufStr &dest); 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<ArgumentList> 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<RefItem*> 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<RefItem*> &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..ca50c9c 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -34,6 +34,8 @@ #include "doxygen.h" // for Doxygen::indexList #include "index.h" // for Doxygen::indexList +static int determineInkscapeVersion(QDir &thisDir); + // Remove the temporary files #define RM_TMP_FILES (true) //#define RM_TMP_FILES (false) @@ -53,8 +55,8 @@ struct FormulaManager::Private } return DisplaySize(-1,-1); } - std::vector<std::string> formulas; - std::map<std::string,int> formulaMap; + StringVector formulas; + IntMap formulaMap; std::map<int,DisplaySize> displaySizeMap; }; @@ -98,10 +100,10 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) int w=-1,h=-1; if (ei!=-1 && ei>hi && ei<se) // new format { - int xi=formName.find('x',hi); + int xi=formName.find('x',ei); if (xi!=-1) { - w=formName.mid(hi+1,xi-hi-1).toInt(); + w=formName.mid(ei+1,xi-ei-1).toInt(); h=formName.mid(xi+1).toInt(); } formName = formName.left(ei); @@ -163,7 +165,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<int> formulasToGenerate; + IntVector formulasToGenerate; QFile f(texName); bool formulaError=FALSE; if (f.open(IO_WriteOnly)) @@ -294,22 +296,37 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c } Portable::sysTimerStop(); + // if we have pdf2svg available use it to create a SVG image if (Portable::checkForExecutable("pdf2svg")) { sprintf(args,"%s_tmp.pdf form_%d.svg",formBase.data(),pageNum); Portable::sysTimerStart(); if (Portable::system("pdf2svg",args)!=0) { - err("Problems running pdf2svg. Check your installation!\n"); + err("Problems running pdf2svg. Check your installation!\n"); Portable::sysTimerStop(); QDir::setCurrent(oldDir); return; } Portable::sysTimerStop(); } - else if (Portable::checkForExecutable("inkscape")) + else if (Portable::checkForExecutable("inkscape")) // alternative is to use inkscape { - sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull()); + int inkscapeVersion = determineInkscapeVersion(thisDir); + if (inkscapeVersion == -1) + { + err("Problems determining the version of inkscape. Check your installation!\n"); + QDir::setCurrent(oldDir); + return; + } + else if (inkscapeVersion == 0) + { + sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull()); + } + else // inkscapeVersion >= 1 + { + sprintf(args,"--export-type=svg --export-filename=form_%d.svg %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull()); + } Portable::sysTimerStart(); if (Portable::system("inkscape",args)!=0) { @@ -493,3 +510,75 @@ FormulaManager::DisplaySize FormulaManager::displaySize(int formulaId) const return p->getDisplaySize(formulaId); } +// helper function to detect and return the major version of inkscape. +// return -1 if the version cannot be determined. +static int determineInkscapeVersion(QDir &thisDir) +{ + // The command line interface (CLI) of Inkscape 1.0 has changed in comparison to + // previous versions. In order to invokine Inkscape, the used version is detected + // and based on the version the right syntax of the CLI is chosen. + static int inkscapeVersion = -2; + if (inkscapeVersion == -2) // initial one time version check + { + QCString inkscapeVersionFile = "inkscape_version" ; + inkscapeVersion = -1; + QCString args = "-z --version >"+inkscapeVersionFile+" 2>"+Portable::devNull(); + Portable::sysTimerStart(); + if (Portable::system("inkscape",args)!=0) + { + // looks like the old syntax gave problems, lets try the new syntax + args = " --version >"+inkscapeVersionFile+" 2>"+Portable::devNull(); + if (Portable::system("inkscape",args)!=0) + { + Portable::sysTimerStop(); + return -1; + } + } + // read version file and determine major version + QFile inkscapeVersionIn(inkscapeVersionFile); + if (inkscapeVersionIn.open(IO_ReadOnly)) + { + int maxLineLen=1024; + while (!inkscapeVersionIn.atEnd()) + { + QCString buf(maxLineLen); + int numBytes = inkscapeVersionIn.readLine(buf.rawData(),maxLineLen); + if (numBytes>0) + { + buf.resize(numBytes+1); + int dotPos = buf.find('.'); + if (buf.startsWith("Inkscape ") && dotPos>0) + { + // get major version + bool ok; + int version = buf.mid(9,dotPos-9).toInt(&ok); + if (!ok) + { + Portable::sysTimerStop(); + return -1; + } + inkscapeVersion = version; + break; + } + } + else + { + Portable::sysTimerStop(); + return -1; + } + } + inkscapeVersionIn.close(); + } + else // failed to open version file + { + Portable::sysTimerStop(); + return -1; + } + if (RM_TMP_FILES) + { + thisDir.remove(inkscapeVersionFile); + } + Portable::sysTimerStop(); + } + return inkscapeVersion; +} 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<RefItem*> &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trGroup(TRUE,TRUE), diff --git a/src/linkedmap.h b/src/linkedmap.h index 84c4a91..84dcf26 100644 --- a/src/linkedmap.h +++ b/src/linkedmap.h @@ -93,7 +93,7 @@ class LinkedMap const_iterator begin() const { return m_entries.cbegin(); } const_iterator end() const { return m_entries.cend(); } bool empty() const { return m_entries.empty(); } - int size() const { return m_entries.size(); } + size_t size() const { return m_entries.size(); } void clear() { @@ -159,7 +159,7 @@ class LinkedRefMap const_iterator begin() const { return m_entries.cbegin(); } const_iterator end() const { return m_entries.cend(); } bool empty() const { return m_entries.empty(); } - int size() const { return m_entries.size(); } + size_t size() const { return m_entries.size(); } void clear() { 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<ArgumentList> &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<ArgumentList> al); virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al); - virtual void setDefinitionTemplateParameterLists(const std::vector<ArgumentList> &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<ArgumentList> &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<ArgumentList> al) {} virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) {} - virtual void setDefinitionTemplateParameterLists(const std::vector<ArgumentList> &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<ArgumentList> 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<ArgumentList> &lists) +void MemberDefImpl::setDefinitionTemplateParameterLists(const ArgumentLists &lists) { m_impl->defTmpArgLists = lists; } @@ -4454,7 +4454,7 @@ void MemberDefImpl::addListReference(Definition *) memArgs = argsString(); } } - const std::vector<RefItem*> &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<ArgumentList> &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<ArgumentList> &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<ArgumentList> al) = 0; virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) = 0; - virtual void setDefinitionTemplateParameterLists(const std::vector<ArgumentList> &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<RefItem*> &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<RefItem*> &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 <qlist.h> #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<RefItem*> &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<RefItem*> m_xrefListItems; + RefItemVector m_xrefListItems; }; /** A list of MemberGroup objects. */ @@ -112,7 +113,7 @@ class MemberGroupList : public QList<MemberGroup> class MemberGroupListIterator : public QListIterator<MemberGroup> { public: - MemberGroupListIterator(const MemberGroupList &l) : + MemberGroupListIterator(const MemberGroupList &l) : QListIterator<MemberGroup>(l) {} }; @@ -132,13 +133,13 @@ class MemberGroupSDict : public SIntDict<MemberGroup> /** Data collected for a member group */ struct MemberGroupInfo { - void setRefItems(const std::vector<RefItem*> &sli); + void setRefItems(const RefItemVector &sli); QCString header; QCString doc; QCString docFile; int docLine = -1; QCString compoundName; - std::vector<RefItem*> m_sli; + RefItemVector m_sli; }; #endif diff --git a/src/membername.h b/src/membername.h index 406d406..88d8832 100644 --- a/src/membername.h +++ b/src/membername.h @@ -47,7 +47,7 @@ class MemberName const_reverse_iterator crbegin() const { return m_members.crbegin(); } const_reverse_iterator crend() const { return m_members.crend(); } bool empty() const { return m_members.empty(); } - int size() const { return m_members.size(); } + size_t size() const { return m_members.size(); } Ptr &back() { return m_members.back(); } const Ptr &back() const { return m_members.back(); } Ptr &front() { return m_members.front(); } @@ -113,7 +113,7 @@ class MemberNameInfo const_iterator begin() const { return m_members.begin(); } const_iterator end() const { return m_members.end(); } bool empty() const { return m_members.empty(); } - int size() const { return m_members.size(); } + size_t size() const { return m_members.size(); } Ptr &back() { return m_members.back(); } const Ptr &back() const { return m_members.back(); } Ptr &front() { return m_members.front(); } 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<RefItem*> &xrefItems = xrefListItems(); + const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), getLanguage()==SrcLangExt_Fortran ? @@ -29,10 +29,6 @@ #include <stack> #include <deque> #include <algorithm> -#include <set> -#include <unordered_set> -#include <string> -#include <map> #include <utility> #include <stdio.h> @@ -44,6 +40,7 @@ #include <qregexp.h> #include <qfileinfo.h> +#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<std::string> &includeStack); + void collectDefines(DefineMapRef &map,StringSet &includeStack); private: DefineManager *m_parent; DefineMapOwning m_defines; - std::set<std::string> m_includedFiles; + StringSet m_includedFiles; }; public: @@ -197,7 +194,7 @@ class DefineManager else { //printf("existing file!\n"); - std::set<std::string> 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<std::string> 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<std::string> &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<std::string> 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<std::string> pathList; - std::map<std::string,int> argMap; - std::stack<bool> levelGuard; + StringVector pathList; + IntMap argMap; + BoolStack levelGuard; std::stack< std::unique_ptr<CondCtx> > condStack; std::deque< std::unique_ptr<FileState> > includeStack; - std::map<std::string,Define*> expandedDict; - std::unordered_set<std::string> expanded; + std::unordered_map<std::string,Define*> expandedDict; + StringUnorderedSet expanded; ConstExpressionParser constExpParser; }; diff --git a/src/reflist.cpp b/src/reflist.cpp index bc97823..0aaa75f 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -17,11 +17,34 @@ #include <stdio.h> #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<RefItem> item = std::make_unique<RefItem>(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; @@ -99,6 +122,8 @@ void RefList::generatePage() } doc += "</dl>\n"; //printf("generatePage('%s')\n",doc.data()); - if (cnt) addRelatedPage(m_listName,m_pageTitle,doc,m_fileName,1,std::vector<RefItem*>(),0,0,TRUE); + if (cnt>0) + { + 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 <qintdict.h> #include <qlist.h> -#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<RefItem> item = std::make_unique<RefItem>(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<RefList> RefListManager &operator=(const RefListManager &other) = delete; }; +using RefItemVector = std::vector<RefItem*>; + #endif diff --git a/src/scanner.l b/src/scanner.l index 8ceb4ad..384b088 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -249,7 +249,7 @@ RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" RAWEND ")"[^ \t\(\)\\]{0,16}\" ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" -LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" +LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>" BITOP "&"|"|"|"^"|"<<"|">>"|"~" OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) @@ -2000,33 +2000,37 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN(FindMembers); } -<QtPropType>"const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - yyextra->current->type+=yytext; - } <QtPropType>{B}+ { - yyextra->current->type+=yytext; + yyextra->current->name+=yytext; } -<QtPropType>({TSCOPE}"::")*{TSCOPE} { - yyextra->current->type+=yytext; - BEGIN(QtPropName); +<QtPropType>"*" { + yyextra->current->type+= yyextra->current->name; + yyextra->current->type+= yytext; + yyextra->current->name=""; } -<QtPropName>{ID} { +<QtPropType>({TSCOPE}"::")*{TSCOPE} { + yyextra->current->type+= yyextra->current->name; yyextra->current->name=yytext; - BEGIN(QtPropAttr); } -<QtPropAttr>"READ" { +<QtPropType,QtPropAttr>{B}+"READ"{B}+ { yyextra->current->spec |= Entry::Readable; BEGIN(QtPropRead); } -<QtPropAttr>"WRITE" { +<QtPropType,QtPropAttr>{B}+"WRITE"{B}+ { yyextra->current->spec |= Entry::Writable; BEGIN(QtPropWrite); } -<QtPropAttr>"RESET"{B}+{ID} { // reset method => not supported yet - } -<QtPropAttr>"SCRIPTABLE"{B}+{ID} { // scriptable property => not supported yet - } -<QtPropAttr>"DESIGNABLE"{B}+{ID} { // designable property => not supported yet +<QtPropType,QtPropAttr>{B}+"MEMBER"{B}+{ID} | // member property => not supported yet +<QtPropType,QtPropAttr>{B}+"RESET"{B}+{ID} | // reset method => not supported yet +<QtPropType,QtPropAttr>{B}+"SCRIPTABLE"{B}+{ID} | // scriptable property => not supported yet +<QtPropType,QtPropAttr>{B}+"DESIGNABLE"{B}+{ID} | // designable property => not supported yet +<QtPropType,QtPropAttr>{B}+"NOTIFY"{B}+{ID} | // notify property => not supported yet +<QtPropType,QtPropAttr>{B}+"REVISION"{B}+{ID} | // revision property => not supported yet +<QtPropType,QtPropAttr>{B}+"STORED"{B}+{ID} | // stored property => not supported yet +<QtPropType,QtPropAttr>{B}+"USER"{B}+{ID} | // user property => not supported yet +<QtPropType,QtPropAttr>{B}+"CONSTANT"{B} | // constant property => not supported yet +<QtPropType,QtPropAttr>{B}+"FINAL"{B} { // final property => not supported yet + BEGIN(QtPropAttr); } <QtPropRead>{ID} { yyextra->current->read = yytext; @@ -2898,7 +2902,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) *yyextra->pCopyRoundString+=yytext; } } -<CopyRound>[^"'()\n]+ { +<CopyRound>[^"'()\n,]+ { *yyextra->pCopyRoundString+=yytext; } <CopyRound>. { @@ -2948,7 +2952,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) *yyextra->pCopyRoundGString+=yytext; } } -<GCopyRound>[^"'()\n/]+ { +<GCopyRound>[^"'()\n\/,]+ { *yyextra->pCopyRoundGString+=yytext; } <GCopyRound>. { @@ -2998,7 +3002,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) *yyextra->pCopySquareGString+=yytext; } } -<GCopySquare>[^"\[\]\n/]+ { +<GCopySquare>[^"\[\]\n\/,]+ { *yyextra->pCopySquareGString+=yytext; } <GCopySquare>. { @@ -3039,7 +3043,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) *yyextra->pCopyCurlyString+=yytext; } } -<CopyCurly>[^"'{}\/\n]+ { +<CopyCurly>[^"'{}\/\n,]+ { *yyextra->pCopyCurlyString+=yytext; } <CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; } diff --git a/src/section.h b/src/section.h index cf453bc..74eb04b 100644 --- a/src/section.h +++ b/src/section.h @@ -116,7 +116,7 @@ class SectionRefs const_iterator begin() const { return m_entries.cbegin(); } const_iterator end() const { return m_entries.cend(); } bool empty() const { return m_entries.empty(); } - int size() const { return (int)m_entries.size(); } + size_t size() const { return m_entries.size(); } private: SectionInfoVec m_entries; diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index eb944e6..957095a 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -854,16 +854,16 @@ class TextGeneratorSqlite3Impl : public TextGeneratorIntf }; -static bool bindTextParameter(SqlStmt &s,const char *name,const char *value, bool _static=TRUE) +static bool bindTextParameter(SqlStmt &s,const char *name,const char *value, bool _static=FALSE) { int idx = sqlite3_bind_parameter_index(s.stmt, name); if (idx==0) { - msg("sqlite3_bind_parameter_index(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); + err("sqlite3_bind_parameter_index(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; } int rv = sqlite3_bind_text(s.stmt, idx, value, -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT); if (rv!=SQLITE_OK) { - msg("sqlite3_bind_text(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); + err("sqlite3_bind_text(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; } return true; @@ -873,12 +873,12 @@ static bool bindIntParameter(SqlStmt &s,const char *name,int value) { int idx = sqlite3_bind_parameter_index(s.stmt, name); if (idx==0) { - msg("sqlite3_bind_parameter_index(%s)[%s] failed to find column: %s\n", name, s.query, sqlite3_errmsg(s.db)); + err("sqlite3_bind_parameter_index(%s)[%s] failed to find column: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; } int rv = sqlite3_bind_int(s.stmt, idx, value); if (rv!=SQLITE_OK) { - msg("sqlite3_bind_int(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); + err("sqlite3_bind_int(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; } return true; @@ -909,11 +909,11 @@ static int insertPath(QCString name, bool local=TRUE, bool found=TRUE, int type= name = stripFromPath(name); - bindTextParameter(path_select,":name",name.data(),FALSE); + bindTextParameter(path_select,":name",name.data()); rowid=step(path_select,TRUE,TRUE); if (rowid==0) { - bindTextParameter(path_insert,":name",name.data(),FALSE); + bindTextParameter(path_insert,":name",name.data()); bindIntParameter(path_insert,":type",type); bindIntParameter(path_insert,":local",local?1:0); bindIntParameter(path_insert,":found",found?1:0); @@ -925,9 +925,9 @@ static int insertPath(QCString name, bool local=TRUE, bool found=TRUE, int type= static void recordMetadata() { bindTextParameter(meta_insert,":doxygen_version",getFullVersion()); - bindTextParameter(meta_insert,":schema_version","0.2.0"); //TODO: this should be a constant somewhere; not sure where - bindTextParameter(meta_insert,":generated_at",dateToString(TRUE), FALSE); - bindTextParameter(meta_insert,":generated_on",dateToString(FALSE), FALSE); + bindTextParameter(meta_insert,":schema_version","0.2.0",TRUE); //TODO: this should be a constant somewhere; not sure where + bindTextParameter(meta_insert,":generated_at",dateToString(TRUE)); + bindTextParameter(meta_insert,":generated_on",dateToString(FALSE)); bindTextParameter(meta_insert,":project_name",Config_getString(PROJECT_NAME)); bindTextParameter(meta_insert,":project_number",Config_getString(PROJECT_NUMBER)); bindTextParameter(meta_insert,":project_brief",Config_getString(PROJECT_BRIEF)); @@ -1155,7 +1155,7 @@ static int prepareStatement(sqlite3 *db, SqlStmt &s) rc = sqlite3_prepare_v2(db,s.query,-1,&s.stmt,0); if (rc!=SQLITE_OK) { - msg("prepare failed for %s\n%s\n", s.query, sqlite3_errmsg(db)); + err("prepare failed for %s\n%s\n", s.query, sqlite3_errmsg(db)); s.db = NULL; return -1; } @@ -1226,7 +1226,7 @@ static int initializeTables(sqlite3* db) rc = sqlite3_exec(db, q, NULL, NULL, &errmsg); if (rc != SQLITE_OK) { - msg("failed to execute query: %s\n\t%s\n", q, errmsg); + err("failed to execute query: %s\n\t%s\n", q, errmsg); return -1; } } @@ -1244,7 +1244,7 @@ static int initializeViews(sqlite3* db) rc = sqlite3_exec(db, q, NULL, NULL, &errmsg); if (rc != SQLITE_OK) { - msg("failed to execute query: %s\n\t%s\n", q, errmsg); + err("failed to execute query: %s\n\t%s\n", q, errmsg); return -1; } } @@ -1446,15 +1446,14 @@ static void getSQLDesc(SqlStmt &s,const char *col,const char *value,const Defini bindTextParameter( s, col, - getSQLDocBlock( - def->getOuterScope(), - def, - value, - def->docFile(), - def->docLine() - ), - FALSE - ); + getSQLDocBlock( + def->getOuterScope(), + def, + value, + def->docFile(), + def->docLine() + ) + ); } //////////////////////////////////////////// @@ -1646,7 +1645,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref } bindIntParameter(memberdef_insert,":rowid", refid.rowid); - bindTextParameter(memberdef_insert,":kind",md->memberTypeName(),FALSE); + bindTextParameter(memberdef_insert,":kind",md->memberTypeName()); bindIntParameter(memberdef_insert,":prot",md->protection()); bindIntParameter(memberdef_insert,":static",md->isStatic()); @@ -1762,7 +1761,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref linkifyText(TextGeneratorSqlite3Impl(l), def, md->getBodyDef(),md,typeStr); if (typeStr) { - bindTextParameter(memberdef_insert,":type",typeStr,FALSE); + bindTextParameter(memberdef_insert,":type",typeStr); } if (md->definition()) @@ -1807,7 +1806,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref if ( md->getScopeString() ) { - bindTextParameter(memberdef_insert,":scope",md->getScopeString(),FALSE); + bindTextParameter(memberdef_insert,":scope",md->getScopeString()); } // +Brief, detailed and inbody description @@ -1952,8 +1951,8 @@ static void generateSqlite3ForClass(const ClassDef *cd) bindIntParameter(compounddef_insert,":rowid", refid.rowid); bindTextParameter(compounddef_insert,":name",cd->name()); - bindTextParameter(compounddef_insert,":title",cd->title(), FALSE); - bindTextParameter(compounddef_insert,":kind",cd->compoundTypeString(),FALSE); + bindTextParameter(compounddef_insert,":title",cd->title()); + bindTextParameter(compounddef_insert,":kind",cd->compoundTypeString()); bindIntParameter(compounddef_insert,":prot",cd->protection()); int file_id = insertPath(cd->getDefFileName()); @@ -2099,8 +2098,8 @@ static void generateSqlite3ForNamespace(const NamespaceDef *nd) bindIntParameter(compounddef_insert,":rowid", refid.rowid); bindTextParameter(compounddef_insert,":name",nd->name()); - bindTextParameter(compounddef_insert,":title",nd->title(), FALSE); - bindTextParameter(compounddef_insert,":kind","namespace",FALSE); + bindTextParameter(compounddef_insert,":title",nd->title()); + bindTextParameter(compounddef_insert,":kind","namespace"); int file_id = insertPath(nd->getDefFileName()); bindIntParameter(compounddef_insert,":file_id",file_id); @@ -2165,9 +2164,9 @@ static void generateSqlite3ForFile(const FileDef *fd) if(!refid.created && compounddefExists(refid)){return;} bindIntParameter(compounddef_insert,":rowid", refid.rowid); - bindTextParameter(compounddef_insert,":name",fd->name(),FALSE); - bindTextParameter(compounddef_insert,":title",fd->title(),FALSE); - bindTextParameter(compounddef_insert,":kind","file",FALSE); + bindTextParameter(compounddef_insert,":name",fd->name()); + bindTextParameter(compounddef_insert,":title",fd->title()); + bindTextParameter(compounddef_insert,":kind","file"); int file_id = insertPath(fd->getDefFileName()); bindIntParameter(compounddef_insert,":file_id",file_id); @@ -2333,8 +2332,8 @@ static void generateSqlite3ForGroup(const GroupDef *gd) bindIntParameter(compounddef_insert,":rowid", refid.rowid); bindTextParameter(compounddef_insert,":name",gd->name()); - bindTextParameter(compounddef_insert,":title",gd->groupTitle(), FALSE); - bindTextParameter(compounddef_insert,":kind","group",FALSE); + bindTextParameter(compounddef_insert,":title",gd->groupTitle()); + bindTextParameter(compounddef_insert,":kind","group"); int file_id = insertPath(gd->getDefFileName()); bindIntParameter(compounddef_insert,":file_id",file_id); @@ -2400,7 +2399,7 @@ static void generateSqlite3ForDir(const DirDef *dd) bindIntParameter(compounddef_insert,":rowid", refid.rowid); bindTextParameter(compounddef_insert,":name",dd->displayName()); - bindTextParameter(compounddef_insert,":kind","dir",FALSE); + bindTextParameter(compounddef_insert,":kind","dir"); int file_id = insertPath(dd->getDefFileName(),TRUE,TRUE,2); bindIntParameter(compounddef_insert,":file_id",file_id); @@ -2483,9 +2482,9 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) } // + title - bindTextParameter(compounddef_insert,":title",title,FALSE); + bindTextParameter(compounddef_insert,":title",title); - bindTextParameter(compounddef_insert,":kind", isExample ? "example" : "page"); + bindTextParameter(compounddef_insert,":kind", isExample ? "example" : "page",TRUE); int file_id = insertPath(pd->getDefFileName()); @@ -2516,16 +2515,13 @@ static sqlite3* openDbConnection() rc = sqlite3_initialize(); if (rc != SQLITE_OK) { - msg("sqlite3_initialize failed\n"); - return NULL; + err("sqlite3_initialize failed\n"); } if (stat (outputDirectory+"/doxygen_sqlite3.db", &buf) == 0) { - msg("doxygen_sqlite3.db already exists! aborting sqlite3 output generation!\n"); - msg("If you wish to re-generate the database, remove or archive the existing copy first.\n"); - return NULL; + err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate. Aborting!\n"); } rc = sqlite3_open_v2( @@ -2537,8 +2533,7 @@ static sqlite3* openDbConnection() if (rc != SQLITE_OK) { sqlite3_close(db); - msg("database open failed: %s\n", "doxygen_sqlite3.db"); - return NULL; + err("Database open failed: %s\n", "doxygen_sqlite3.db"); } return db; } diff --git a/src/util.cpp b/src/util.cpp index 9e6605a..2b82afb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -486,7 +486,7 @@ NamespaceDef *getResolvedNamespace(const char *name) if (it!=Doxygen::namespaceAliasMap.end()) { int count=0; // recursion detection guard - StringMap::iterator it2; + StringUnorderedMap::iterator it2; while ((it2=Doxygen::namespaceAliasMap.find(it->second))!=Doxygen::namespaceAliasMap.end() && count<10) { @@ -4872,6 +4872,7 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor case '@': growBuf.addStr("_0d"); break; case ']': growBuf.addStr("_0e"); break; case '[': growBuf.addStr("_0f"); break; + case '#': growBuf.addStr("_0g"); break; default: if (c<0) { @@ -4986,6 +4987,7 @@ QCString unescapeCharsInString(const char *s) case 'd': result+='@'; p+=2; break; // _0d -> '@' case 'e': result+=']'; p+=2; break; // _0e -> ']' case 'f': result+='['; p+=2; break; // _0f -> '[' + case 'g': result+='#'; p+=2; break; // _0g -> '#' default: // unknown escape, just pass underscore character as-is result+=c; break; @@ -6131,7 +6133,7 @@ found: PageDef *addRelatedPage(const char *name,const QCString &ptitle, const QCString &doc, const char *fileName,int startLine, - const std::vector<RefItem*> &sli, + const RefItemVector &sli, GroupDef *gd, const TagInfo *tagInfo, bool xref, @@ -6218,7 +6220,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- -void addRefItem(const std::vector<RefItem*> &sli, +void addRefItem(const RefItemVector &sli, const char *key, const char *prefix, const char *name,const char *title,const char *args,const Definition *scope) { @@ -6626,7 +6628,7 @@ void replaceNamespaceAliases(QCString &scope,int i) if (it!=Doxygen::namespaceAliasMap.end()) { scope=it->second.data()+scope.right(scope.length()-i); - i=it->second.length(); + i=static_cast<int>(it->second.length()); } } if (i>0 && ns==scope.left(i)) break; @@ -327,7 +327,7 @@ int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); -void addRefItem(const std::vector<RefItem*> &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<RefItem*> &sli = std::vector<RefItem*>(), + 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 <qcstring.h> #include <qfileinfo.h> #include <qcstringlist.h> +#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<int> 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) { |