From e22e89c0ed1c4fbf22021f4446a2900c65214cf2 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Fri, 23 Oct 2020 19:38:04 +0200 Subject: Refactoring: Remove unused DefinitionIntf and DefinitionList classes --- src/context.cpp | 18 ++++++++--------- src/definition.h | 61 +++++++++++++++++--------------------------------------- src/doxygen.cpp | 4 ++-- src/doxygen.h | 1 - src/index.cpp | 2 +- src/util.cpp | 1 - 6 files changed, 29 insertions(+), 58 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 2cbc122..59889ce 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -1554,16 +1554,14 @@ class DefinitionContext QCString result = "unspecified"; switch (m_def->definitionType()) { - case DefinitionIntf::TypeClass: result="class"; break; - case DefinitionIntf::TypeFile: result="file"; break; - case DefinitionIntf::TypeNamespace: result="namespace"; break; - case DefinitionIntf::TypeGroup: result="module"; break; - case DefinitionIntf::TypePackage: result="package"; break; - case DefinitionIntf::TypePage: result="page"; break; - case DefinitionIntf::TypeDir: result="dir"; break; - case DefinitionIntf::TypeMember: // fall through - case DefinitionIntf::TypeSymbolList: - break; + case Definition::TypeClass: result="class"; break; + case Definition::TypeFile: result="file"; break; + case Definition::TypeNamespace: result="namespace"; break; + case Definition::TypeGroup: result="module"; break; + case Definition::TypePackage: result="package"; break; + case Definition::TypePage: result="page"; break; + case Definition::TypeDir: result="dir"; break; + case Definition::TypeMember: break; } return result; } diff --git a/src/definition.h b/src/definition.h index b3d7853..9b31f2f 100644 --- a/src/definition.h +++ b/src/definition.h @@ -68,12 +68,19 @@ struct BodyInfo FileDef *fileDef; //!< file definition containing the function body }; -/** Abstract interface for a Definition or DefinitionList */ -class DefinitionIntf +/** The common base class of all entity definitions found in the sources. + * + * This can be a class or a member function, or a file, or a namespace, etc. + * Use definitionType() to find which type of definition this is. + */ +class Definition { public: - DefinitionIntf() {} - virtual ~DefinitionIntf() {} + struct Cookie + { + virtual ~Cookie() {} + }; + /*! Types of derived classes */ enum DefType { @@ -84,29 +91,16 @@ class DefinitionIntf TypeGroup = 4, TypePackage = 5, TypePage = 6, - TypeDir = 7, - TypeSymbolList = 8 - }; - /*! Use this for dynamic inspection of the type of the derived class */ - virtual DefType definitionType() const = 0; -}; - -/** The common base class of all entity definitions found in the sources. - * - * This can be a class or a member function, or a file, or a namespace, etc. - * Use definitionType() to find which type of definition this is. - */ -class Definition : public DefinitionIntf -{ - public: - struct Cookie - { - virtual ~Cookie() {} + TypeDir = 7 }; //----------------------------------------------------------------------------------- // ---- getters ----- //----------------------------------------------------------------------------------- + + /*! Use this for dynamic inspection of the type of the derived class */ + virtual DefType definitionType() const = 0; + /*! Returns TRUE if this is an alias of another definition */ virtual bool isAlias() const = 0; @@ -375,28 +369,9 @@ class Definition : public DefinitionIntf //----------------------------------------------------------------------------------- virtual void _setSymbolName(const QCString &name) = 0; virtual QCString _symbolName() const = 0; -}; - -/** A list of Definition objects. */ -class DefinitionList : public QList, public DefinitionIntf -{ - public: - ~DefinitionList() {} - DefType definitionType() const { return TypeSymbolList; } - int compareValues(const Definition *item1,const Definition *item2) const - { - return qstricmp(item1->name(),item2->name()); - } -}; - -/** An iterator for Definition objects in a DefinitionList. */ -class DefinitionListIterator : public QListIterator -{ - public: - DefinitionListIterator(const DefinitionList &l) : - QListIterator(l) {} - ~DefinitionListIterator() {} + // --------------------------------- + virtual ~Definition() = default; }; /** Reads a fragment from file \a fileName starting with line \a startLine diff --git a/src/doxygen.cpp b/src/doxygen.cpp index efef9c7..988b308 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1177,7 +1177,7 @@ static void resolveClassNestingRelations() cd->setOuterScope(d); // for inline namespace add an alias of the class to the outer scope - while (d->definitionType()==DefinitionIntf::TypeNamespace) + while (d->definitionType()==Definition::TypeNamespace) { NamespaceDef *nd = dynamic_cast(d); //printf("d->isInline()=%d\n",nd->isInline()); @@ -1565,7 +1565,7 @@ static void buildNamespaceList(const Entry *root) d->addInnerCompound(nd); nd->setOuterScope(d); // in case of d is an inline namespace, alias insert nd in the part scope of d. - while (d->definitionType()==DefinitionIntf::TypeNamespace) + while (d->definitionType()==Definition::TypeNamespace) { NamespaceDef *pnd = dynamic_cast(d); if (pnd->isInline()) diff --git a/src/doxygen.h b/src/doxygen.h index 663b5c6..b48a92c 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -55,7 +55,6 @@ class MemberNameLinkedMap; class FileNameLinkedMap; class NamespaceSDict; class NamespaceDef; -class DefinitionIntf; class DirSDict; class DirRelation; class IndexList; diff --git a/src/index.cpp b/src/index.cpp index c4fda05..e9619ad 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2762,7 +2762,7 @@ static void writeNamespaceLinkForMember(OutputList &ol,MemberDef *md,const char static void writeMemberList(OutputList &ol,bool useSections,int page, const LetterToIndexMap &memberLists, - DefinitionIntf::DefType type) + Definition::DefType type) { int index = (int)type; ASSERT(index<3); diff --git a/src/util.cpp b/src/util.cpp index b398bc2..f518491 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2771,7 +2771,6 @@ static QCString getCanonicalTypeForIdentifier( if (count>10) return word; // oops recursion QCString symName,result,templSpec,tmpName; - //DefinitionList *defList=0; if (tSpec && !tSpec->isEmpty()) templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,*tSpec)); -- cgit v0.12