diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2017-09-25 18:57:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 18:57:28 (GMT) |
commit | 3aa86cee3f38627f0ee4d0aaac313f8221999819 (patch) | |
tree | c05d14bc4383d98a1cdc5a4bc94ae738c133f65b | |
parent | 47d679b67952949d639ea9a206535e97a6154bb5 (diff) | |
parent | 5df4341210ec2374b8b7c09f5df3cd8f4ff60f65 (diff) | |
download | Doxygen-3aa86cee3f38627f0ee4d0aaac313f8221999819.zip Doxygen-3aa86cee3f38627f0ee4d0aaac313f8221999819.tar.gz Doxygen-3aa86cee3f38627f0ee4d0aaac313f8221999819.tar.bz2 |
Merge pull request #604 from groleo/const
const-ify
-rw-r--r-- | src/classdef.cpp | 4 | ||||
-rw-r--r-- | src/classdef.h | 4 | ||||
-rw-r--r-- | src/definition.cpp | 2 | ||||
-rw-r--r-- | src/definition.h | 2 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/namespacedef.h | 2 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 38 | ||||
-rw-r--r-- | src/util.cpp | 66 | ||||
-rw-r--r-- | src/util.h | 16 |
9 files changed, 69 insertions, 67 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 7ec4bb4..07e723b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -3656,7 +3656,7 @@ void ClassDef::addInnerCompound(Definition *d) } } -Definition *ClassDef::findInnerCompound(const char *name) +Definition *ClassDef::findInnerCompound(const char *name) const { Definition *result=0; if (name==0) return 0; @@ -4394,7 +4394,7 @@ bool ClassDef::isLocal() const return m_impl->isLocal; } -ClassSDict *ClassDef::getClassSDict() +ClassSDict *ClassDef::getClassSDict() const { return m_impl->innerClasses; } diff --git a/src/classdef.h b/src/classdef.h index 524bb96..23c5c5c 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -122,7 +122,7 @@ class ClassDef : public Definition bool isLocal() const; /** returns the classes nested into this class */ - ClassSDict *getClassSDict(); + ClassSDict *getClassSDict() const; /** returns TRUE if this class has documentation */ bool hasDocumentation() const; @@ -244,7 +244,7 @@ class ClassDef : public Definition * available, or 0 otherwise. * @param name The name of the nested compound */ - virtual Definition *findInnerCompound(const char *name); + virtual Definition *findInnerCompound(const char *name) const; /** Returns the template parameter lists that form the template * declaration of this class. diff --git a/src/definition.cpp b/src/definition.cpp index 26d828b..ff30429 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1362,7 +1362,7 @@ void Definition::addSourceReferences(MemberDef *md) } } -Definition *Definition::findInnerCompound(const char *) +Definition *Definition::findInnerCompound(const char *) const { return 0; } diff --git a/src/definition.h b/src/definition.h index 48c572d..d16c6b9 100644 --- a/src/definition.h +++ b/src/definition.h @@ -261,7 +261,7 @@ class Definition : public DefinitionIntf QList<ListItemInfo> *xrefListItems() const; - virtual Definition *findInnerCompound(const char *name); + virtual Definition *findInnerCompound(const char *name) const ; virtual Definition *getOuterScope() const; MemberSDict *getReferencesMembers() const; diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 29f68a4..c674760 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -818,7 +818,7 @@ QCString NamespaceDef::getOutputFileBase() const return fileName; } -Definition *NamespaceDef::findInnerCompound(const char *n) +Definition *NamespaceDef::findInnerCompound(const char *n) const { if (n==0) return 0; Definition *d = m_innerCompounds->find(n); diff --git a/src/namespacedef.h b/src/namespacedef.h index 9b734eb..8b7d7cc 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -80,7 +80,7 @@ class NamespaceDef : public Definition void findSectionsInDocumentation(); void sortMemberLists(); - virtual Definition *findInnerCompound(const char *name); + virtual Definition *findInnerCompound(const char *name) const; void addInnerCompound(Definition *d); void addListReferences(); void setFileName(const QCString &fn); diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 8996014..90b96ca 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -543,7 +543,7 @@ static void insertMemberReference(sqlite3 *db, int refid_src, int refid_dst, step(db,xrefs_insert); } -static void insertMemberReference(sqlite3 *db, MemberDef *src, MemberDef *dst) +static void insertMemberReference(sqlite3 *db, const MemberDef *src, const MemberDef *dst) { QCString qrefid_dst = dst->getOutputFileBase() + "_1" + dst->anchor(); QCString qrefid_src = src->getOutputFileBase() + "_1" + src->anchor(); @@ -556,7 +556,7 @@ static void insertMemberReference(sqlite3 *db, MemberDef *src, MemberDef *dst) } } -static void insertMemberFunctionParams(sqlite3 *db,int id_memberdef,MemberDef *md,Definition *def) +static void insertMemberFunctionParams(sqlite3 *db,int id_memberdef, const MemberDef *md, const Definition *def) { ArgumentList *declAl = md->declArgumentList(); ArgumentList *defAl = md->argumentList(); @@ -629,7 +629,7 @@ static void insertMemberFunctionParams(sqlite3 *db,int id_memberdef,MemberDef *m } } -static void insertMemberDefineParams(sqlite3 *db,int id_memberdef,MemberDef *md,Definition *def) +static void insertMemberDefineParams(sqlite3 *db,int id_memberdef,const MemberDef *md, const Definition *def) { if (md->argumentList()->count()==0) // special case for "foo()" to // disguish it from "foo". @@ -793,9 +793,9 @@ static void writeInnerNamespaces(sqlite3 *db,const NamespaceSDict *nl) static void writeTemplateArgumentList(sqlite3* db, - ArgumentList * al, - Definition * scope, - FileDef * fileScope) + const ArgumentList * al, + const Definition * scope, + const FileDef * fileScope) { if (al) { @@ -828,7 +828,7 @@ static void writeTemplateArgumentList(sqlite3* db, } } -static void writeMemberTemplateLists(sqlite3* db,MemberDef *md) +static void writeMemberTemplateLists(sqlite3* db,const MemberDef *md) { ArgumentList *templMd = md->templateArguments(); if (templMd) // function template prefix @@ -836,14 +836,14 @@ static void writeMemberTemplateLists(sqlite3* db,MemberDef *md) writeTemplateArgumentList(db,templMd,md->getClassDef(),md->getFileDef()); } } -static void writeTemplateList(sqlite3*db,ClassDef *cd) +static void writeTemplateList(sqlite3*db, const ClassDef *cd) { writeTemplateArgumentList(db,cd->templateArguments(),cd,0); } //////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) +static void generateSqlite3ForMember(sqlite3*db,const MemberDef *md, const Definition *def) { // + declaration/definition arg lists // + reimplements @@ -976,7 +976,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) QCString typeStr = md->typeString(); stripQualifiers(typeStr); StringList l; - linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,typeStr); + linkifyText(TextGeneratorSqlite3Impl(l), def, md->getBodyDef(),md,typeStr); if (typeStr.data()) { bindTextParameter(memberdef_insert,":type",typeStr.data(),FALSE); @@ -1099,8 +1099,10 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) } static void generateSqlite3Section(sqlite3*db, - Definition *d, - MemberList *ml,const char * /*kind*/,const char * /*header*/=0, + const Definition *d, + const MemberList *ml, + const char * /*kind*/, + const char * /*header*/=0, const char * /*documentation*/=0) { if (ml==0) return; @@ -1129,7 +1131,7 @@ static void generateSqlite3Section(sqlite3*db, } -static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) +static void generateSqlite3ForClass(sqlite3 *db, const ClassDef *cd) { // + list of direct super classes // + list of direct sub classes @@ -1270,7 +1272,7 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) } } -static void generateSqlite3ForNamespace(sqlite3 *db, NamespaceDef *nd) +static void generateSqlite3ForNamespace(sqlite3 *db, const NamespaceDef *nd) { // + contained class definitions // + contained namespace definitions @@ -1313,7 +1315,7 @@ static void generateSqlite3ForNamespace(sqlite3 *db, NamespaceDef *nd) } } -static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) +static void generateSqlite3ForFile(sqlite3 *db, const FileDef *fd) { // + includes files // + includedby files @@ -1408,17 +1410,17 @@ static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) } } -static void generateSqlite3ForGroup(sqlite3*db,GroupDef *gd) +static void generateSqlite3ForGroup(sqlite3*db, const GroupDef *gd) { #warning WorkInProgress } -static void generateSqlite3ForDir(sqlite3 *db,DirDef *dd) +static void generateSqlite3ForDir(sqlite3 *db,const DirDef *dd) { #warning WorkInProgress } -static void generateSqlite3ForPage(sqlite3 *db,PageDef *pd,bool isExample) +static void generateSqlite3ForPage(sqlite3 *db,const PageDef *pd,bool isExample) { #warning WorkInProgress } diff --git a/src/util.cpp b/src/util.cpp index 0cda153..1b169cb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -516,14 +516,14 @@ static QDict<MemberDef> g_resolvedTypedefs; static QDict<Definition> g_visitedNamespaces; // forward declaration -static ClassDef *getResolvedClassRec(Definition *scope, - FileDef *fileScope, +static ClassDef *getResolvedClassRec(const Definition *scope, + const FileDef *fileScope, const char *n, MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType ); -int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope,Definition *item, +int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScope,const Definition *item, const QCString &explicitScopePart); /*! Returns the class representing the value of the typedef represented by \a md @@ -533,7 +533,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope,Definition * * Example: typedef int T; will return 0, since "int" is not a class. */ -ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, +ClassDef *newResolveTypedef(const FileDef *fileScope,MemberDef *md, MemberDef **pMemType,QCString *pTemplSpec, QCString *pResolvedType, ArgumentList *actTemplParams) @@ -664,7 +664,7 @@ done: /*! Substitutes a simple unqualified \a name within \a scope. Returns the * value of the typedef or \a name if no typedef was found. */ -static QCString substTypedef(Definition *scope,FileDef *fileScope,const QCString &name, +static QCString substTypedef(const Definition *scope,const FileDef *fileScope,const QCString &name, MemberDef **pTypeDef=0) { QCString result=name; @@ -750,11 +750,11 @@ static Definition *endOfPathIsUsedClass(SDict<Definition> *cl,const QCString &lo * searched. If found the scope definition is returned, otherwise 0 * is returned. */ -static Definition *followPath(Definition *start,FileDef *fileScope,const QCString &path) +static const Definition *followPath(const Definition *start,const FileDef *fileScope,const QCString &path) { int is,ps; int l; - Definition *current=start; + const Definition *current=start; ps=0; //printf("followPath: start='%s' path='%s'\n",start?start->name().data():"<none>",path.data()); // for each part of the explicit scope @@ -773,7 +773,7 @@ static Definition *followPath(Definition *start,FileDef *fileScope,const QCStrin return type; } } - Definition *next = current->findInnerCompound(qualScopePart); + const Definition *next = current->findInnerCompound(qualScopePart); //printf("++ Looking for %s inside %s result %s\n", // qualScopePart.data(), // current->name().data(), @@ -807,8 +807,8 @@ static Definition *followPath(Definition *start,FileDef *fileScope,const QCStrin } bool accessibleViaUsingClass(const SDict<Definition> *cl, - FileDef *fileScope, - Definition *item, + const FileDef *fileScope, + const Definition *item, const QCString &explicitScopePart="" ) { @@ -821,7 +821,7 @@ bool accessibleViaUsingClass(const SDict<Definition> *cl, for (cli.toFirst();(ucd=cli.current());++cli) { //printf("Trying via used class %s\n",ucd->name().data()); - Definition *sc = explicitScopePartEmpty ? ucd : followPath(ucd,fileScope,explicitScopePart); + const Definition *sc = explicitScopePartEmpty ? ucd : followPath(ucd,fileScope,explicitScopePart); if (sc && sc==item) return TRUE; //printf("Try via used class done\n"); } @@ -830,8 +830,8 @@ bool accessibleViaUsingClass(const SDict<Definition> *cl, } bool accessibleViaUsingNamespace(const NamespaceSDict *nl, - FileDef *fileScope, - Definition *item, + const FileDef *fileScope, + const Definition *item, const QCString &explicitScopePart="") { static QDict<void> visitedDict; @@ -844,7 +844,7 @@ bool accessibleViaUsingNamespace(const NamespaceSDict *nl, { //printf("[Trying via used namespace %s: count=%d/%d\n",und->name().data(), // count,nl->count()); - Definition *sc = explicitScopePart.isEmpty() ? und : followPath(und,fileScope,explicitScopePart); + const Definition *sc = explicitScopePart.isEmpty() ? und : followPath(und,fileScope,explicitScopePart); if (sc && item->getOuterScope()==sc) { //printf("] found it\n"); @@ -878,7 +878,7 @@ class AccessStack { public: AccessStack() : m_index(0) {} - void push(Definition *scope,FileDef *fileScope,Definition *item) + void push(const Definition *scope,const FileDef *fileScope,const Definition *item) { if (m_index<MAX_STACK_SIZE) { @@ -888,7 +888,7 @@ class AccessStack m_index++; } } - void push(Definition *scope,FileDef *fileScope,Definition *item,const QCString &expScope) + void push(const Definition *scope,const FileDef *fileScope,const Definition *item,const QCString &expScope) { if (m_index<MAX_STACK_SIZE) { @@ -903,7 +903,7 @@ class AccessStack { if (m_index>0) m_index--; } - bool find(Definition *scope,FileDef *fileScope, Definition *item) + bool find(const Definition *scope,const FileDef *fileScope, const Definition *item) { int i=0; for (i=0;i<m_index;i++) @@ -916,7 +916,7 @@ class AccessStack } return FALSE; } - bool find(Definition *scope,FileDef *fileScope, Definition *item,const QCString &expScope) + bool find(const Definition *scope,const FileDef *fileScope, const Definition *item,const QCString &expScope) { int i=0; for (i=0;i<m_index;i++) @@ -934,9 +934,9 @@ class AccessStack /** Element in the stack. */ struct AccessElem { - Definition *scope; - FileDef *fileScope; - Definition *item; + const Definition *scope; + const FileDef *fileScope; + const Definition *item; QCString expScope; }; int m_index; @@ -946,7 +946,7 @@ class AccessStack /* Returns the "distance" (=number of levels up) from item to scope, or -1 * if item in not inside scope. */ -int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item) +int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Definition *item) { //printf("<isAccesibleFrom(scope=%s,item=%s itemScope=%s)\n", // scope->name().data(),item->name().data(),item->getOuterScope()->name().data()); @@ -1049,8 +1049,8 @@ done: * not found and then A::I is searched in the global scope, which matches and * thus the result is 1. */ -int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, - Definition *item,const QCString &explicitScopePart) +int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScope, + const Definition *item,const QCString &explicitScopePart) { if (explicitScopePart.isEmpty()) { @@ -1070,7 +1070,7 @@ int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope, // item?item->name().data():"<none>", // explicitScopePart.data()); int result=0; // assume we found it - Definition *newScope = followPath(scope,fileScope,explicitScopePart); + const Definition *newScope = followPath(scope,fileScope,explicitScopePart); if (newScope) // explicitScope is inside scope => newScope is the result { Definition *itemScope = item->getOuterScope(); @@ -1207,8 +1207,8 @@ int computeQualifiedIndex(const QCString &name) return name.findRev("::",i==-1 ? name.length() : i); } -static void getResolvedSymbol(Definition *scope, - FileDef *fileScope, +static void getResolvedSymbol(const Definition *scope, + const FileDef *fileScope, Definition *d, const QCString &explicitScopePart, ArgumentList *actTemplParams, @@ -1372,8 +1372,8 @@ static void getResolvedSymbol(Definition *scope, * match against the input name. Can recursively call itself when * resolving typedefs. */ -static ClassDef *getResolvedClassRec(Definition *scope, - FileDef *fileScope, +static ClassDef *getResolvedClassRec(const Definition *scope, + const FileDef *fileScope, const char *n, MemberDef **pTypeDef, QCString *pTemplSpec, @@ -1561,8 +1561,8 @@ static ClassDef *getResolvedClassRec(Definition *scope, * Loops through scope and each of its parent scopes looking for a * match against the input name. */ -ClassDef *getResolvedClass(Definition *scope, - FileDef *fileScope, +ClassDef *getResolvedClass(const Definition *scope, + const FileDef *fileScope, const char *n, MemberDef **pTypeDef, QCString *pTemplSpec, @@ -1993,8 +1993,8 @@ bool leftScopeMatch(const QCString &scope, const QCString &name) } -void linkifyText(const TextGeneratorIntf &out,Definition *scope, - FileDef *fileScope,Definition *self, +void linkifyText(const TextGeneratorIntf &out, const Definition *scope, + const FileDef *fileScope,const Definition *self, const char *text, bool autoBreak,bool external, bool keepSpaces,int indentLevel) { @@ -122,9 +122,9 @@ QCString getLanguageSpecificSeparator(SrcLangExt lang,bool classScope=FALSE); //-------------------------------------------------------------------- void linkifyText(const TextGeneratorIntf &ol, - Definition *scope, - FileDef *fileScope, - Definition *self, + const Definition *scope, + const FileDef *fileScope, + const Definition *self, const char *text, bool autoBreak=FALSE, bool external=TRUE, @@ -203,8 +203,8 @@ QCString resolveDefines(const char *n); ClassDef *getClass(const char *key); -ClassDef *getResolvedClass(Definition *scope, - FileDef *fileScope, +ClassDef *getResolvedClass(const Definition *scope, + const FileDef *fileScope, const char *key, MemberDef **pTypeDef=0, QCString *pTemplSpec=0, @@ -358,9 +358,9 @@ QCString stripExtension(const char *fName); void replaceNamespaceAliases(QCString &scope,int i); -int isAccessibleFrom(Definition *scope,FileDef *fileScope,Definition *item); +int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Definition *item); -int isAccessibleFromWithExpScope(Definition *scope,FileDef *fileScope,Definition *item, +int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScope,const Definition *item, const QCString &explicitScopePart); int computeQualifiedIndex(const QCString &name); @@ -392,7 +392,7 @@ MemberDef *getMemberFromSymbol(Definition *scope,FileDef *fileScope, const char *n); bool checkIfTypedef(Definition *scope,FileDef *fileScope,const char *n); -ClassDef *newResolveTypedef(FileDef *fileScope,MemberDef *md, +ClassDef *newResolveTypedef(const FileDef *fileScope,MemberDef *md, MemberDef **pMemType=0,QCString *pTemplSpec=0, QCString *pResolvedType=0, ArgumentList *actTemplParams=0); |