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/namespacedef.h | |
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/namespacedef.h')
-rw-r--r-- | src/namespacedef.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/namespacedef.h b/src/namespacedef.h index 8ce0ef1..b81480e 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -34,14 +34,12 @@ class FTextStream; class NamespaceDefMutable; /** An abstract interface of a namespace symbol. */ -class NamespaceDef : virtual public Definition +class NamespaceDef : public Definition { public: virtual ~NamespaceDef() {} virtual DefType definitionType() const = 0; - static NamespaceDefMutable *make_mutable(const NamespaceDef *); - // ---- getters virtual QCString getOutputFileBase() const = 0; virtual QCString anchor() const = 0; @@ -89,7 +87,7 @@ class NamespaceDef : virtual public Definition virtual bool isVisited() const = 0; }; -class NamespaceDefMutable : virtual public DefinitionMutable, virtual public NamespaceDef +class NamespaceDefMutable : public DefinitionMutable, public NamespaceDef { public: @@ -118,9 +116,6 @@ class NamespaceDefMutable : virtual public DefinitionMutable, virtual public Nam virtual void setInline(bool isInline) = 0; }; -inline NamespaceDefMutable *NamespaceDef::make_mutable(const NamespaceDef *nd) -{ return dynamic_cast<NamespaceDefMutable*>(const_cast<NamespaceDef*>(nd)); } - /** Factory method to create new NamespaceDef instance */ NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn, const char *name,const char *ref=0, @@ -130,6 +125,19 @@ NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int /** Factory method to create an alias of an existing namespace. Used for inline namespaces. */ NamespaceDef *createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd); + +// --- Cast functions + +NamespaceDef *toNamespaceDef(Definition *d); +NamespaceDef *toNamespaceDef(DefinitionMutable *d); +const NamespaceDef *toNamespaceDef(const Definition *d); +NamespaceDefMutable *toNamespaceDefMutable(Definition *d); +NamespaceDefMutable *toNamespaceDefMutable(const Definition *d); + +//------------------------------------------------------------------------ + + + /** A list of NamespaceDef objects. */ class NamespaceList : public QList<NamespaceDef> { |