diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-11-12 18:41:11 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-11-13 19:43:43 (GMT) |
commit | 784313b82442747843145429d39e5d257256b7b0 (patch) | |
tree | 195922e2d73dce62f125221bf1f30e0bf4b37f02 /src/filedef.cpp | |
parent | 075229e586b391c3ec7ad79597aaeae392ca64e5 (diff) | |
download | Doxygen-784313b82442747843145429d39e5d257256b7b0.zip Doxygen-784313b82442747843145429d39e5d257256b7b0.tar.gz Doxygen-784313b82442747843145429d39e5d257256b7b0.tar.bz2 |
Refactoring: replacing dynamic_cast by static_cast to improve performance
Diffstat (limited to 'src/filedef.cpp')
-rw-r--r-- | src/filedef.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/filedef.cpp b/src/filedef.cpp index aa6d598..01b5bfd 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -48,7 +48,7 @@ //--------------------------------------------------------------------------- -class FileDefImpl : public DefinitionImpl, public FileDef +class FileDefImpl : public DefinitionMixin<FileDef> { public: FileDefImpl(const char *p,const char *n,const char *ref=0,const char *dn=0); @@ -222,7 +222,7 @@ class DevNullCodeDocInterface : public CodeOutputInterface */ FileDefImpl::FileDefImpl(const char *p,const char *nm, const char *lref,const char *dn) - : DefinitionImpl((QCString)p+nm,1,1,nm) + : DefinitionMixin((QCString)p+nm,1,1,nm) { m_path=p; m_filePath=m_path+nm; @@ -1444,7 +1444,7 @@ const QCString &FileDefImpl::name() const if (Config_getBool(FULL_PATH_NAMES)) return m_fileName; else - return DefinitionImpl::name(); + return DefinitionMixin::name(); } void FileDefImpl::addSourceRef(int line,Definition *d,MemberDef *md) @@ -1895,7 +1895,7 @@ void FileDefImpl::combineUsingRelations() LinkedRefMap<const NamespaceDef> usingDirList = m_usingDirList; for (auto &nd : usingDirList) { - NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd); + NamespaceDefMutable *ndm = toNamespaceDefMutable(nd); if (ndm) { ndm->combineUsingRelations(); @@ -2016,7 +2016,7 @@ void FileDefImpl::addMemberToList(MemberListType lt,MemberDef *md) } if (ml->listType()&MemberListType_declarationLists) { - MemberDefMutable *mdm = MemberDef::make_mutable(md); + MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { mdm->setSectionList(this,ml); @@ -2170,3 +2170,31 @@ int FileDefImpl::numDecMembers() const return ml ? ml->numDecMembers() : 0; } +// --- Cast functions + +FileDef *toFileDef(Definition *d) +{ + if (d==0) return 0; + if (d && typeid(*d)==typeid(FileDefImpl)) + { + return static_cast<FileDef*>(d); + } + else + { + return 0; + } +} + +const FileDef *toFileDef(const Definition *d) +{ + if (d==0) return 0; + if (d && typeid(*d)==typeid(FileDefImpl)) + { + return static_cast<const FileDef*>(d); + } + else + { + return 0; + } +} + |