diff options
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/code.l | 55 | ||||
-rw-r--r-- | src/doxygen.cpp | 54 | ||||
-rw-r--r-- | src/doxygen.h | 6 | ||||
-rw-r--r-- | src/memberdef.cpp | 14 | ||||
-rw-r--r-- | src/memberdef.h | 4 | ||||
-rw-r--r-- | src/pycode.l | 22 | ||||
-rw-r--r-- | src/util.cpp | 60 | ||||
-rw-r--r-- | src/util.h | 14 |
9 files changed, 119 insertions, 112 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index a7f24ed..a7b59c1 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -3330,7 +3330,7 @@ void ClassDefImpl::addTypeConstraint(const QCString &typeConstraint,const QCStri //printf("addTypeContraint(%s,%s)\n",type.data(),typeConstraint.data()); static bool hideUndocRelation = Config_getBool(HIDE_UNDOC_RELATIONS); if (typeConstraint.isEmpty() || type.isEmpty()) return; - ClassDef *cd = getResolvedClass(this,getFileDef(),typeConstraint); + ClassDef *cd = const_cast<ClassDef*>(getResolvedClass(this,getFileDef(),typeConstraint)); if (cd==0 && !hideUndocRelation) { cd = new ClassDefImpl(getDefFileName(),getDefLine(),getDefColumn(),typeConstraint,ClassDef::Class); @@ -139,9 +139,9 @@ struct ObjCCallCtx QCString methodName; QCString objectTypeOrName; QGString comment; - ClassDef *objectType; - MemberDef *objectVar; - MemberDef *method; + const ClassDef *objectType; + const MemberDef *objectVar; + const MemberDef *method; QCString format; int lexState; int braceCount; @@ -252,7 +252,7 @@ void VariableContext::addVariable(const QCString &type,const QCString &name) DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n", ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"<none>")); Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); - ClassDef *varType; + const ClassDef *varType; int i=0; if ( (varType=g_codeClassSDict->find(ltype)) || // look for class definitions inside the code block @@ -695,7 +695,7 @@ static void setParameterList(const MemberDef *md) } } -static ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) +static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) { int pos=0; QCString type = s; @@ -704,7 +704,7 @@ static ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) while (extractClassNameFromType(type,pos,className,templSpec)!=-1) { QCString clName=className+templSpec; - ClassDef *cd=0; + const ClassDef *cd=0; if (!g_classScope.isEmpty()) { cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName); @@ -843,7 +843,7 @@ static void updateCallContextForSmartPointer() MemberDef *md; if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast<const ClassDef*>(d))->isSmartPointer())) { - ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope()); + const ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope()); if (ncd) { g_theCallContext.setScope(ncd); @@ -961,8 +961,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName { className = substitute(className,".","::"); // for PHP namespaces } - ClassDef *cd=0,*lcd=0; - MemberDef *md=0; + const ClassDef *cd=0,*lcd=0; + const MemberDef *md=0; bool isLocal=FALSE; //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); @@ -1033,7 +1033,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName anchor.sprintf("_a%d",g_anchorCount); //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), // g_exampleFile.data()); - if (cd->addExample(anchor,g_exampleName,g_exampleFile)) + if (const_cast<ClassDef*>(cd)->addExample(anchor,g_exampleName,g_exampleFile)) { ol.writeCodeAnchor(anchor); g_anchorCount++; @@ -1050,7 +1050,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName if (d && d->isLinkable() && md->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md)); } } } @@ -1092,8 +1092,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName } text+=getLanguageSpecificSeparator(md->getLanguage()); text+=clName; - md->setName(text); - md->setLocalName(text); + const_cast<MemberDef*>(md)->setName(text); + const_cast<MemberDef*>(md)->setLocalName(text); } else // normal reference { @@ -1103,7 +1103,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName addToSearchIndex(clName); if (g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md)); } return; } @@ -1139,7 +1139,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const } } - ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); + const ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); g_theCallContext.setScope(typeClass); @@ -1220,7 +1220,7 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, if (varName.isEmpty()) return; // look for the variable in the current context - ClassDef *vcd = g_theVarContext.findVariable(varName); + const ClassDef *vcd = g_theVarContext.findVariable(varName); if (vcd) { if (vcd!=VariableContext::dummyContext) @@ -1265,14 +1265,14 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, if (vmn) { MemberNameIterator vmni(*vmn); - MemberDef *vmd; + const MemberDef *vmd; for (;(vmd=vmni.current());++vmni) { if (/*(vmd->isVariable() || vmd->isFunction()) && */ vmd->getClassDef()==jcd) { //printf("Found variable type=%s\n",vmd->typeString()); - ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); + const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); if (mcd && mcd->isLinkable()) { if (generateClassMemberLink(ol,mcd,memName)) return; @@ -1286,14 +1286,14 @@ static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, { //printf("There is a variable with name `%s'\n",varName); MemberNameIterator vmni(*vmn); - MemberDef *vmd; + const MemberDef *vmd; for (;(vmd=vmni.current());++vmni) { if (/*(vmd->isVariable() || vmd->isFunction()) && */ vmd->getClassDef()==vcd) { //printf("Found variable type=%s\n",vmd->typeString()); - ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); + const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); if (mcd && mcd->isLinkable()) { if (generateClassMemberLink(ol,mcd,memName)) return; @@ -1561,7 +1561,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) writeMultiLineCodeLink(*g_code,ctx->method,pName->data()); if (g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,ctx->method); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(ctx->method)); } } else @@ -1640,7 +1640,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) writeMultiLineCodeLink(*g_code,ctx->objectVar,pObject->data()); if (g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,ctx->objectVar); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(ctx->objectVar)); } } else if (ctx->objectType && @@ -1648,12 +1648,12 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) ctx->objectType->isLinkable() ) // object is class name { - ClassDef *cd = ctx->objectType; + const ClassDef *cd = ctx->objectType; writeMultiLineCodeLink(*g_code,cd,pObject->data()); } else // object still needs to be resolved { - ClassDef *cd = getResolvedClass(g_currentDefinition, + const ClassDef *cd = getResolvedClass(g_currentDefinition, g_sourceFileDef, *pObject); if (cd && cd->isLinkable()) { @@ -2302,12 +2302,11 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" char *s=g_curClassBases.first(); while (s) { - ClassDef *bcd; - bcd=g_codeClassSDict->find(s); + const ClassDef *bcd=g_codeClassSDict->find(s); if (bcd==0) bcd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s); if (bcd && bcd!=ncd) { - ncd->insertBaseClass(bcd,s,Public,Normal); + ncd->insertBaseClass(const_cast<ClassDef*>(bcd),s,Public,Normal); } s=g_curClassBases.next(); } @@ -3192,7 +3191,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" { QCString scope = g_name.left(index); if (!g_classScope.isEmpty()) scope.prepend(g_classScope+"::"); - ClassDef *cd=getResolvedClass(Doxygen::globalScope,g_sourceFileDef,scope); + const ClassDef *cd=getResolvedClass(Doxygen::globalScope,g_sourceFileDef,scope); if (cd) { setClassScope(cd->name()); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 55b601c..0d05f13 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -2070,7 +2070,7 @@ static void findUsingDeclarations(Entry *root) // vector -> std::vector if (usingCd==0) { - usingCd = getResolvedClass(nd,fd,name); // try via resolving (see also bug757509) + usingCd = const_cast<ClassDef*>(getResolvedClass(nd,fd,name)); // try via resolving (see also bug757509) } if (usingCd==0) { @@ -2136,7 +2136,7 @@ static void findUsingDeclImports(Entry *root) { QCString scope=root->name.left(i); QCString memName=root->name.right(root->name.length()-i-2); - ClassDef *bcd = getResolvedClass(cd,0,scope); // todo: file in fileScope parameter + const ClassDef *bcd = getResolvedClass(cd,0,scope); // todo: file in fileScope parameter if (bcd) { //printf("found class %s memName=%s\n",bcd->name().data(),memName.data()); @@ -2328,7 +2328,8 @@ static MemberDef *addVariableToClass( { //printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n", // md->getClassDef(),cd,root->type.data(),md->typeString()); - if (md->getClassDef()==cd && + if (!md->isAlias() && + md->getClassDef()==cd && removeRedundantWhiteSpace(root->type)==md->typeString()) // member already in the scope { @@ -2556,7 +2557,7 @@ static MemberDef *addVariableToFile( MemberDef *md; for (mni.toFirst();(md=mni.current());++mni) { - if ( + if (!md->isAlias() && ((nd==0 && md->getNamespaceDef()==0 && md->getFileDef() && root->fileName==md->getFileDef()->absFilePath() ) // both variable names in the same file @@ -4229,11 +4230,11 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co FileDef *fd=cd->getFileDef(); if (context && cd!=context) { - result = getResolvedClass(context,0,name,0,0,TRUE,TRUE); + result = const_cast<ClassDef*>(getResolvedClass(context,0,name,0,0,TRUE,TRUE)); } if (result==0) { - result = getResolvedClass(cd,fd,name,0,0,TRUE,TRUE); + result = const_cast<ClassDef*>(getResolvedClass(cd,fd,name,0,0,TRUE,TRUE)); } if (result==0) // try direct class, needed for namespaced classes imported via tag files (see bug624095) { @@ -4301,7 +4302,7 @@ static void findUsedClassesForClass(Entry *root, while (!found && extractClassNameFromType(type,pos,usedClassName,templSpec,root->lang)!=-1) { // find the type (if any) that matches usedClassName - ClassDef *typeCd = getResolvedClass(masterCd, + const ClassDef *typeCd = getResolvedClass(masterCd, masterCd->getFileDef(), usedClassName, 0,0, @@ -4702,16 +4703,17 @@ static bool findClassRelation( //baseClassName=stripTemplateSpecifiersFromScope // (removeRedundantWhiteSpace(baseClassName),TRUE, // &stripped); - MemberDef *baseClassTypeDef=0; + const MemberDef *baseClassTypeDef=0; QCString templSpec; - ClassDef *baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, + ClassDef *baseClass=const_cast<ClassDef*>( + getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, cd->getFileDef(), baseClassName, &baseClassTypeDef, &templSpec, mode==Undocumented, TRUE - ); + )); //printf("baseClassName=%s baseClass=%p cd=%p explicitGlobalScope=%d\n", // baseClassName.data(),baseClass,cd,explicitGlobalScope); //printf(" scope=`%s' baseClassName=`%s' baseClass=%s templSpec=%s\n", @@ -4762,14 +4764,15 @@ static bool findClassRelation( { templSpec=removeRedundantWhiteSpace(baseClassName.mid(i,e-i)); baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e); - baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, - cd->getFileDef(), - baseClassName, - &baseClassTypeDef, - 0, //&templSpec, - mode==Undocumented, - TRUE - ); + baseClass=const_cast<ClassDef*>( + getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, + cd->getFileDef(), + baseClassName, + &baseClassTypeDef, + 0, //&templSpec, + mode==Undocumented, + TRUE + )); //printf("baseClass=%p -> baseClass=%s templSpec=%s\n", // baseClass,baseClassName.data(),templSpec.data()); } @@ -4798,14 +4801,15 @@ static bool findClassRelation( QCString tmpTemplSpec; // replace any namespace aliases replaceNamespaceAliases(baseClassName,si); - baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, + baseClass=const_cast<ClassDef*>( + getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, cd->getFileDef(), baseClassName, &baseClassTypeDef, &tmpTemplSpec, mode==Undocumented, TRUE - ); + )); found=baseClass!=0 && baseClass!=cd; if (found) templSpec = tmpTemplSpec; } @@ -5477,10 +5481,10 @@ static void addMemberDocs(Entry *root, // find a class definition given the scope name and (optionally) a // template list specifier -static ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, +static const ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, const char *scopeName) { - ClassDef *tcd = getResolvedClass(nd,fd,scopeName,0,0,TRUE,TRUE); + const ClassDef *tcd = getResolvedClass(nd,fd,scopeName,0,0,TRUE,TRUE); return tcd; } @@ -7331,7 +7335,7 @@ static void addEnumValuesToEnums(Entry *root) MemberDef *md; for (mni.toFirst(); (md=mni.current()) ; ++mni) // for each enum in this list { - if (md->isEnumerate() && root->children()) + if (!md->isAlias() && md->isEnumerate() && root->children()) { //printf(" enum with %d children\n",root->children()->count()); EntryListIterator eli(*root->children()); // for each enum value @@ -8519,7 +8523,7 @@ static void flushCachedTemplateRelations() { if (fmd->isTypedefValCached()) { - ClassDef *cd = fmd->getCachedTypedefVal(); + const ClassDef *cd = fmd->getCachedTypedefVal(); if (cd->isTemplate()) fmd->invalidateTypedefValCache(); } } @@ -8533,7 +8537,7 @@ static void flushCachedTemplateRelations() { if (fmd->isTypedefValCached()) { - ClassDef *cd = fmd->getCachedTypedefVal(); + const ClassDef *cd = fmd->getCachedTypedefVal(); if (cd->isTemplate()) fmd->invalidateTypedefValCache(); } } diff --git a/src/doxygen.h b/src/doxygen.h index f5ad0bb..c8eee7c 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -77,10 +77,10 @@ class StringDict : public QDict<QCString> struct LookupInfo { LookupInfo() : classDef(0), typeDef(0) {} - LookupInfo(ClassDef *cd,MemberDef *td,QCString ts,QCString rt) + LookupInfo(const ClassDef *cd,const MemberDef *td,QCString ts,QCString rt) : classDef(cd), typeDef(td), templSpec(ts),resolvedType(rt) {} - ClassDef *classDef; - MemberDef *typeDef; + const ClassDef *classDef; + const MemberDef *typeDef; QCString templSpec; QCString resolvedType; }; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 15da899..4dca53f 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -220,7 +220,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual QCString getScopeString() const; virtual ClassDef *getClassDefOfAnonymousType() const; virtual bool isTypedefValCached() const; - virtual ClassDef *getCachedTypedefVal() const; + virtual const ClassDef *getCachedTypedefVal() const; virtual QCString getCachedTypedefTemplSpec() const; virtual QCString getCachedResolvedTypedef() const; virtual MemberDef *memberDefinition() const; @@ -295,7 +295,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual void addListReference(Definition *d); virtual void setDocsForDefinition(bool b); virtual void setGroupAlias(const MemberDef *md); - virtual void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType); + virtual void cacheTypedefVal(const ClassDef *val,const QCString &templSpec,const QCString &resolvedType); virtual void invalidateTypedefValCache(); virtual void invalidateCachedArgumentTypes(); virtual void setMemberDefinition(MemberDef *md); @@ -693,7 +693,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef { return getMdAlias()->getClassDefOfAnonymousType(); } virtual bool isTypedefValCached() const { return getMdAlias()->isTypedefValCached(); } - virtual ClassDef *getCachedTypedefVal() const + virtual const ClassDef *getCachedTypedefVal() const { return getMdAlias()->getCachedTypedefVal(); } virtual QCString getCachedTypedefTemplSpec() const { return getMdAlias()->getCachedTypedefTemplSpec(); } @@ -802,7 +802,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef virtual void addListReference(Definition *d) {} virtual void setDocsForDefinition(bool b) {} virtual void setGroupAlias(const MemberDef *md) {} - virtual void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType) {} + virtual void cacheTypedefVal(const ClassDef *val,const QCString &templSpec,const QCString &resolvedType) {} virtual void invalidateTypedefValCache() {} virtual void invalidateCachedArgumentTypes() {} virtual void setMemberDefinition(MemberDef *md) {} @@ -1364,7 +1364,7 @@ class MemberDefImpl::IMPL MemberDef *groupMember; bool isTypedefValCached; - ClassDef *cachedTypedefValue; + const ClassDef *cachedTypedefValue; QCString cachedTypedefTemplSpec; QCString cachedResolvedType; @@ -5626,7 +5626,7 @@ bool MemberDefImpl::isTypedefValCached() const return m_impl->isTypedefValCached; } -ClassDef *MemberDefImpl::getCachedTypedefVal() const +const ClassDef *MemberDefImpl::getCachedTypedefVal() const { return m_impl->cachedTypedefValue; } @@ -5908,7 +5908,7 @@ QCString MemberDefImpl::enumBaseType() const } -void MemberDefImpl::cacheTypedefVal(ClassDef*val, const QCString & templSpec, const QCString &resolvedType) +void MemberDefImpl::cacheTypedefVal(const ClassDef*val, const QCString & templSpec, const QCString &resolvedType) { m_impl->isTypedefValCached=TRUE; m_impl->cachedTypedefValue=val; diff --git a/src/memberdef.h b/src/memberdef.h index a742117..af4fb0a 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -248,7 +248,7 @@ class MemberDef : virtual public Definition // cached typedef functions virtual bool isTypedefValCached() const = 0; - virtual ClassDef *getCachedTypedefVal() const = 0; + virtual const ClassDef *getCachedTypedefVal() const = 0; virtual QCString getCachedTypedefTemplSpec() const = 0; virtual QCString getCachedResolvedTypedef() const = 0; @@ -357,7 +357,7 @@ class MemberDef : virtual public Definition virtual void setDocsForDefinition(bool b) = 0; virtual void setGroupAlias(const MemberDef *md) = 0; - virtual void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType) = 0; + virtual void cacheTypedefVal(const ClassDef *val,const QCString &templSpec,const QCString &resolvedType) = 0; virtual void invalidateTypedefValCache() = 0; virtual void invalidateCachedArgumentTypes() = 0; diff --git a/src/pycode.l b/src/pycode.l index 1a87bca..010d188 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -162,7 +162,7 @@ void PyVariableContext::addVariable(const QCString &type,const QCString &name) QCString lname = name.simplifyWhiteSpace(); Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); - ClassDef *varType; + const ClassDef *varType; if ( (varType=g_codeClassSDict[ltype]) || // look for class definitions inside the code block (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,ltype)) // look for global class definitions @@ -212,7 +212,7 @@ class PyCallContext Ctx() : name(g_name), type(g_type), cd(0) {} QCString name; QCString type; - ClassDef *cd; + const ClassDef *cd; }; PyCallContext() @@ -223,7 +223,7 @@ class PyCallContext virtual ~PyCallContext() {} - void setClass(ClassDef *cd) + void setClass(const ClassDef *cd) { Ctx *ctx = m_classList.getLast(); if (ctx) @@ -259,7 +259,7 @@ class PyCallContext m_classList.append(new Ctx); } - ClassDef *getClass() const + const ClassDef *getClass() const { Ctx *ctx = m_classList.getLast(); @@ -320,7 +320,7 @@ static void addToSearchIndex(const char *text) } -static ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) +static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) { int pos=0; QCString type = s; @@ -330,7 +330,7 @@ static ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) { QCString clName=className+templSpec; - ClassDef *cd=0; + const ClassDef *cd=0; if (!g_classScope.isEmpty()) { cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName); @@ -616,8 +616,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",className.data())); - ClassDef *cd=0,*lcd=0; /** Class def that we may find */ - MemberDef *md=0; /** Member def that we may find */ + const ClassDef *cd=0,*lcd=0; /** Class def that we may find */ + const MemberDef *md=0; /** Member def that we may find */ //bool isLocal=FALSE; if ((lcd=g_theVarContext.findVariable(className))==0) // not a local variable @@ -669,7 +669,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, if (d && d->isLinkable() && md->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md)); } } } @@ -1091,7 +1091,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT char *s=g_curClassBases.first(); while (s) { - ClassDef *baseDefToAdd=g_codeClassSDict[s]; + const ClassDef *baseDefToAdd=g_codeClassSDict[s]; // Try to find class in global // scope @@ -1102,7 +1102,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT if (baseDefToAdd && baseDefToAdd!=classDefToAdd) { - classDefToAdd->insertBaseClass(baseDefToAdd,s,Public,Normal); + classDefToAdd->insertBaseClass(const_cast<ClassDef*>(baseDefToAdd),s,Public,Normal); } s=g_curClassBases.next(); diff --git a/src/util.cpp b/src/util.cpp index 013b0e4..70c0fce 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -518,10 +518,10 @@ static QDict<MemberDef> g_resolvedTypedefs; static QDict<Definition> g_visitedNamespaces; // forward declaration -static ClassDef *getResolvedClassRec(const Definition *scope, +static const ClassDef *getResolvedClassRec(const Definition *scope, const FileDef *fileScope, const char *n, - MemberDef **pTypeDef, + const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType ); @@ -535,10 +535,12 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop * * Example: typedef int T; will return 0, since "int" is not a class. */ -ClassDef *newResolveTypedef(const FileDef *fileScope,MemberDef *md, - MemberDef **pMemType,QCString *pTemplSpec, - QCString *pResolvedType, - ArgumentList *actTemplParams) +const ClassDef *newResolveTypedef(const FileDef *fileScope, + const MemberDef *md, + const MemberDef **pMemType, + QCString *pTemplSpec, + QCString *pResolvedType, + ArgumentList *actTemplParams) { //printf("newResolveTypedef(md=%p,cachedVal=%p)\n",md,md->getCachedTypedefVal()); bool isCached = md->isTypedefValCached(); // value already cached @@ -581,8 +583,8 @@ ClassDef *newResolveTypedef(const FileDef *fileScope,MemberDef *md, int sp=0; tl=type.length(); // length may have been changed while (sp<tl && type.at(sp)==' ') sp++; - MemberDef *memTypeDef = 0; - ClassDef *result = getResolvedClassRec(md->getOuterScope(), + const MemberDef *memTypeDef = 0; + const ClassDef *result = getResolvedClassRec(md->getOuterScope(), fileScope,type,&memTypeDef,0,pResolvedType); // if type is a typedef then return what it resolves to. if (memTypeDef && memTypeDef->isTypedef()) @@ -652,7 +654,7 @@ done: //printf("setting cached typedef %p in result %p\n",md,result); //printf("==> %s (%s,%d)\n",result->name().data(),result->getDefFileName().data(),result->getDefLine()); //printf("*pResolvedType=%s\n",pResolvedType?pResolvedType->data():"<none>"); - md->cacheTypedefVal(result, + const_cast<MemberDef*>(md)->cacheTypedefVal(result, pTemplSpec ? *pTemplSpec : QCString(), pResolvedType ? *pResolvedType : QCString() ); @@ -667,7 +669,7 @@ done: * value of the typedef or \a name if no typedef was found. */ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,const QCString &name, - MemberDef **pTypeDef=0) + const MemberDef **pTypeDef=0) { QCString result=name; if (name.isEmpty()) return result; @@ -763,12 +765,12 @@ static const Definition *followPath(const Definition *start,const FileDef *fileS while ((is=getScopeFragment(path,ps,&l))!=-1) { // try to resolve the part if it is a typedef - MemberDef *typeDef=0; + const MemberDef *typeDef=0; QCString qualScopePart = substTypedef(current,fileScope,path.mid(is,l),&typeDef); //printf(" qualScopePart=%s\n",qualScopePart.data()); if (typeDef) { - ClassDef *type = newResolveTypedef(fileScope,typeDef); + const ClassDef *type = newResolveTypedef(fileScope,typeDef); if (type) { //printf("Found type %s\n",type->name().data()); @@ -1218,8 +1220,8 @@ static void getResolvedSymbol(const Definition *scope, const QCString &explicitScopePart, ArgumentList *actTemplParams, int &minDistance, - ClassDef *&bestMatch, - MemberDef *&bestTypedef, + const ClassDef *&bestMatch, + const MemberDef *&bestTypedef, QCString &bestTemplSpec, QCString &bestResolvedType ) @@ -1306,8 +1308,8 @@ static void getResolvedSymbol(const Definition *scope, QCString spec; QCString type; minDistance=distance; - MemberDef *enumType = 0; - ClassDef *cd = newResolveTypedef(fileScope,md,&enumType,&spec,&type,actTemplParams); + const MemberDef *enumType = 0; + const ClassDef *cd = newResolveTypedef(fileScope,md,&enumType,&spec,&type,actTemplParams); if (cd) // type resolves to a class { //printf(" bestTypeDef=%p spec=%s type=%s\n",md,spec.data(),type.data()); @@ -1377,10 +1379,10 @@ static void getResolvedSymbol(const Definition *scope, * match against the input name. Can recursively call itself when * resolving typedefs. */ -static ClassDef *getResolvedClassRec(const Definition *scope, +static const ClassDef *getResolvedClassRec(const Definition *scope, const FileDef *fileScope, const char *n, - MemberDef **pTypeDef, + const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType ) @@ -1499,8 +1501,8 @@ static ClassDef *getResolvedClassRec(const Definition *scope, Doxygen::lookupCache->insert(key,new LookupInfo); } - ClassDef *bestMatch=0; - MemberDef *bestTypedef=0; + const ClassDef *bestMatch=0; + const MemberDef *bestTypedef=0; QCString bestTemplSpec; QCString bestResolvedType; int minDistance=10000; // init at "infinite" @@ -1566,10 +1568,10 @@ static ClassDef *getResolvedClassRec(const Definition *scope, * Loops through scope and each of its parent scopes looking for a * match against the input name. */ -ClassDef *getResolvedClass(const Definition *scope, +const ClassDef *getResolvedClass(const Definition *scope, const FileDef *fileScope, const char *n, - MemberDef **pTypeDef, + const MemberDef **pTypeDef, QCString *pTemplSpec, bool mayBeUnlinkable, bool mayBeHidden, @@ -1593,7 +1595,7 @@ ClassDef *getResolvedClass(const Definition *scope, // n, // mayBeUnlinkable // ); - ClassDef *result; + const ClassDef *result; if (optimizeOutputVhdl) { result = getClass(n); @@ -2093,7 +2095,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, const GroupDef *gd=0; //printf("** Match word '%s'\n",matchWord.data()); - MemberDef *typeDef=0; + const MemberDef *typeDef=0; cd=getResolvedClass(scope,fileScope,matchWord,&typeDef); if (typeDef) // First look at typedef then class, see bug 584184. { @@ -3501,8 +3503,8 @@ static QCString getCanonicalTypeForIdentifier( //printf("getCanonicalTypeForIdentifier(%s,[%s->%s]) start\n", // word.data(),tSpec?tSpec->data():"<none>",templSpec.data()); - ClassDef *cd = 0; - MemberDef *mType = 0; + const ClassDef *cd = 0; + const MemberDef *mType = 0; QCString ts; QCString resolvedType; @@ -4135,8 +4137,8 @@ bool getDefs(const QCString &scName, className=mScope; } - MemberDef *tmd=0; - ClassDef *fcd=getResolvedClass(Doxygen::globalScope,0,className,&tmd); + const MemberDef *tmd=0; + const ClassDef *fcd=getResolvedClass(Doxygen::globalScope,0,className,&tmd); if (fcd==0 && className.find('<')!=-1) // try without template specifiers as well { QCString nameWithoutTemplates = stripTemplateSpecifiersFromScope(className,FALSE); @@ -6366,7 +6368,7 @@ QCString normalizeNonTemplateArgumentsInString( if (!found) { // try to resolve the type - ClassDef *cd = getResolvedClass(context,0,n); + const ClassDef *cd = getResolvedClass(context,0,n); if (cd) { result+=cd->name(); @@ -206,10 +206,10 @@ QCString resolveDefines(const char *n); ClassDef *getClass(const char *key); -ClassDef *getResolvedClass(const Definition *scope, +const ClassDef *getResolvedClass(const Definition *scope, const FileDef *fileScope, const char *key, - MemberDef **pTypeDef=0, + const MemberDef **pTypeDef=0, QCString *pTemplSpec=0, bool mayBeUnlinkable=FALSE, bool mayBeHidden=FALSE, @@ -397,10 +397,12 @@ MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fileScope, const char *n); bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const char *n); -ClassDef *newResolveTypedef(const FileDef *fileScope,MemberDef *md, - MemberDef **pMemType=0,QCString *pTemplSpec=0, - QCString *pResolvedType=0, - ArgumentList *actTemplParams=0); +const ClassDef *newResolveTypedef(const FileDef *fileScope, + const MemberDef *md, + const MemberDef **pMemType=0, + QCString *pTemplSpec=0, + QCString *pResolvedType=0, + ArgumentList *actTemplParams=0); QCString parseCommentAsText(const Definition *scope,const MemberDef *member,const QCString &doc,const QCString &fileName,int lineNr); |