summaryrefslogtreecommitdiffstats
path: root/src/classdef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/classdef.h')
-rw-r--r--src/classdef.h169
1 files changed, 82 insertions, 87 deletions
diff --git a/src/classdef.h b/src/classdef.h
index d413794..54664e5 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -19,6 +19,7 @@
#define CLASSDEF_H
#include <vector>
+#include <set>
#include <qlist.h>
#include <qdict.h>
@@ -30,6 +31,7 @@
struct Argument;
class MemberDef;
+class MemberDefMutable;
class MemberList;
class MemberDict;
class ClassList;
@@ -37,7 +39,6 @@ class ClassSDict;
class OutputList;
class FileDef;
class FileList;
-class BaseClassList;
class NamespaceDef;
class MemberDef;
class ExampleSDict;
@@ -52,13 +53,46 @@ class StringDict;
struct IncludeInfo;
class ClassDefImpl;
class FTextStream;
+class ClassDef;
+class ClassDefMutable;
+
+/** Class that contains information about an inheritance relation.
+ */
+struct BaseClassDef
+{
+ BaseClassDef(ClassDef *cd,const char *n,Protection p, Specifier v,const char *t) :
+ classDef(cd), usedName(n), prot(p), virt(v), templSpecifiers(t) {}
+
+ /** Class definition that this relation inherits from. */
+ ClassDef *classDef;
+
+ /** name used in the inheritance list
+ * (may be a typedef name instead of the class name)
+ */
+ QCString usedName;
+
+ /** Protection level of the inheritance relation:
+ * Public, Protected, or Private
+ */
+ Protection prot;
+
+ /** Virtualness of the inheritance relation:
+ * Normal, or Virtual
+ */
+ Specifier virt;
+
+ /** Template arguments used for the base class */
+ QCString templSpecifiers;
+};
+
+using BaseClassList = std::vector<BaseClassDef>;
/** A abstract class representing of a compound symbol.
*
* A compound can be a class, struct, union, interface, service, singleton,
* or exception.
*/
-class ClassDef : virtual public Definition
+class ClassDef : public Definition
{
public:
/** The various compound types */
@@ -75,7 +109,6 @@ class ClassDef : virtual public Definition
virtual ~ClassDef() {}
-
//-----------------------------------------------------------------------------------
// --- getters
//-----------------------------------------------------------------------------------
@@ -126,11 +159,17 @@ class ClassDef : virtual public Definition
/** Returns the list of base classes from which this class directly
* inherits.
*/
- virtual BaseClassList *baseClasses() const = 0;
+ virtual BaseClassList baseClasses() const = 0;
+
+ /** Update the list of base classes to the one passed */
+ virtual void updateBaseClasses(const BaseClassList &bcd) = 0;
/** Returns the list of sub classes that directly derive from this class
*/
- virtual BaseClassList *subClasses() const = 0;
+ virtual BaseClassList subClasses() const = 0;
+
+ /** Update the list of sub classes to the one passed */
+ virtual void updateSubClasses(const BaseClassList &bcd) = 0;
/** Returns a dictionary of all members. This includes any inherited
* members. Members are sorted alphabetically.
@@ -221,7 +260,7 @@ class ClassDef : virtual public Definition
* available, or 0 otherwise.
* @param name The name of the nested compound
*/
- virtual Definition *findInnerCompound(const char *name) const = 0;
+ virtual const Definition *findInnerCompound(const char *name) const = 0;
/** Returns the template parameter lists that form the template
* declaration of this class.
@@ -319,6 +358,30 @@ class ClassDef : virtual public Definition
virtual bool hasNonReferenceSuperClass() const = 0;
//-----------------------------------------------------------------------------------
+ // --- count members ----
+ //-----------------------------------------------------------------------------------
+
+ virtual int countMembersIncludingGrouped(MemberListType lt,
+ const ClassDef *inheritedFrom,bool additional) const = 0;
+ virtual int countInheritanceNodes() const = 0;
+ virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom,
+ int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const = 0;
+
+ //-----------------------------------------------------------------------------------
+ // --- helpers ----
+ //-----------------------------------------------------------------------------------
+
+ virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn,
+ const QCString &templSpec,bool &freshInstance) const = 0;
+ virtual void writeDeclarationLink(OutputList &ol,bool &found,
+ const char *header,bool localNames) const = 0;
+
+};
+
+class ClassDefMutable : public DefinitionMutable, public ClassDef
+{
+ public:
+ //-----------------------------------------------------------------------------------
// --- setters ----
//-----------------------------------------------------------------------------------
@@ -354,8 +417,6 @@ class ClassDef : virtual public Definition
virtual void addTaggedInnerClass(ClassDef *cd) = 0;
virtual void addInnerCompound(const Definition *d) = 0;
virtual bool addExample(const char *anchor,const char *name, const char *file) = 0;
- virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn,
- const QCString &templSpec,bool &freshInstance) const = 0;
virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot) = 0;
virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot) = 0;
virtual void makeTemplateArgument(bool b=TRUE) = 0;
@@ -368,7 +429,7 @@ class ClassDef : virtual public Definition
virtual void mergeMembers() = 0;
virtual void sortMemberLists() = 0;
virtual void distributeMemberGroupDocumentation() = 0;
- virtual void reclassifyMember(MemberDef *md,MemberType t) = 0;
+ virtual void reclassifyMember(MemberDefMutable *md,MemberType t) = 0;
virtual void removeMemberFromLists(MemberDef *md) = 0;
virtual void setAnonymousEnumType() = 0;
virtual void countMembers() = 0;
@@ -387,8 +448,6 @@ class ClassDef : virtual public Definition
virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const = 0;
virtual void writeSummaryLinks(OutputList &ol) const = 0;
virtual void writeInlineDocumentation(OutputList &ol) const = 0;
- virtual void writeDeclarationLink(OutputList &ol,bool &found,
- const char *header,bool localNames) const = 0;
virtual void writeTagFile(FTextStream &) = 0;
virtual void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title,
const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0,
@@ -397,27 +456,11 @@ class ClassDef : virtual public Definition
virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt,
const ClassDef *inheritedFrom,const QCString &inheritId) const = 0;
- //-----------------------------------------------------------------------------------
- // --- count members ----
- //-----------------------------------------------------------------------------------
-
- virtual int countMembersIncludingGrouped(MemberListType lt,
- const ClassDef *inheritedFrom,bool additional) const = 0;
- virtual int countInheritanceNodes() const = 0;
- virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom,
- int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const = 0;
-
- //-----------------------------------------------------------------------------------
- // --- visiting administration ----
- //-----------------------------------------------------------------------------------
-
- virtual void setVisited(bool visited) const = 0;
- virtual bool isVisited() const = 0;
};
/** Factory method to create a new ClassDef object */
-ClassDef *createClassDef(
+ClassDefMutable *createClassDef(
const char *fileName,int startLine,int startColumn,
const char *name,ClassDef::CompoundType ct,
const char *ref=0,const char *fName=0,
@@ -425,6 +468,17 @@ ClassDef *createClassDef(
ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd);
+// --- Set of classes
+
+using ClassDefSet = std::set<const ClassDef*>;
+
+// --- Cast functions
+
+ClassDef *toClassDef(Definition *d);
+ClassDef *toClassDef(DefinitionMutable *d);
+const ClassDef *toClassDef(const Definition *d);
+ClassDefMutable *toClassDefMutable(Definition *d);
+ClassDefMutable *toClassDefMutable(const Definition *d);
//------------------------------------------------------------------------
@@ -480,65 +534,6 @@ class UsesClassDictIterator : public QDictIterator<UsesClassDef>
//------------------------------------------------------------------------
-/** Class that contains information about an inheritance relation.
- */
-struct BaseClassDef
-{
- BaseClassDef(ClassDef *cd,const char *n,Protection p, Specifier v,const char *t) :
- classDef(cd), usedName(n), prot(p), virt(v), templSpecifiers(t) {}
-
- /** Class definition that this relation inherits from. */
- ClassDef *classDef;
-
- /** name used in the inheritance list
- * (may be a typedef name instead of the class name)
- */
- QCString usedName;
-
- /** Protection level of the inheritance relation:
- * Public, Protected, or Private
- */
- Protection prot;
-
- /** Virtualness of the inheritance relation:
- * Normal, or Virtual
- */
- Specifier virt;
-
- /** Template arguments used for the base class */
- QCString templSpecifiers;
-};
-
-/** List of base classes.
- *
- * The classes are alphabetically sorted on name if inSort() is used.
- */
-class BaseClassList : public QList<BaseClassDef>
-{
- public:
- ~BaseClassList() {}
- int compareValues(const BaseClassDef *item1,const BaseClassDef *item2) const
- {
- const ClassDef *c1=item1->classDef;
- const ClassDef *c2=item2->classDef;
- if (c1==0 || c2==0)
- return FALSE;
- else
- return qstricmp(c1->name(),c2->name());
- }
-};
-
-/** Iterator for a list of base classes.
- */
-class BaseClassListIterator : public QListIterator<BaseClassDef>
-{
- public:
- BaseClassListIterator(const BaseClassList &bcl) :
- QListIterator<BaseClassDef>(bcl) {}
-};
-
-//------------------------------------------------------------------------
-
/** Class that contains information about a type constraint relations.
*/