diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-04-21 13:59:23 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-04-21 14:01:25 (GMT) |
commit | 6216208b0a4288a41450e4d37226f0e4c492128c (patch) | |
tree | 07cee94d592cf127058652928be18534cc2a6b15 /src/searchindex.cpp | |
parent | d226bc27b3c80586234b9c7d8ba2abc500e3be02 (diff) | |
download | Doxygen-6216208b0a4288a41450e4d37226f0e4c492128c.zip Doxygen-6216208b0a4288a41450e4d37226f0e4c492128c.tar.gz Doxygen-6216208b0a4288a41450e4d37226f0e4c492128c.tar.bz2 |
Improved const correctness and added support for inline namespaces
Diffstat (limited to 'src/searchindex.cpp')
-rw-r--r-- | src/searchindex.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/searchindex.cpp b/src/searchindex.cpp index cfa8ed2..babefe9 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -86,12 +86,12 @@ SearchIndex::SearchIndex() : SearchIndexIntf(Internal), for (i=0;i<numIndexEntries;i++) m_index.insert(i,new QList<IndexWord>); } -void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile) +void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) { if (ctx==0) return; assert(!isSourceFile || ctx->definitionType()==Definition::TypeFile); //printf("SearchIndex::setCurrentDoc(%s,%s,%s)\n",name,baseName,anchor); - QCString url=isSourceFile ? (dynamic_cast<FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); + QCString url=isSourceFile ? (dynamic_cast<const FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); url+=Config_getString(HTML_FILE_EXTENSION); QCString baseUrl = url; if (anchor) url+=QCString("#")+anchor; @@ -99,7 +99,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource QCString name=ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) { - MemberDef *md = dynamic_cast<MemberDef *>(ctx); + const MemberDef *md = dynamic_cast<const MemberDef *>(ctx); name.prepend((md->getLanguage()==SrcLangExt_Fortran ? theTranslator->trSubprogram(TRUE,TRUE) : theTranslator->trMember(TRUE,TRUE))+" "); @@ -116,7 +116,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource { case Definition::TypePage: { - PageDef *pd = dynamic_cast<PageDef *>(ctx); + const PageDef *pd = dynamic_cast<const PageDef *>(ctx); if (pd->hasTitle()) { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); @@ -129,7 +129,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource break; case Definition::TypeClass: { - ClassDef *cd = dynamic_cast<ClassDef *>(ctx); + const ClassDef *cd = dynamic_cast<const ClassDef *>(ctx); name.prepend(cd->compoundTypeString()+" "); } break; @@ -151,7 +151,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource break; case Definition::TypeGroup: { - GroupDef *gd = dynamic_cast<GroupDef *>(ctx); + const GroupDef *gd = dynamic_cast<const GroupDef *>(ctx); if (gd->groupTitle()) { name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle(); @@ -442,11 +442,11 @@ SearchIndexExternal::~SearchIndexExternal() delete p; } -static QCString definitionToName(Definition *ctx) +static QCString definitionToName(const Definition *ctx) { if (ctx && ctx->definitionType()==Definition::TypeMember) { - MemberDef *md = dynamic_cast<MemberDef*>(ctx); + const MemberDef *md = dynamic_cast<const MemberDef*>(ctx); if (md->isFunction()) return "function"; else if (md->isSlot()) @@ -477,7 +477,7 @@ static QCString definitionToName(Definition *ctx) switch(ctx->definitionType()) { case Definition::TypeClass: - return (dynamic_cast<ClassDef*>(ctx))->compoundTypeString(); + return (dynamic_cast<const ClassDef*>(ctx))->compoundTypeString(); case Definition::TypeFile: return "file"; case Definition::TypeNamespace: @@ -497,10 +497,10 @@ static QCString definitionToName(Definition *ctx) return "unknown"; } -void SearchIndexExternal::setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile) +void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) { QCString extId = stripPath(Config_getString(EXTERNAL_SEARCH_ID)); - QCString baseName = isSourceFile ? (dynamic_cast<FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); + QCString baseName = isSourceFile ? (dynamic_cast<const FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); QCString url = baseName + Doxygen::htmlFileExtension; if (anchor) url+=QCString("#")+anchor; QCString key = extId+";"+url; @@ -514,7 +514,7 @@ void SearchIndexExternal::setCurrentDoc(Definition *ctx,const char *anchor,bool e->name = ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) { - e->args = (dynamic_cast<MemberDef*>(ctx))->argsString(); + e->args = (dynamic_cast<const MemberDef*>(ctx))->argsString(); } e->extId = extId; e->url = url; @@ -585,14 +585,14 @@ void SearchIndexExternal::write(const char *fileName) static SearchIndexInfo g_searchIndexInfo[NUM_SEARCH_INDICES]; -static void addMemberToSearchIndex(MemberDef *md) +static void addMemberToSearchIndex(const MemberDef *md) { static bool hideFriendCompounds = Config_getBool(HIDE_FRIEND_COMPOUNDS); bool isLinkable = md->isLinkable(); - ClassDef *cd=0; - NamespaceDef *nd=0; - FileDef *fd=0; - GroupDef *gd=0; + const ClassDef *cd=0; + const NamespaceDef *nd=0; + const FileDef *fd=0; + const GroupDef *gd=0; if (isLinkable && ( ((cd=md->getClassDef()) && cd->isLinkable() && cd->templateMaster()==0) || @@ -1074,7 +1074,7 @@ void writeJavascriptSearchIndex() } else if (md) { - FileDef *fd = md->getBodyDef(); + const FileDef *fd = md->getBodyDef(); if (fd==0) fd = md->getFileDef(); if (fd) { @@ -1155,8 +1155,8 @@ void writeJavascriptSearchIndex() { if (md) { - FileDef *fd = md->getBodyDef(); - if (fd==0) fd = md->getFileDef(); + const FileDef *fd = md->getBodyDef(); + if (fd==0) fd = md->resolveAlias()->getFileDef(); if (fd) { if (!prefix.isEmpty()) prefix+=": "; @@ -1165,7 +1165,7 @@ void writeJavascriptSearchIndex() } } } - else if (md && (md->getClassDef() || md->getNamespaceDef())) + else if (md && (md->resolveAlias()->getClassDef() || md->resolveAlias()->getNamespaceDef())) // member in class or namespace scope { SrcLangExt lang = md->getLanguage(); @@ -1315,7 +1315,7 @@ SearchIndexList::~SearchIndexList() { } -void SearchIndexList::append(Definition *d) +void SearchIndexList::append(const Definition *d) { QCString dispName = d->localName(); SearchDefinitionList *l = find(dispName); @@ -1323,11 +1323,11 @@ void SearchIndexList::append(Definition *d) { if (d->definitionType()==Definition::TypeGroup) { - dispName = (dynamic_cast<GroupDef*>(d))->groupTitle(); + dispName = (dynamic_cast<const GroupDef*>(d))->groupTitle(); } else if (d->definitionType()==Definition::TypePage) { - dispName = (dynamic_cast<PageDef*>(d))->title(); + dispName = (dynamic_cast<const PageDef*>(d))->title(); } l=new SearchDefinitionList(searchId(dispName),dispName); SDict< SearchDefinitionList >::append(dispName,l); |