summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-01-07 20:20:57 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-01-22 20:45:19 (GMT)
commitcc0baded768470a2569e71a08aafce791db83205 (patch)
tree60ca28e13692d5acf58cc47a33c056be51a41221 /src
parent98ef388068684c3226f96c67776bc8d91b0a9dd1 (diff)
downloadDoxygen-cc0baded768470a2569e71a08aafce791db83205.zip
Doxygen-cc0baded768470a2569e71a08aafce791db83205.tar.gz
Doxygen-cc0baded768470a2569e71a08aafce791db83205.tar.bz2
Refactoring: modernize MemberList
Diffstat (limited to 'src')
-rw-r--r--src/classdef.cpp40
-rw-r--r--src/classdef.h5
-rw-r--r--src/code.l2
-rw-r--r--src/context.cpp105
-rw-r--r--src/context.h4
-rw-r--r--src/defgen.cpp64
-rw-r--r--src/docparser.cpp4
-rw-r--r--src/dotgroupcollaboration.cpp6
-rw-r--r--src/dotnode.cpp16
-rw-r--r--src/doxygen.cpp36
-rw-r--r--src/filedef.cpp14
-rw-r--r--src/groupdef.cpp30
-rw-r--r--src/groupdef.h2
-rw-r--r--src/index.cpp34
-rw-r--r--src/memberdef.cpp331
-rw-r--r--src/memberdef.h31
-rw-r--r--src/membergroup.cpp92
-rw-r--r--src/membergroup.h15
-rw-r--r--src/memberlist.cpp145
-rw-r--r--src/memberlist.h89
-rw-r--r--src/membername.h6
-rw-r--r--src/namespacedef.cpp8
-rw-r--r--src/perlmodgen.cpp27
-rw-r--r--src/pycode.l2
-rw-r--r--src/sqlite3gen.cpp15
-rw-r--r--src/util.cpp132
-rw-r--r--src/vhdlcode.l15
-rw-r--r--src/vhdldocgen.cpp88
-rw-r--r--src/vhdldocgen.h6
-rw-r--r--src/xmlgen.cpp91
30 files changed, 577 insertions, 878 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 52cac64..ec2642b 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -191,8 +191,8 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
virtual bool visibleInParentsDeclList() const;
virtual const ArgumentList &templateArguments() const;
virtual NamespaceDef *getNamespaceDef() const;
- virtual FileDef *getFileDef() const;
- virtual MemberDef *getMemberByName(const QCString &) const;
+ virtual FileDef *getFileDef() const;
+ virtual const MemberDef *getMemberByName(const QCString &) const;
virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const;
virtual bool isSubClass(ClassDef *bcd,int level=0) const;
virtual bool isAccessibleMember(const MemberDef *md) const;
@@ -229,7 +229,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
virtual bool isEmbeddedInOuterScope() const;
virtual bool isSimple() const;
virtual const ClassDef *tagLessReference() const;
- virtual MemberDef *isSmartPointer() const;
+ virtual const MemberDef *isSmartPointer() const;
virtual bool isJavaEnum() const;
virtual QCString title() const;
virtual QCString generatedFromFiles() const;
@@ -317,8 +317,8 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
void showUsedFiles(OutputList &ol) const;
void writeDocumentationContents(OutputList &ol,const QCString &pageTitle) const;
- void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList);
- void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief);
+ void internalInsertMember(const MemberDef *md,Protection prot,bool addToAllList);
+ void addMemberToList(MemberListType lt,const MemberDef *md,bool isBrief);
void writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses,
MemberListType lt,int lt2,const QCString &title,
const ClassDef *inheritedFrom,bool invert,
@@ -430,9 +430,9 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
{ return getCdAlias()->templateArguments(); }
virtual NamespaceDef *getNamespaceDef() const
{ return getCdAlias()->getNamespaceDef(); }
- virtual FileDef *getFileDef() const
+ virtual FileDef *getFileDef() const
{ return getCdAlias()->getFileDef(); }
- virtual MemberDef *getMemberByName(const QCString &s) const
+ virtual const MemberDef *getMemberByName(const QCString &s) const
{ return getCdAlias()->getMemberByName(s); }
virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const
{ return getCdAlias()->isBaseClass(bcd,followInstances,level); }
@@ -505,7 +505,7 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
{ return getCdAlias()->isSimple(); }
virtual const ClassDef *tagLessReference() const
{ return getCdAlias()->tagLessReference(); }
- virtual MemberDef *isSmartPointer() const
+ virtual const MemberDef *isSmartPointer() const
{ return getCdAlias()->isSmartPointer(); }
virtual bool isJavaEnum() const
{ return getCdAlias()->isJavaEnum(); }
@@ -696,7 +696,7 @@ class ClassDefImpl::IMPL
bool isSimple = false;
/** Does this class overloaded the -> operator? */
- MemberDef *arrowOperator = 0;
+ const MemberDef *arrowOperator = 0;
const ClassDef *tagLessRef = 0;
@@ -843,7 +843,7 @@ void ClassDefImpl::addMembersToMemberGroup()
}
// adds new member definition to the class
-void ClassDefImpl::internalInsertMember(MemberDef *md,
+void ClassDefImpl::internalInsertMember(const MemberDef *md,
Protection prot,
bool addToAllList
)
@@ -1074,7 +1074,7 @@ void ClassDefImpl::internalInsertMember(MemberDef *md,
case MemberType_Function:
if (md->isConstructor() || md->isDestructor())
{
- m_impl->memberLists.get(MemberListType_constructors)->append(md);
+ m_impl->memberLists.get(MemberListType_constructors)->push_back(md);
}
else
{
@@ -3352,7 +3352,7 @@ bool ClassDefImpl::isSubClass(ClassDef *cd,int level) const
//----------------------------------------------------------------------------
-static bool isStandardFunc(MemberDef *md)
+static bool isStandardFunc(const MemberDef *md)
{
return md->name()=="operator=" || // assignment operator
md->isConstructor() || // constructor
@@ -3401,14 +3401,14 @@ void ClassDefImpl::mergeMembers()
{
for (auto &srcMi : *srcMni)
{
- MemberDef *srcMd = srcMi->memberDef();
+ const MemberDef *srcMd = srcMi->memberDef();
bool found=FALSE;
bool ambiguous=FALSE;
bool hidden=FALSE;
const ClassDef *srcCd = srcMd->getClassDef();
for (auto &dstMi : *dstMni)
{
- MemberDef *dstMd = dstMi->memberDef();
+ const MemberDef *dstMd = dstMi->memberDef();
if (srcMd!=dstMd) // different members
{
const ClassDef *dstCd = dstMd->getClassDef();
@@ -3972,7 +3972,7 @@ void ClassDefImpl::addMembersToTemplateInstance(const ClassDef *cd,const Argumen
for (const auto &mi : *mni)
{
auto actualArguments_p = stringToArgumentList(getLanguage(),templSpec);
- MemberDef *md = mi->memberDef();
+ const MemberDef *md = mi->memberDef();
std::unique_ptr<MemberDefMutable> imd { md->createTemplateInstanceMember(
templateArguments,actualArguments_p) };
//printf("%s->setMemberClass(%p)\n",imd->name().data(),this);
@@ -4097,9 +4097,9 @@ void ClassDefImpl::addListReferences()
}
}
-MemberDef *ClassDefImpl::getMemberByName(const QCString &name) const
+const MemberDef *ClassDefImpl::getMemberByName(const QCString &name) const
{
- MemberDef *xmd = 0;
+ const MemberDef *xmd = 0;
MemberNameInfo *mni = m_impl->allMemberNameInfoLinkedMap.find(name);
if (mni)
{
@@ -4139,13 +4139,13 @@ MemberList *ClassDefImpl::getMemberList(MemberListType lt) const
return 0;
}
-void ClassDefImpl::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief)
+void ClassDefImpl::addMemberToList(MemberListType lt,const MemberDef *md,bool isBrief)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
const auto &ml = m_impl->memberLists.get(lt);
ml->setNeedsSorting((isBrief && sortBriefDocs) || (!isBrief && sortMemberDocs));
- ml->append(md);
+ ml->push_back(md);
// for members in the declaration lists we set the section, needed for member grouping
if ((ml->listType()&MemberListType_detailedLists)==0)
@@ -4725,7 +4725,7 @@ bool ClassDefImpl::isSimple() const
return m_impl->isSimple;
}
-MemberDef *ClassDefImpl::isSmartPointer() const
+const MemberDef *ClassDefImpl::isSmartPointer() const
{
return m_impl->arrowOperator;
}
diff --git a/src/classdef.h b/src/classdef.h
index 414b54f..d745b1d 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -49,6 +49,7 @@ class ClassDef;
class ClassDefMutable;
class UsesClassList;
class ConstraintClassList;
+class MemberGroupList;
/** Class that contains information about an inheritance relation.
*/
@@ -222,7 +223,7 @@ class ClassDef : public Definition
/** Returns the Java package this class is in or 0 if not applicable.
*/
- virtual MemberDef *getMemberByName(const QCString &) const = 0;
+ virtual const MemberDef *getMemberByName(const QCString &) const = 0;
/** Returns TRUE iff \a bcd is a direct or indirect base class of this
* class. This function will recursively traverse all branches of the
@@ -341,7 +342,7 @@ class ClassDef : public Definition
virtual const ClassDef *tagLessReference() const = 0;
- virtual MemberDef *isSmartPointer() const = 0;
+ virtual const MemberDef *isSmartPointer() const = 0;
virtual bool isJavaEnum() const = 0;
diff --git a/src/code.l b/src/code.l
index 956034f..233a4f0 100644
--- a/src/code.l
+++ b/src/code.l
@@ -2594,7 +2594,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &
const ClassDef *mcd = getClass(scope);
if (mcd && !locName.isEmpty())
{
- MemberDef *md=mcd->getMemberByName(locName);
+ const MemberDef *md=mcd->getMemberByName(locName);
if (md)
{
//printf("name=%s scope=%s\n",locName.data(),scope.data());
diff --git a/src/context.cpp b/src/context.cpp
index 87e574f..8378e33 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -2132,7 +2132,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
if (!list)
{
- MemberList *ml = m_classDef->getMemberList(type);
+ const MemberList *ml = m_classDef->getMemberList(type);
if (ml)
{
list.reset(MemberListInfoContext::alloc(m_classDef,relPathAsString(),ml,title,""));
@@ -2426,17 +2426,15 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
}
void addMembers(const ClassDef *cd,MemberListType lt) const
{
- MemberList *ml = cd->getMemberList(lt);
+ const MemberList *ml = cd->getMemberList(lt);
if (ml)
{
Cachable &cache = getCache();
- MemberListIterator li(*ml);
- const MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : *ml)
{
if (md->isBriefSectionVisible())
{
- cache.allMembers.append(md);
+ cache.allMembers.push_back(md);
}
}
}
@@ -2796,7 +2794,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri
{
if (!list)
{
- MemberList *ml = m_namespaceDef->getMemberList(type);
+ const MemberList *ml = m_namespaceDef->getMemberList(type);
if (ml)
{
list.reset(MemberListInfoContext::alloc(m_namespaceDef,relPathAsString(),ml,title,""));
@@ -3235,7 +3233,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
{
if (!list)
{
- MemberList *ml = m_fileDef->getMemberList(type);
+ const MemberList *ml = m_fileDef->getMemberList(type);
if (ml)
{
list.reset(MemberListInfoContext::alloc(m_fileDef,relPathAsString(),ml,title,""));
@@ -4470,15 +4468,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
Cachable &cache = getCache();
if (!cache.enumValues)
{
- const MemberList *ml = m_memberDef->enumFieldList();
- if (ml)
- {
- cache.enumValues.reset(MemberListContext::alloc(ml));
- }
- else
- {
- cache.enumValues.reset(MemberListContext::alloc());
- }
+ cache.enumValues.reset(MemberListContext::alloc(&m_memberDef->enumFieldList()));
}
return cache.enumValues.get();
}
@@ -4758,11 +4748,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
Cachable &cache = getCache();
if (!cache.implements)
{
- MemberDef *md = m_memberDef->reimplements();
+ const MemberDef *md = m_memberDef->reimplements();
cache.implements.reset(TemplateList::alloc());
if (md)
{
const ClassDef *cd = md->getClassDef();
+ // filter on pure virtual/interface methods
if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface))
{
MemberContext *mc = MemberContext::alloc(md);
@@ -4777,11 +4768,12 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
Cachable &cache = getCache();
if (!cache.reimplements)
{
- MemberDef *md = m_memberDef->reimplements();
+ const MemberDef *md = m_memberDef->reimplements();
cache.reimplements.reset(TemplateList::alloc());
if (md)
{
const ClassDef *cd = md->getClassDef();
+ // filter on non-pure virtual & non interface methods
if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface)
{
MemberContext *mc = MemberContext::alloc(md);
@@ -4796,20 +4788,15 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
Cachable &cache = getCache();
if (!cache.implementedBy)
{
- MemberList *ml = m_memberDef->reimplementedBy();
cache.implementedBy.reset(TemplateList::alloc());
- if (ml)
+ for (const auto &md : m_memberDef->reimplementedBy())
{
- MemberListIterator mli(*ml);
- MemberDef *md=0;
- for (mli.toFirst();(md=mli.current());++mli)
+ const ClassDef *cd = md->getClassDef();
+ // filter on pure virtual/interface methods
+ if (cd && md->virtualness()==Pure && cd->compoundType()==ClassDef::Interface)
{
- const ClassDef *cd = md->getClassDef();
- if (cd && (md->virtualness()==Pure || cd->compoundType()==ClassDef::Interface))
- {
- MemberContext *mc = new MemberContext(md);
- cache.implementedBy->append(mc);
- }
+ MemberContext *mc = new MemberContext(md);
+ cache.implementedBy->append(mc);
}
}
}
@@ -4821,19 +4808,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (!cache.reimplementedBy)
{
cache.reimplementedBy.reset(TemplateList::alloc());
- MemberList *ml = m_memberDef->reimplementedBy();
- if (ml)
+ for (const auto &md : m_memberDef->reimplementedBy())
{
- MemberListIterator mli(*ml);
- MemberDef *md=0;
- for (mli.toFirst();(md=mli.current());++mli)
+ const ClassDef *cd = md->getClassDef();
+ // filter on non-pure virtual & non interface methods
+ if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface)
{
- const ClassDef *cd = md->getClassDef();
- if (cd && md->virtualness()!=Pure && cd->compoundType()!=ClassDef::Interface)
- {
- MemberContext *mc = new MemberContext(md);
- cache.reimplementedBy->append(mc);
- }
+ MemberContext *mc = new MemberContext(md);
+ cache.reimplementedBy->append(mc);
}
}
}
@@ -8518,9 +8500,7 @@ MemberListContext::MemberListContext(const MemberList *list) : RefCountedContext
if (list)
{
bool details = list->listType()&MemberListType_detailedLists;
- MemberListIterator mli(*list);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *list)
{
if ((md->isBriefSectionVisible() && !details) ||
(md->isDetailedSectionLinkable() && details)
@@ -8746,7 +8726,7 @@ class MemberGroupInfoContext::Private
{
if (!m_cache.memberListContext)
{
- m_cache.memberListContext.reset(MemberListContext::alloc(m_memberGroup->members()));
+ m_cache.memberListContext.reset(MemberListContext::alloc(&m_memberGroup->members()));
}
return m_cache.memberListContext.get();
}
@@ -9005,7 +8985,7 @@ TemplateVariant MemberListInfoContext::get(const char *name) const
class InheritedMemberInfoContext::Private
{
public:
- Private(const ClassDef *cd,MemberList *ml,const QCString &title)
+ Private(const ClassDef *cd,const MemberList *ml,const QCString &title)
: m_class(cd), m_memberList(ml), m_title(title)
{
static bool init=FALSE;
@@ -9065,7 +9045,7 @@ class InheritedMemberInfoContext::Private
private:
const ClassDef * m_class;
- MemberList *m_memberList;
+ const MemberList *m_memberList;
QCString m_title;
mutable SharedPtr<ClassContext> m_classCtx;
mutable SharedPtr<MemberListContext> m_memberListCtx;
@@ -9076,7 +9056,7 @@ class InheritedMemberInfoContext::Private
PropertyMapper<InheritedMemberInfoContext::Private> InheritedMemberInfoContext::Private::s_inst;
-InheritedMemberInfoContext::InheritedMemberInfoContext(const ClassDef *cd,MemberList *ml,
+InheritedMemberInfoContext::InheritedMemberInfoContext(const ClassDef *cd,const MemberList *ml,
const QCString &title) : RefCountedContext("InheritedMemberInfoContext")
{
p = new Private(cd,ml,title);
@@ -9098,26 +9078,21 @@ TemplateVariant InheritedMemberInfoContext::get(const char *name) const
class InheritedMemberInfoListContext::Private : public GenericNodeListContext
{
public:
- void addMemberList(const ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList)
+ void addMemberList(const ClassDef *inheritedFrom,const MemberList &ml,MemberList *combinedList)
{
- if (ml)
+ for (const auto &md : ml)
{
- MemberListIterator li(*ml);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ if (md->isBriefSectionVisible() && !md->isReimplementedBy(inheritedFrom))
{
- if (md->isBriefSectionVisible() && !md->isReimplementedBy(inheritedFrom))
- {
- combinedList->append(md);
- }
+ combinedList->push_back(md);
}
}
}
- void addMemberListIncludingGrouped(const ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList)
+ void addMemberListIncludingGrouped(const ClassDef *inheritedFrom,const MemberList *ml,MemberList *combinedList)
{
if (ml)
{
- addMemberList(inheritedFrom,ml,combinedList);
+ addMemberList(inheritedFrom,*ml,combinedList);
for (const auto *mg : ml->getMemberGroupList())
{
addMemberList(inheritedFrom,mg->members(),combinedList);
@@ -9131,17 +9106,15 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext
// addMemberGroupsOfGroup?
for (const auto &mg: cd->getMemberGroups())
{
- if (mg->members() && (!mg->allMembersInSameSection() || !cd->subGrouping())) // group is in its own section
+ if (!mg->members().empty() && (!mg->allMembersInSameSection() || !cd->subGrouping())) // group is in its own section
{
- MemberListIterator li(*mg->members());
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : mg->members())
{
if (lt==md->getSectionList(mg->container())->listType() &&
!md->isReimplementedBy(inheritedFrom) &&
md->isBriefSectionVisible())
{
- combinedList->append(md);
+ combinedList->push_back(md);
}
}
}
@@ -9154,8 +9127,8 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext
if (lt2!=-1) count += cd->countMembersIncludingGrouped((MemberListType)lt2,inheritedFrom,additionalList);
if (count>0)
{
- MemberList *ml = cd->getMemberList(lt1);
- MemberList *ml2 = lt2!=-1 ? cd->getMemberList((MemberListType)lt2) : 0;
+ const MemberList *ml = cd->getMemberList(lt1);
+ const MemberList *ml2 = lt2!=-1 ? cd->getMemberList((MemberListType)lt2) : 0;
MemberList *combinedList = new MemberList(lt);
addMemberListIncludingGrouped(inheritedFrom,ml,combinedList);
addMemberListIncludingGrouped(inheritedFrom,ml2,combinedList);
diff --git a/src/context.h b/src/context.h
index a975d3d..1a3cfa3 100644
--- a/src/context.h
+++ b/src/context.h
@@ -1077,7 +1077,7 @@ class MemberInfoContext : public RefCountedContext, public TemplateStructIntf
class InheritedMemberInfoContext : public RefCountedContext, public TemplateStructIntf
{
public:
- static InheritedMemberInfoContext *alloc(const ClassDef *cd,MemberList *ml,const QCString &title)
+ static InheritedMemberInfoContext *alloc(const ClassDef *cd,const MemberList *ml,const QCString &title)
{ return new InheritedMemberInfoContext(cd,ml,title); }
// TemplateStructIntf methods
@@ -1086,7 +1086,7 @@ class InheritedMemberInfoContext : public RefCountedContext, public TemplateStru
virtual int release() { return RefCountedContext::release(); }
private:
- InheritedMemberInfoContext(const ClassDef *cd,MemberList *ml,const QCString &title);
+ InheritedMemberInfoContext(const ClassDef *cd,const MemberList *ml,const QCString &title);
~InheritedMemberInfoContext();
class Private;
Private *p;
diff --git a/src/defgen.cpp b/src/defgen.cpp
index 89f7568..514c077 100644
--- a/src/defgen.cpp
+++ b/src/defgen.cpp
@@ -40,7 +40,7 @@
#define DEF_DB(x)
-inline void writeDEFString(FTextStream &t,const char *s)
+static inline void writeDEFString(FTextStream &t,const char *s)
{
const char* p=s;
char c;
@@ -55,9 +55,9 @@ inline void writeDEFString(FTextStream &t,const char *s)
t << '\'';
}
-void generateDEFForMember(MemberDef *md,
+static void generateDEFForMember(const MemberDef *md,
FTextStream &t,
- Definition *def,
+ const Definition *def,
const char* Prefix)
{
QCString memPrefix;
@@ -215,22 +215,16 @@ void generateDEFForMember(MemberDef *md,
// TODO: exceptions, const volatile
if (md->memberType()==MemberType_Enumeration) // enum
{
- const MemberList *enumList = md->enumFieldList();
- if (enumList!=0)
+ for (const auto &emd : md->enumFieldList())
{
- MemberListIterator emli(*enumList);
- MemberDef *emd;
- for (emli.toFirst();(emd=emli.current());++emli)
+ t << memPrefix << "enum = { enum-name = " << emd->name() << ';';
+ if (!emd->initializer().isEmpty())
{
- t << memPrefix << "enum = { enum-name = " << emd->name() << ';';
- if (!emd->initializer().isEmpty())
- {
- t << " enum-value = ";
- writeDEFString(t,emd->initializer());
- t << ';';
- }
- t << " };" << endl;
+ t << " enum-value = ";
+ writeDEFString(t,emd->initializer());
+ t << ';';
}
+ t << " };" << endl;
}
}
@@ -301,19 +295,17 @@ void generateDEFForMember(MemberDef *md,
}
-void generateDEFClassSection(ClassDef *cd,
+static void generateDEFClassSection(const ClassDef *cd,
FTextStream &t,
- MemberList *ml,
+ const MemberList *ml,
const char *kind)
{
- if (cd && ml && ml->count()>0)
+ if (cd && ml && !ml->empty())
{
t << " cp-section = {" << endl;
t << " sec-kind = '" << kind << "';" << endl;
- MemberListIterator mli(*ml);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
generateDEFForMember(md,t,cd,"sec");
}
@@ -321,7 +313,7 @@ void generateDEFClassSection(ClassDef *cd,
}
}
-void generateDEFForClass(ClassDef *cd,FTextStream &t)
+static void generateDEFForClass(const ClassDef *cd,FTextStream &t)
{
// + brief description
// + detailed description
@@ -391,12 +383,12 @@ void generateDEFForClass(ClassDef *cd,FTextStream &t)
t << endl << " };" << endl;
}
- int numMembers = 0;
+ size_t numMembers = 0;
for (const auto &ml : cd->getMemberLists())
{
if ((ml->listType()&MemberListType_detailedLists)==0)
{
- numMembers+=ml->count();
+ numMembers+=ml->size();
}
}
if (numMembers>0)
@@ -453,17 +445,15 @@ void generateDEFForClass(ClassDef *cd,FTextStream &t)
t << "}; /* " << cd->compoundTypeString() << " */" << endl;
}
-void generateDEFSection(Definition *d,
+static void generateDEFSection(const Definition *d,
FTextStream &t,
- MemberList *ml,
+ const MemberList *ml,
const char *kind)
{
- if (ml && ml->count()>0)
+ if (ml && !ml->empty())
{
t << " " << kind << " = {" << endl;
- MemberListIterator mli(*ml);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
generateDEFForMember(md,t,d,kind);
}
@@ -471,7 +461,7 @@ void generateDEFSection(Definition *d,
}
}
-void generateDEFForNamespace(NamespaceDef *nd,FTextStream &t)
+static void generateDEFForNamespace(const NamespaceDef *nd,FTextStream &t)
{
if (nd->isReference()) return; // skip external references
t << " namespace = {" << endl;
@@ -499,7 +489,7 @@ void generateDEFForNamespace(NamespaceDef *nd,FTextStream &t)
t << " };" << endl;
}
-void generateDEFForFile(FileDef *fd,FTextStream &t)
+static void generateDEFForFile(const FileDef *fd,FTextStream &t)
{
if (fd->isReference()) return; // skip external references
@@ -586,7 +576,9 @@ void generateDEF()
FTextStream t(&f);
t << "AutoGen Definitions dummy;" << endl;
- if (Doxygen::classLinkedMap->size()+Doxygen::inputNameLinkedMap->size()>0)
+ if (Doxygen::classLinkedMap->size()+
+ Doxygen::inputNameLinkedMap->size()+
+ Doxygen::namespaceLinkedMap->size()>0)
{
for (const auto &cd : *Doxygen::classLinkedMap)
{
@@ -599,6 +591,10 @@ void generateDEF()
generateDEFForFile(fd.get(),t);
}
}
+ for (const auto &nd : *Doxygen::namespaceLinkedMap)
+ {
+ generateDEFForNamespace(nd.get(),t);
+ }
}
else
{
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 33faf54..30b66db 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -445,7 +445,7 @@ static void checkArgumentName(const QCString &name)
QCString inheritedFrom = "";
QCString docFile = g_memberDef->docFile();
int docLine = g_memberDef->docLine();
- MemberDef *inheritedMd = g_memberDef->inheritsDocsFrom();
+ const MemberDef *inheritedMd = g_memberDef->inheritsDocsFrom();
if (inheritedMd) // documentation was inherited
{
inheritedFrom.sprintf(" inherited from member %s at line "
@@ -5350,7 +5350,7 @@ void DocPara::handleInheritDoc()
{
if (g_memberDef) // inheriting docs from a member
{
- MemberDef *reMd = g_memberDef->reimplements();
+ const MemberDef *reMd = g_memberDef->reimplements();
if (reMd) // member from which was inherited.
{
const MemberDef *thisMd = g_memberDef;
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp
index 1b632ce..ff81ecc 100644
--- a/src/dotgroupcollaboration.cpp
+++ b/src/dotgroupcollaboration.cpp
@@ -147,10 +147,8 @@ void DotGroupCollaboration::buildGraph(const GroupDef* gd)
void DotGroupCollaboration::addMemberList( MemberList* ml )
{
- if ( !( ml && ml->count()) ) return;
- MemberListIterator defli(*ml);
- MemberDef *def;
- for (;(def=defli.current());++defli)
+ if ( ml==0 || ml->empty() ) return;
+ for (const auto &def : *ml)
{
QCString tmp_url = def->getReference()+"$"+def->getOutputFileBase()+Doxygen::htmlFileExtension
+"#"+def->anchor();
diff --git a/src/dotnode.cpp b/src/dotnode.cpp
index a6703b3..318878d 100644
--- a/src/dotnode.cpp
+++ b/src/dotnode.cpp
@@ -140,15 +140,13 @@ static QCString escapeTooltip(const QCString &tooltip)
}
static void writeBoxMemberList(FTextStream &t,
- char prot,MemberList *ml,const ClassDef *scope,
+ char prot,const MemberList *ml,const ClassDef *scope,
bool isStatic=FALSE,const StringUnorderedSet *skipNames=nullptr)
{
if (ml)
{
- MemberListIterator mlia(*ml);
- MemberDef *mma;
int totalCount=0;
- for (mlia.toFirst();(mma = mlia.current());++mlia)
+ for (const auto &mma : *ml)
{
if (mma->getClassDef()==scope &&
(skipNames==nullptr || skipNames->find(mma->name().str())==std::end(*skipNames)))
@@ -158,7 +156,7 @@ static void writeBoxMemberList(FTextStream &t,
}
int count=0;
- for (mlia.toFirst();(mma = mlia.current());++mlia)
+ for (const auto &mma : *ml)
{
if (mma->getClassDef() == scope &&
(skipNames==nullptr || skipNames->find(mma->name().str())==std::end(*skipNames)))
@@ -199,9 +197,9 @@ static void writeBoxMemberList(FTextStream &t,
// write member groups within the memberlist
for (const auto &mg : ml->getMemberGroupList())
{
- if (mg->members())
+ if (!mg->members().empty())
{
- writeBoxMemberList(t,prot,mg->members(),scope,isStatic,skipNames);
+ writeBoxMemberList(t,prot,&mg->members(),scope,isStatic,skipNames);
}
}
}
@@ -450,9 +448,9 @@ void DotNode::writeBox(FTextStream &t,
{
for (const auto &mg : m_classDef->getMemberGroups())
{
- if (mg->members())
+ if (!mg->members().empty())
{
- writeBoxMemberList(t,'*',mg->members(),m_classDef,FALSE,&arrowNames);
+ writeBoxMemberList(t,'*',&mg->members(),m_classDef,FALSE,&arrowNames);
}
}
}
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 9960224..74887ec 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -1381,9 +1381,7 @@ static ClassDefMutable *createTagLessInstance(const ClassDef *rootCd,const Class
MemberList *ml = templ->getMemberList(MemberListType_pubAttribs);
if (ml)
{
- MemberListIterator li(*ml);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : *ml)
{
//printf(" Member %s type=%s\n",md->name().data(),md->typeString());
MemberDefMutable *imd = createMemberDef(md->getDefFileName(),md->getDefLine(),md->getDefColumn(),
@@ -1429,9 +1427,7 @@ static void processTagLessClasses(const ClassDef *rootCd,
MemberList *ml = cd->getMemberList(MemberListType_pubAttribs);
if (ml)
{
- MemberListIterator li(*ml);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : *ml)
{
QCString type = md->typeString();
if (type.find("::@")!=-1) // member of tag less struct/union
@@ -1463,9 +1459,7 @@ static void processTagLessClasses(const ClassDef *rootCd,
MemberList *pml = tagParentCd->getMemberList(MemberListType_pubAttribs);
if (pml)
{
- MemberListIterator pli(*pml);
- MemberDef *pmd;
- for (pli.toFirst();(pmd=pli.current());++pli)
+ for (const auto &pmd : *pml)
{
MemberDefMutable *pmdm = toMemberDefMutable(pmd);
if (pmdm && pmd->name()==md->name())
@@ -1988,7 +1982,7 @@ static void findUsingDeclImports(const Entry *root)
{
for (auto &mi : *mni)
{
- MemberDef *md = mi->memberDef();
+ const MemberDef *md = mi->memberDef();
if (md && md->protection()!=Private)
{
//printf("found member %s\n",mni->memberName());
@@ -3948,7 +3942,7 @@ static void findUsedClassesForClass(const Entry *root,
{
for (auto &mi : *mni)
{
- MemberDef *md=mi->memberDef();
+ const MemberDef *md=mi->memberDef();
if (md->isVariable() || md->isObjCProperty()) // for each member variable in this class
{
//printf(" Found variable %s in class %s\n",md->name().data(),masterCd->name().data());
@@ -7425,17 +7419,11 @@ static void findDEV(const MemberNameLinkedMap &mnsd)
MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->isEnumerate()) // member is an enum
{
- const MemberList *fmdl = md->enumFieldList();
int documentedEnumValues=0;
- if (fmdl) // enum has values
+ // for each enum value
+ for (const auto &fmd : md->enumFieldList())
{
- MemberListIterator fmni(*fmdl);
- MemberDef *fmd;
- // for each enum value
- for (fmni.toFirst();(fmd=fmni.current());++fmni)
- {
- if (fmd->isLinkableInProject()) documentedEnumValues++;
- }
+ if (fmd->isLinkableInProject()) documentedEnumValues++;
}
// at least one enum value is documented
if (documentedEnumValues>0) md->setDocumentedEnumValues(TRUE);
@@ -7571,10 +7559,8 @@ static void computeMemberRelations()
)
{
//printf("match!\n");
- MemberDef *rmd;
- if ((rmd=md->reimplements())==0 ||
- minClassDistance(mcd,bmcd)<minClassDistance(mcd,rmd->getClassDef())
- )
+ const MemberDef *rmd = md->reimplements();
+ if (rmd==0 || minClassDistance(mcd,bmcd)<minClassDistance(mcd,rmd->getClassDef()))
{
//printf("setting (new) reimplements member\n");
md->setReimplements(bmd);
@@ -8156,7 +8142,7 @@ static void inheritDocumentation()
//printf("%04d Member '%s'\n",count++,md->qualifiedName().data());
if (md && md->documentation().isEmpty() && md->briefDescription().isEmpty())
{ // no documentation yet
- MemberDef *bmd = md->reimplements();
+ const MemberDef *bmd = md->reimplements();
while (bmd && bmd->documentation().isEmpty() &&
bmd->briefDescription().isEmpty()
)
diff --git a/src/filedef.cpp b/src/filedef.cpp
index aa091fa..0e5ab3f 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -1053,9 +1053,7 @@ void FileDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *currentM
MemberList *allMemberList = getMemberList(MemberListType_allMembersList);
if (allMemberList)
{
- MemberListIterator mli(*allMemberList);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *allMemberList)
{
if (md->getFileDef()==this && md->getNamespaceDef()==0 && md->isLinkable() && !md->isEnumValue())
{
@@ -1255,7 +1253,7 @@ void FileDefImpl::insertMember(MemberDef *md)
//printf("%s:FileDefImpl::insertMember(%s (=%p) list has %d elements)\n",
// name().data(),md->name().data(),md,allMemberList.count());
MemberList *allMemberList = getMemberList(MemberListType_allMembersList);
- if (allMemberList && allMemberList->findRef(md)!=-1) // TODO optimize the findRef!
+ if (allMemberList && allMemberList->contains(md))
{
return;
}
@@ -1265,7 +1263,7 @@ void FileDefImpl::insertMember(MemberDef *md)
m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType_allMembersList));
allMemberList = m_memberLists.back().get();
}
- allMemberList->append(md);
+ allMemberList->push_back(md);
//::addFileMemberNameToIndex(md);
switch (md->memberType())
{
@@ -1876,7 +1874,7 @@ void FileDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
ml->setNeedsSorting(
((ml->listType()&MemberListType_declarationLists) && sortBriefDocs) ||
((ml->listType()&MemberListType_documentationLists) && sortMemberDocs));
- ml->append(md);
+ ml->push_back(md);
if (lt&MemberListType_documentationLists)
{
ml->setInFile(TRUE);
@@ -1900,8 +1898,8 @@ void FileDefImpl::sortMemberLists()
for (const auto &mg : m_memberGroups)
{
- MemberList *mlg = mg->members();
- if (mlg->needsSorting()) { mlg->sort(); mlg->setNeedsSorting(FALSE); }
+ MemberList &mlg = const_cast<MemberList&>(mg->members());
+ if (mlg.needsSorting()) { mlg.sort(); mlg.setNeedsSorting(FALSE); }
}
if (Config_getBool(SORT_BRIEF_DOCS))
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index c7c1202..6e5a074 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -69,7 +69,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
virtual void addPage(const PageDef *def);
virtual void addExample(const PageDef *def);
virtual void addDir(DirDef *dd);
- virtual bool insertMember(MemberDef *def,bool docOnly=FALSE);
+ virtual bool insertMember(const MemberDef *def,bool docOnly=FALSE);
virtual void removeMember(MemberDef *md);
virtual bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group
virtual void writeDocumentation(OutputList &ol);
@@ -112,7 +112,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
private:
void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
- void addMemberToList(MemberListType lt,MemberDef *md);
+ void addMemberToList(MemberListType lt,const MemberDef *md);
void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
void removeMemberFromList(MemberListType lt,MemberDef *md);
@@ -145,7 +145,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
PageLinkedRefMap m_pages; // list of pages in the group
PageLinkedRefMap m_examples; // list of examples in the group
DirList m_dirList; // list of directories in the group
- MemberList * m_allMemberList;
+ MemberList m_allMemberList;
MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap;
Definition * m_groupScope;
MemberLists m_memberLists;
@@ -164,7 +164,8 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name,
//---------------------------------------------------------------------------
GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
- const char *refFileName) : DefinitionMixin(df,dl,1,na)
+ const char *refFileName) : DefinitionMixin(df,dl,1,na),
+ m_allMemberList(MemberListType_allMembersList)
{
m_fileList = new FileList;
if (refFileName)
@@ -177,8 +178,6 @@ GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
}
setGroupTitle( t );
- m_allMemberList = new MemberList(MemberListType_allMembersList);
-
//visited = 0;
m_groupScope = 0;
m_subGrouping=Config_getBool(SUBGROUPING);
@@ -187,7 +186,6 @@ GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
GroupDefImpl::~GroupDefImpl()
{
delete m_fileList;
- delete m_allMemberList;
}
void GroupDefImpl::setGroupTitle( const char *t )
@@ -308,7 +306,7 @@ void GroupDefImpl::addMembersToMemberGroup()
}
-bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly)
+bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly)
{
if (md->isHidden()) return FALSE;
updateLanguage(md);
@@ -352,7 +350,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly)
}
mni->push_back(std::make_unique<MemberInfo>(md,md->protection(),md->virtualness(),FALSE));
//printf("Added member!\n");
- m_allMemberList->append(md);
+ m_allMemberList.push_back(md);
switch(md->memberType())
{
case MemberType_Variable:
@@ -585,7 +583,7 @@ size_t GroupDefImpl::numDocMembers() const
m_classes.size()+
m_namespaces.size()+
m_groups.size()+
- m_allMemberList->count()+
+ m_allMemberList.size()+
m_pages.size()+
m_examples.size();
}
@@ -594,7 +592,7 @@ size_t GroupDefImpl::numDocMembers() const
void GroupDefImpl::computeAnchors()
{
//printf("GroupDefImpl::computeAnchors()\n");
- m_allMemberList->setAnchors();
+ m_allMemberList.setAnchors();
}
void GroupDefImpl::writeTagFile(FTextStream &tagFile)
@@ -1237,7 +1235,7 @@ void GroupDefImpl::writeDocumentation(OutputList &ol)
if (Config_getBool(SEPARATE_MEMBER_PAGES))
{
- m_allMemberList->sort();
+ m_allMemberList.sort();
writeMemberPages(ol);
}
@@ -1266,9 +1264,7 @@ void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *current
ol.writeString(" <div class=\"navtab\">\n");
ol.writeString(" <table>\n");
- MemberListIterator mli(*m_allMemberList);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto *md : m_allMemberList)
{
if (md->getGroupDef()==this && md->isLinkable() && !md->isEnumValue())
{
@@ -1532,7 +1528,7 @@ void GroupDefImpl::addListReferences()
}
}
-void GroupDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
+void GroupDefImpl::addMemberToList(MemberListType lt,const MemberDef *md)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
@@ -1541,7 +1537,7 @@ void GroupDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
ml->setNeedsSorting(
((ml->listType()&MemberListType_declarationLists) && sortBriefDocs) ||
((ml->listType()&MemberListType_documentationLists) && sortMemberDocs));
- ml->append(md);
+ ml->push_back(md);
}
// performs a partial reordering to group elements together with the same scope
diff --git a/src/groupdef.h b/src/groupdef.h
index 655ed74..c05d524 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -64,7 +64,7 @@ class GroupDef : public DefinitionMutable, public Definition
virtual void addPage(const PageDef *def) = 0;
virtual void addExample(const PageDef *def) = 0;
virtual void addDir(DirDef *dd) = 0;
- virtual bool insertMember(MemberDef *def,bool docOnly=FALSE) = 0;
+ virtual bool insertMember(const MemberDef *def,bool docOnly=FALSE) = 0;
virtual void removeMember(MemberDef *md) = 0;
virtual bool findGroup(const GroupDef *def) const = 0;
virtual void writeDocumentation(OutputList &ol) = 0;
diff --git a/src/index.cpp b/src/index.cpp
index 14ad720..bf6ca03 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -307,8 +307,8 @@ static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool ad
{
bool isAnonymous = md->isAnonymous();
bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS);
- const MemberList *enumList = md->enumFieldList();
- bool isDir = enumList!=0 && md->isEnumerate();
+ const MemberList &enumList = md->enumFieldList();
+ bool isDir = !enumList.empty() && md->isEnumerate();
if (md->getOuterScope()==def || md->getOuterScope()==Doxygen::globalScope)
{
Doxygen::indexList->addContentsItem(isDir,
@@ -325,9 +325,7 @@ static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool ad
{
Doxygen::indexList->incContentsDepth();
}
- MemberListIterator emli(*enumList);
- MemberDef *emd;
- for (emli.toFirst();(emd=emli.current());++emli)
+ for (const auto &emd : enumList)
{
if (!hideUndocMembers || emd->hasDocumentation())
{
@@ -379,9 +377,7 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part,
MemberList *ml = def->getMemberList(lmd->type);
if (ml)
{
- MemberListIterator mi(*ml);
- MemberDef *md;
- for (mi.toFirst();(md=mi.current());++mi)
+ for (const auto &md : *ml)
{
if (memberVisibleInIndex(md))
{
@@ -1590,9 +1586,7 @@ static int countVisibleMembers(const NamespaceDef *nd)
MemberList *ml = nd->getMemberList(lmd->type);
if (ml)
{
- MemberListIterator mi(*ml);
- MemberDef *md;
- for (mi.toFirst();(md=mi.current());++mi)
+ for (const auto &md : *ml)
{
if (memberVisibleInIndex(md))
{
@@ -1615,9 +1609,7 @@ static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex)
MemberList *ml = nd->getMemberList(lmd->type);
if (ml)
{
- MemberListIterator mi(*ml);
- MemberDef *md;
- for (mi.toFirst();(md=mi.current());++mi)
+ for (const auto &md : *ml)
{
//printf(" member %s visible=%d\n",md->name().data(),memberVisibleInIndex(md));
if (memberVisibleInIndex(md))
@@ -3758,7 +3750,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT
{
if (ml->listType()&MemberListType_documentationLists)
{
- numSubItems += ml->count();
+ numSubItems += ml->size();
}
}
numSubItems += gd->getNamespaces().size();
@@ -3807,12 +3799,10 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT
MemberList *ml = gd->getMemberList(lmd->type);
if (ml)
{
- MemberListIterator mi(*ml);
- MemberDef *md;
- for (mi.toFirst();(md=mi.current());++mi)
+ for (const auto &md : *ml)
{
- const MemberList *enumList = md->enumFieldList();
- isDir = enumList!=0 && md->isEnumerate();
+ const MemberList &enumList = md->enumFieldList();
+ isDir = !enumList.empty() && md->isEnumerate();
if (md->isVisible() && !md->isAnonymous())
{
Doxygen::indexList->addContentsItem(isDir,
@@ -3822,9 +3812,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT
if (isDir)
{
Doxygen::indexList->incContentsDepth();
- MemberListIterator emli(*enumList);
- MemberDef *emd;
- for (emli.toFirst();(emd=emli.current());++emli)
+ for (const auto &emd : enumList)
{
if (emd->isVisible())
{
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 8f09347..7e58331 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -183,15 +183,15 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual bool isDetailedSectionLinkable() const;
virtual bool isFriendClass() const;
virtual bool isDocumentedFriendClass() const;
- virtual MemberDef *reimplements() const;
- virtual MemberList *reimplementedBy() const;
+ virtual const MemberDef *reimplements() const;
+ virtual const MemberList &reimplementedBy() const;
virtual bool isReimplementedBy(const ClassDef *cd) const;
virtual ClassDef *relatedAlso() const;
virtual bool hasDocumentedEnumValues() const;
virtual const MemberDef *getAnonymousEnumType() const;
virtual bool isDocsForDefinition() const;
virtual const MemberDef *getEnumScope() const;
- virtual const MemberList *enumFieldList() const;
+ virtual const MemberList &enumFieldList() const;
virtual void setEnumBaseType(const QCString &type);
virtual QCString enumBaseType() const;
virtual bool hasExamples() const;
@@ -212,7 +212,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual bool visibleMemberGroup(bool hideNoHeader) const;
virtual bool hasReferencesRelation() const;
virtual bool hasReferencedByRelation() const;
- virtual MemberDef *templateMaster() const;
+ virtual const MemberDef *templateMaster() const;
virtual QCString getScopeString() const;
virtual ClassDef *getClassDefOfAnonymousType() const;
virtual bool isTypedefValCached() const;
@@ -221,10 +221,10 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual QCString getCachedResolvedTypedef() const;
virtual MemberDef *memberDefinition() const;
virtual MemberDef *memberDeclaration() const;
- virtual MemberDef *inheritsDocsFrom() const;
+ virtual const MemberDef *inheritsDocsFrom() const;
virtual const MemberDef *getGroupAlias() const;
virtual ClassDef *category() const;
- virtual MemberDef *categoryRelation() const;
+ virtual const MemberDef *categoryRelation() const;
virtual QCString displayName(bool=TRUE) const;
virtual QCString getDeclType() const;
virtual void getLabels(QStrList &sl,const Definition *container) const;
@@ -256,15 +256,15 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual void setTemplateSpecialization(bool b);
virtual void makeRelated();
virtual void makeForeign();
- virtual void setInheritsDocsFrom(MemberDef *md);
+ virtual void setInheritsDocsFrom(const MemberDef *md);
virtual void setTagInfo(const TagInfo *i);
virtual void setArgsString(const char *as);
- virtual void setReimplements(MemberDef *md);
- virtual void insertReimplementedBy(MemberDef *md);
+ virtual void setReimplements(const MemberDef *md);
+ virtual void insertReimplementedBy(const MemberDef *md);
virtual void setRelatedAlso(ClassDef *cd);
- virtual void insertEnumField(MemberDef *md);
- virtual void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE);
- virtual void setEnumClassScope(ClassDef *cd);
+ virtual void insertEnumField(const MemberDef *md);
+ virtual void setEnumScope(const MemberDef *md,bool livesInsideEnum=FALSE);
+ virtual void setEnumClassScope(const ClassDef *cd);
virtual void setDocumentedEnumValues(bool value);
virtual void setAnonymousEnumType(const MemberDef *md);
virtual bool addExample(const char *anchor,const char *name,const char *file);
@@ -287,7 +287,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual void enableCallerGraph(bool e);
virtual void enableReferencedByRelation(bool e);
virtual void enableReferencesRelation(bool e);
- virtual void setTemplateMaster(MemberDef *mt);
+ virtual void setTemplateMaster(const MemberDef *mt);
virtual void addListReference(Definition *d);
virtual void setDocsForDefinition(bool b);
virtual void setGroupAlias(const MemberDef *md);
@@ -297,9 +297,9 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual void setMemberDefinition(MemberDef *md);
virtual void setMemberDeclaration(MemberDef *md);
virtual void setAnonymousUsed() const;
- virtual void copyArgumentNames(MemberDef *bmd);
+ virtual void copyArgumentNames(const MemberDef *bmd);
virtual void setCategory(ClassDef *);
- virtual void setCategoryRelation(MemberDef *);
+ virtual void setCategoryRelation(const MemberDef *);
virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE);
virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine);
virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine);
@@ -633,9 +633,9 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{ return getMdAlias()->isFriendClass(); }
virtual bool isDocumentedFriendClass() const
{ return getMdAlias()->isDocumentedFriendClass(); }
- virtual MemberDef *reimplements() const
+ virtual const MemberDef *reimplements() const
{ return getMdAlias()->reimplements(); }
- virtual MemberList *reimplementedBy() const
+ virtual const MemberList &reimplementedBy() const
{ return getMdAlias()->reimplementedBy(); }
virtual bool isReimplementedBy(const ClassDef *cd) const
{ return getMdAlias()->isReimplementedBy(cd); }
@@ -649,7 +649,7 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{ return getMdAlias()->isDocsForDefinition(); }
virtual const MemberDef *getEnumScope() const
{ return getMdAlias()->getEnumScope(); }
- virtual const MemberList *enumFieldList() const
+ virtual const MemberList &enumFieldList() const
{ return getMdAlias()->enumFieldList(); }
virtual QCString enumBaseType() const
{ return getMdAlias()->enumBaseType(); }
@@ -687,7 +687,7 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{ return getMdAlias()->hasReferencesRelation(); }
virtual bool hasReferencedByRelation() const
{ return getMdAlias()->hasReferencedByRelation(); }
- virtual MemberDef *templateMaster() const
+ virtual const MemberDef *templateMaster() const
{ return getMdAlias()->templateMaster(); }
virtual QCString getScopeString() const
{ return getMdAlias()->getScopeString(); }
@@ -705,13 +705,13 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{ return getMdAlias()->memberDefinition(); }
virtual MemberDef *memberDeclaration() const
{ return getMdAlias()->memberDeclaration(); }
- virtual MemberDef *inheritsDocsFrom() const
+ virtual const MemberDef *inheritsDocsFrom() const
{ return getMdAlias()->inheritsDocsFrom(); }
virtual const MemberDef *getGroupAlias() const
{ return getMdAlias()->getGroupAlias(); }
virtual ClassDef *category() const
{ return getMdAlias()->category(); }
- virtual MemberDef *categoryRelation() const
+ virtual const MemberDef *categoryRelation() const
{ return getMdAlias()->categoryRelation(); }
virtual QCString displayName(bool b=TRUE) const
{ return getMdAlias()->displayName(b); }
@@ -1186,13 +1186,13 @@ class MemberDefImpl::IMPL
const FileDef *fileDef = 0; // member of file definition
const NamespaceDef *nspace = 0; // the namespace this member is in.
- MemberDef *enumScope = 0; // the enclosing scope, if this is an enum field
+ const MemberDef *enumScope = 0; // the enclosing scope, if this is an enum field
bool livesInsideEnum = false;
const MemberDef *annEnumType = 0; // the anonymous enum that is the type of this member
- MemberList *enumFields = 0; // enumeration fields
+ MemberList enumFields; // enumeration fields
- MemberDef *redefines = 0; // the members that this member redefines
- MemberList *redefinedBy = 0; // the list of members that redefine this one
+ const MemberDef *redefines = 0; // the members that this member redefines
+ MemberList redefinedBy; // the list of members that redefine this one
MemberDef *memDef = 0; // member definition for this declaration
MemberDef *memDec = 0; // member declaration for this definition
@@ -1230,7 +1230,7 @@ class MemberDefImpl::IMPL
ArgumentList tArgList; // template argument list of function template
ArgumentList typeConstraints; // type constraints for template parameters
- MemberDef *templateMaster;
+ const MemberDef *templateMaster;
ArgumentLists defTmpArgLists; // lists of template argument lists
// (for template functions in nested template classes)
@@ -1262,7 +1262,7 @@ class MemberDefImpl::IMPL
//QCString inbodyDocs;
// documentation inheritance
- MemberDef *docProvider = 0;
+ const MemberDef *docProvider = 0;
// to store the output file base from tag files
QCString explicitOutputFileBase;
@@ -1292,28 +1292,19 @@ class MemberDefImpl::IMPL
// definition.
// FALSE => block is put before declaration.
ClassDef *category = 0;
- MemberDef *categoryRelation = 0;
+ const MemberDef *categoryRelation = 0;
QCString declFileName;
- int declLine = 0;
- int declColumn = 0;
+ int declLine = -1;
+ int declColumn = -1;
int numberOfFlowKW = 0;
};
-MemberDefImpl::IMPL::IMPL() :
- enumFields(0),
- redefinedBy(0),
- category(0),
- categoryRelation(0),
- declLine(-1),
- declColumn(-1),
- numberOfFlowKW(0)
+MemberDefImpl::IMPL::IMPL() : enumFields(MemberListType_enumFields)
{
}
MemberDefImpl::IMPL::~IMPL()
{
- delete redefinedBy;
- delete enumFields;
}
void MemberDefImpl::IMPL::init(Definition *d,
@@ -1327,14 +1318,12 @@ void MemberDefImpl::IMPL::init(Definition *d,
fileDef=0;
redefines=0;
relatedAlso=0;
- redefinedBy=0;
accessorClass=0;
nspace=0;
memDef=0;
memDec=0;
group=0;
grpId=-1;
- enumFields=0;
enumScope=0;
livesInsideEnum=FALSE;
hasCallGraph = FALSE;
@@ -1454,28 +1443,6 @@ MemberDef *MemberDefImpl::deepCopy() const
MemberDefImpl *result = new MemberDefImpl(*this);
// first copy everything by reference
*result->m_impl = *m_impl;
- // clear pointers owned by object
- result->m_impl->redefinedBy= 0;
- result->m_impl->enumFields=0;
- // replace pointers owned by the object by deep copies
- if (m_impl->redefinedBy)
- {
- MemberListIterator mli(*m_impl->redefinedBy);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
- {
- result->insertReimplementedBy(md);
- }
- }
- if (m_impl->enumFields)
- {
- MemberListIterator mli(*m_impl->enumFields);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
- {
- result->insertEnumField(md);
- }
- }
result->m_impl->defArgList = m_impl->defArgList;
result->m_impl->tArgList = m_impl->tArgList;
result->m_impl->typeConstraints = m_impl->typeConstraints;
@@ -1512,12 +1479,12 @@ MemberDefImpl::~MemberDefImpl()
m_impl=0;
}
-void MemberDefImpl::setReimplements(MemberDef *md)
+void MemberDefImpl::setReimplements(const MemberDef *md)
{
m_impl->redefines = md;
}
-void MemberDefImpl::insertReimplementedBy(MemberDef *md)
+void MemberDefImpl::insertReimplementedBy(const MemberDef *md)
{
if (m_impl->templateMaster)
{
@@ -1527,30 +1494,27 @@ void MemberDefImpl::insertReimplementedBy(MemberDef *md)
mdm->insertReimplementedBy(md);
}
}
- if (m_impl->redefinedBy==0) m_impl->redefinedBy = new MemberList(MemberListType_redefinedBy);
- if (m_impl->redefinedBy->findRef(md)==-1)
+ if (!m_impl->redefinedBy.contains(md))
{
- m_impl->redefinedBy->inSort(md);
+ m_impl->redefinedBy.inSort(md);
}
}
-MemberDef *MemberDefImpl::reimplements() const
+const MemberDef *MemberDefImpl::reimplements() const
{
return m_impl->redefines;
}
-MemberList *MemberDefImpl::reimplementedBy() const
+const MemberList &MemberDefImpl::reimplementedBy() const
{
return m_impl->redefinedBy;
}
bool MemberDefImpl::isReimplementedBy(const ClassDef *cd) const
{
- if (cd && m_impl->redefinedBy)
+ if (cd)
{
- MemberListIterator mi(*m_impl->redefinedBy);
- MemberDef *md;
- for (mi.toFirst();(md=mi.current());++mi)
+ for (const auto &md : m_impl->redefinedBy)
{
const ClassDef *mcd = md->getClassDef();
if (mcd)
@@ -1565,10 +1529,9 @@ bool MemberDefImpl::isReimplementedBy(const ClassDef *cd) const
return FALSE;
}
-void MemberDefImpl::insertEnumField(MemberDef *md)
+void MemberDefImpl::insertEnumField(const MemberDef *md)
{
- if (m_impl->enumFields==0) m_impl->enumFields=new MemberList(MemberListType_enumFields);
- m_impl->enumFields->append(md);
+ m_impl->enumFields.push_back(md);
}
bool MemberDefImpl::addExample(const char *anchor,const char *nameStr, const char *file)
@@ -2767,7 +2730,7 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const
void MemberDefImpl::_writeReimplements(OutputList &ol) const
{
- MemberDef *bmd=reimplements();
+ const MemberDef *bmd=reimplements();
const ClassDef *bcd=0;
if (bmd && (bcd=bmd->getClassDef()))
{
@@ -2826,25 +2789,22 @@ void MemberDefImpl::_writeReimplements(OutputList &ol) const
void MemberDefImpl::_writeReimplementedBy(OutputList &ol) const
{
- MemberList *bml=reimplementedBy();
- if (bml)
+ const MemberList &bml=reimplementedBy();
+ if (!bml.empty())
{
- MemberListIterator mli(*bml);
- MemberDef *bmd=0;
uint count=0;
- const ClassDef *bcd=0;
- for (mli.toFirst();(bmd=mli.current()) && (bcd=bmd->getClassDef());++mli)
+ for (const auto &bmd : bml)
{
+ const ClassDef *bcd=bmd->getClassDef();
// count the members that directly inherit from md and for
// which the member and class are visible in the docs.
- if ( bmd->isLinkable() && bcd->isLinkable() )
+ if ( bcd && bmd->isLinkable() && bcd->isLinkable() )
{
count++;
}
}
if (count>0)
{
- mli.toFirst();
// write the list of classes that overwrite this member
ol.startParagraph();
@@ -2865,17 +2825,22 @@ void MemberDefImpl::_writeReimplementedBy(OutputList &ol) const
ol.parseText(reimplInLine.mid(index,newIndex-index));
bool ok;
uint entryIndex = reimplInLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
- //bmd=bml->at(entryIndex);
count=0;
+ auto it = bml.begin();
// find the entryIndex-th documented entry in the inheritance list.
- for (mli.toLast();(bmd=mli.current()) && (bcd=bmd->getClassDef());--mli)
+ const MemberDef *bmd = 0;
+ const ClassDef *bcd = 0;
+ while (it!=bml.end())
{
+ bmd = *it;
+ bcd = bmd->getClassDef();
if ( bmd->isLinkable() && bcd->isLinkable())
{
if (count==entryIndex) break;
count++;
}
+ ++it;
}
if (ok && bcd && bmd) // write link for marker
@@ -2890,7 +2855,6 @@ void MemberDefImpl::_writeReimplementedBy(OutputList &ol) const
writePageRef(ol,bmd->getOutputFileBase(),bmd->anchor());
}
}
- ++mli;
index=newIndex+matchLen;
}
ol.parseText(reimplInLine.right(reimplInLine.length()-index));
@@ -2935,7 +2899,7 @@ void MemberDefImpl::_writeCategoryRelation(OutputList &ol) const
i=text.find("@0");
if (i!=-1)
{
- MemberDef *md = m_impl->categoryRelation;
+ const MemberDef *md = m_impl->categoryRelation;
ref = md->getReference();
file = md->getOutputFileBase();
anc = md->anchor();
@@ -2981,65 +2945,59 @@ void MemberDefImpl::_writeEnumValues(OutputList &ol,const Definition *container,
if (isEnumerate())
{
bool first=TRUE;
- const MemberList *fmdl=enumFieldList();
- //printf("** %s: enum values=%d\n",name().data(),fmdl!=0 ? fmdl->count() : 0);
- if (fmdl)
+ //printf("** %s: enum values=%zu\n",name().data(),enumFieldList().size());
+ for (const auto &fmd : enumFieldList())
{
- MemberListIterator it(*fmdl);
- MemberDef *fmd;
- for (;(fmd=it.current());++it)
+ //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable());
+ if (fmd->isLinkable())
{
- //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable());
- if (fmd->isLinkable())
+ if (first)
{
- if (first)
- {
- ol.startDescTable(theTranslator->trEnumerationValues());
- }
+ ol.startDescTable(theTranslator->trEnumerationValues());
+ }
- ol.startDescTableRow();
- ol.addIndexItem(fmd->name(),ciname);
- ol.addIndexItem(ciname,fmd->name());
+ ol.startDescTableRow();
+ ol.addIndexItem(fmd->name(),ciname);
+ ol.addIndexItem(ciname,fmd->name());
- Doxygen::indexList->addIndexItem(container,fmd);
+ Doxygen::indexList->addIndexItem(container,fmd);
- ol.startDescTableTitle();
- ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name(),fmd->argsString());
- first=FALSE;
- ol.docify(fmd->name());
- ol.disableAllBut(OutputGenerator::Man);
- ol.writeString(" ");
- ol.enableAll();
- ol.endDoxyAnchor(cfname,fmd->anchor());
- ol.endDescTableTitle();
- ol.startDescTableData();
+ ol.startDescTableTitle();
+ ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name(),fmd->argsString());
+ first=FALSE;
+ ol.docify(fmd->name());
+ ol.disableAllBut(OutputGenerator::Man);
+ ol.writeString(" ");
+ ol.enableAll();
+ ol.endDoxyAnchor(cfname,fmd->anchor());
+ ol.endDescTableTitle();
+ ol.startDescTableData();
- bool hasBrief = !fmd->briefDescription().isEmpty();
- bool hasDetails = !fmd->documentation().isEmpty();
+ bool hasBrief = !fmd->briefDescription().isEmpty();
+ bool hasDetails = !fmd->documentation().isEmpty();
- if (hasBrief)
- {
- ol.generateDoc(fmd->briefFile(),fmd->briefLine(),
- getOuterScope()?getOuterScope():container,
- fmd,fmd->briefDescription(),TRUE,FALSE,
- 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
- }
- // FIXME:PARA
- //if (!fmd->briefDescription().isEmpty() &&
- // !fmd->documentation().isEmpty())
- //{
- // ol.newParagraph();
- //}
- if (hasDetails)
- {
- ol.generateDoc(fmd->docFile(),fmd->docLine(),
- getOuterScope()?getOuterScope():container,
- fmd,fmd->documentation()+"\n",TRUE,FALSE,
- 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
- }
- ol.endDescTableData();
- ol.endDescTableRow();
+ if (hasBrief)
+ {
+ ol.generateDoc(fmd->briefFile(),fmd->briefLine(),
+ getOuterScope()?getOuterScope():container,
+ fmd,fmd->briefDescription(),TRUE,FALSE,
+ 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ }
+ // FIXME:PARA
+ //if (!fmd->briefDescription().isEmpty() &&
+ // !fmd->documentation().isEmpty())
+ //{
+ // ol.newParagraph();
+ //}
+ if (hasDetails)
+ {
+ ol.generateDoc(fmd->docFile(),fmd->docLine(),
+ getOuterScope()?getOuterScope():container,
+ fmd,fmd->documentation()+"\n",TRUE,FALSE,
+ 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
}
+ ol.endDescTableData();
+ ol.endDescTableRow();
}
}
if (!first)
@@ -3287,10 +3245,8 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
if ((isVariable() || isTypedef()) && (i=r.match(ldef,0,&l))!=-1)
{
// find enum type and insert it in the definition
- MemberListIterator vmli(*ml);
- MemberDef *vmd;
- bool found=FALSE;
- for ( ; (vmd=vmli.current()) && !found ; ++vmli)
+ bool found=false;
+ for (const auto &vmd : *ml)
{
if (vmd->isEnumerate() && ldef.mid(i,l)==vmd->name())
{
@@ -3300,7 +3256,8 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
vmd->writeEnumDeclaration(ol,getClassDef(),getNamespaceDef(),getFileDef(),getGroupDef());
linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,ldef.right(ldef.length()-i-l));
- found=TRUE;
+ found=true;
+ break;
}
}
if (!found) // anonymous compound
@@ -4182,7 +4139,7 @@ void MemberDefImpl::setGroupDef(const GroupDef *gd,Grouping::GroupPri_t pri,
m_isLinkableCached = 0;
}
-void MemberDefImpl::setEnumScope(MemberDef *md,bool livesInsideEnum)
+void MemberDefImpl::setEnumScope(const MemberDef *md,bool livesInsideEnum)
{
m_impl->enumScope=md;
m_impl->livesInsideEnum=livesInsideEnum;
@@ -4362,7 +4319,7 @@ Specifier MemberDefImpl::virtualness(int count) const
return Normal;
}
Specifier v = m_impl->virt;
- MemberDef *rmd = reimplements();
+ const MemberDef *rmd = reimplements();
while (rmd && v==Normal)
{
v = rmd->virtualness(count+1)==Normal ? Normal : Virtual;
@@ -4427,24 +4384,18 @@ void MemberDefImpl::writeTagFile(FTextStream &tagFile) const
tagFile << " <arglist>" << convertToXML(argsString()) << "</arglist>" << endl;
if (isStrong())
{
- MemberList *fmdl=m_impl->enumFields;
- if (fmdl)
+ for (const auto &fmd : m_impl->enumFields)
{
- MemberListIterator mli(*fmdl);
- MemberDef *fmd;
- for (mli.toFirst();(fmd=mli.current());++mli)
+ if (!fmd->isReference())
{
- if (!fmd->isReference())
+ tagFile << " <enumvalue file=\"" << convertToXML(getOutputFileBase()+Doxygen::htmlFileExtension);
+ tagFile << "\" anchor=\"" << convertToXML(fmd->anchor());
+ idStr = fmd->id();
+ if (!idStr.isEmpty())
{
- tagFile << " <enumvalue file=\"" << convertToXML(getOutputFileBase()+Doxygen::htmlFileExtension);
- tagFile << "\" anchor=\"" << convertToXML(fmd->anchor());
- idStr = fmd->id();
- if (!idStr.isEmpty())
- {
- tagFile << "\" clangid=\"" << convertToXML(idStr);
- }
- tagFile << "\">" << convertToXML(fmd->name()) << "</enumvalue>" << endl;
+ tagFile << "\" clangid=\"" << convertToXML(idStr);
}
+ tagFile << "\">" << convertToXML(fmd->name()) << "</enumvalue>" << endl;
}
}
}
@@ -4543,16 +4494,10 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
{
int enumMemCount=0;
- MemberList *fmdl=m_impl->enumFields;
uint numVisibleEnumValues=0;
- if (fmdl)
+ for (const auto &fmd : m_impl->enumFields)
{
- MemberListIterator mli(*fmdl);
- MemberDef *fmd;
- for (mli.toFirst();(fmd=mli.current());++mli)
- {
- if (fmd->isBriefSectionVisible()) numVisibleEnumValues++;
- }
+ if (fmd->isBriefSectionVisible()) numVisibleEnumValues++;
}
if (numVisibleEnumValues==0 && !isBriefSectionVisible())
{
@@ -4590,11 +4535,12 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
if (numVisibleEnumValues>0 && enumValuesPerLine>0)
{
typeDecl.docify("{ ");
- if (fmdl)
+
+ auto it = m_impl->enumFields.begin();
+ if (it!=m_impl->enumFields.end())
{
- MemberListIterator mli(*fmdl);
- MemberDefMutable *fmd=toMemberDefMutable(mli.current());
- bool fmdVisible = fmd ? fmd->isBriefSectionVisible() : TRUE;
+ const MemberDef *fmd=*it;
+ bool fmdVisible = fmd->isBriefSectionVisible();
bool first=true;
while (fmd)
{
@@ -4620,11 +4566,11 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
typeDecl.popGeneratorState();
}
- if (fmd->hasDocumentation()) // enum value has docs
+ MemberDefMutable *fmdm = toMemberDefMutable(fmd);
+ if (fmdm && fmd->hasDocumentation()) // enum value has docs
{
- //fmd->_writeTagData(compoundType);
- fmd->addToSearchIndex();
- fmd->writeLink(typeDecl,cd,nd,fd,gd);
+ fmdm->addToSearchIndex();
+ fmdm->writeLink(typeDecl,cd,nd,fd,gd);
}
else // no docs for this enum value
{
@@ -4642,8 +4588,15 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
}
bool prevVisible = fmdVisible;
- ++mli;
- fmd=toMemberDefMutable(mli.current());
+ ++it;
+ if (it!=m_impl->enumFields.end())
+ {
+ fmd=*it;
+ }
+ else
+ {
+ fmd=0;
+ }
if (prevVisible)
{
typeDecl.disable(OutputGenerator::Man);
@@ -5297,7 +5250,7 @@ bool MemberDefImpl::isConstExpr() const
return (m_impl->memSpec&Entry::ConstExpr)!=0;
}
-const MemberList *MemberDefImpl::enumFieldList() const
+const MemberList &MemberDefImpl::enumFieldList() const
{
return m_impl->enumFields;
}
@@ -5430,7 +5383,7 @@ bool MemberDefImpl::hasReferencesRelation() const
return m_impl->hasReferencesRelation;
}
-MemberDef *MemberDefImpl::templateMaster() const
+const MemberDef *MemberDefImpl::templateMaster() const
{
return m_impl->templateMaster;
}
@@ -5466,7 +5419,7 @@ MemberDef *MemberDefImpl::memberDeclaration() const
return m_impl->memDec;
}
-MemberDef *MemberDefImpl::inheritsDocsFrom() const
+const MemberDef *MemberDefImpl::inheritsDocsFrom() const
{
return m_impl->docProvider;
}
@@ -5569,7 +5522,7 @@ void MemberDefImpl::makeForeign()
m_isLinkableCached = 0;
}
-void MemberDefImpl::setInheritsDocsFrom(MemberDef *md)
+void MemberDefImpl::setInheritsDocsFrom(const MemberDef *md)
{
m_impl->docProvider = md;
}
@@ -5584,7 +5537,7 @@ void MemberDefImpl::setRelatedAlso(ClassDef *cd)
m_impl->relatedAlso=cd;
}
-void MemberDefImpl::setEnumClassScope(ClassDef *cd)
+void MemberDefImpl::setEnumClassScope(const ClassDef *cd)
{
m_impl->classDef = cd;
m_isLinkableCached = 0;
@@ -5660,7 +5613,7 @@ MemberDef *MemberDefImpl::fromAnonymousMember() const
return m_impl->annMemb;
}
-void MemberDefImpl::setTemplateMaster(MemberDef *mt)
+void MemberDefImpl::setTemplateMaster(const MemberDef *mt)
{
m_impl->templateMaster=mt;
m_isLinkableCached = 0;
@@ -5701,12 +5654,12 @@ void MemberDefImpl::setCategory(ClassDef *def)
m_impl->category = def;
}
-MemberDef *MemberDefImpl::categoryRelation() const
+const MemberDef *MemberDefImpl::categoryRelation() const
{
return m_impl->categoryRelation;
}
-void MemberDefImpl::setCategoryRelation(MemberDef *md)
+void MemberDefImpl::setCategoryRelation(const MemberDef *md)
{
m_impl->categoryRelation = md;
}
@@ -5731,7 +5684,7 @@ void MemberDefImpl::cacheTypedefVal(const ClassDef*val, const QCString & templSp
//printf("MemberDefImpl::cacheTypedefVal=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl);
}
-void MemberDefImpl::copyArgumentNames(MemberDef *bmd)
+void MemberDefImpl::copyArgumentNames(const MemberDef *bmd)
{
{
const ArgumentList &srcAl = bmd->argumentList();
diff --git a/src/memberdef.h b/src/memberdef.h
index ff0e300..39355db 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -41,6 +41,7 @@ class QTextStream;
class QStrList;
struct TagInfo;
class MemberDefMutable;
+class MemberGroupList;
/** A model of a class/file/namespace member symbol. */
class MemberDef : public Definition
@@ -200,8 +201,8 @@ class MemberDef : public Definition
virtual bool isFriendClass() const = 0;
virtual bool isDocumentedFriendClass() const = 0;
- virtual MemberDef *reimplements() const = 0;
- virtual MemberList *reimplementedBy() const = 0;
+ virtual const MemberDef *reimplements() const = 0;
+ virtual const MemberList &reimplementedBy() const = 0;
virtual bool isReimplementedBy(const ClassDef *cd) const = 0;
virtual ClassDef *relatedAlso() const = 0;
@@ -210,7 +211,7 @@ class MemberDef : public Definition
virtual const MemberDef *getAnonymousEnumType() const = 0;
virtual bool isDocsForDefinition() const = 0;
virtual const MemberDef *getEnumScope() const = 0;
- virtual const MemberList *enumFieldList() const = 0;
+ virtual const MemberList &enumFieldList() const = 0;
virtual QCString enumBaseType() const = 0;
virtual bool hasExamples() const = 0;
@@ -239,7 +240,7 @@ class MemberDef : public Definition
virtual bool hasReferencesRelation() const = 0;
virtual bool hasReferencedByRelation() const = 0;
- virtual MemberDef *templateMaster() const = 0;
+ virtual const MemberDef *templateMaster() const = 0;
virtual QCString getScopeString() const = 0;
virtual ClassDef *getClassDefOfAnonymousType() const = 0;
@@ -251,11 +252,11 @@ class MemberDef : public Definition
virtual MemberDef *memberDefinition() const = 0;
virtual MemberDef *memberDeclaration() const = 0;
- virtual MemberDef *inheritsDocsFrom() const = 0;
+ virtual const MemberDef *inheritsDocsFrom() const = 0;
virtual const MemberDef *getGroupAlias() const = 0;
virtual ClassDef *category() const = 0;
- virtual MemberDef *categoryRelation() const = 0;
+ virtual const MemberDef *categoryRelation() const = 0;
virtual QCString displayName(bool=TRUE) const = 0;
virtual QCString getDeclType() const = 0;
@@ -318,22 +319,22 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef
virtual void makeRelated() = 0;
virtual void makeForeign() = 0;
- virtual void setInheritsDocsFrom(MemberDef *md) = 0;
+ virtual void setInheritsDocsFrom(const MemberDef *md) = 0;
virtual void setTagInfo(const TagInfo *i) = 0;
virtual void setArgsString(const char *as) = 0;
virtual void incrementFlowKeyWordCount() = 0;
virtual void setEnumBaseType(const QCString &type) = 0;
// relation to other members
- virtual void setReimplements(MemberDef *md) = 0;
- virtual void insertReimplementedBy(MemberDef *md) = 0;
+ virtual void setReimplements(const MemberDef *md) = 0;
+ virtual void insertReimplementedBy(const MemberDef *md) = 0;
virtual void setRelatedAlso(ClassDef *cd) = 0;
// enumeration specific members
- virtual void insertEnumField(MemberDef *md) = 0;
- virtual void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE) = 0;
- virtual void setEnumClassScope(ClassDef *cd) = 0;
+ virtual void insertEnumField(const MemberDef *md) = 0;
+ virtual void setEnumScope(const MemberDef *md,bool livesInsideEnum=FALSE) = 0;
+ virtual void setEnumClassScope(const ClassDef *cd) = 0;
virtual void setDocumentedEnumValues(bool value) = 0;
virtual void setAnonymousEnumType(const MemberDef *md) = 0;
@@ -370,7 +371,7 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef
virtual void enableReferencedByRelation(bool e) = 0;
virtual void enableReferencesRelation(bool e) = 0;
- virtual void setTemplateMaster(MemberDef *mt) = 0;
+ virtual void setTemplateMaster(const MemberDef *mt) = 0;
virtual void addListReference(Definition *d) = 0;
virtual void setDocsForDefinition(bool b) = 0;
virtual void setGroupAlias(const MemberDef *md) = 0;
@@ -384,10 +385,10 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef
virtual void setMemberDefinition(MemberDef *md) = 0;
virtual void setMemberDeclaration(MemberDef *md) = 0;
- virtual void copyArgumentNames(MemberDef *bmd) = 0;
+ virtual void copyArgumentNames(const MemberDef *bmd) = 0;
virtual void setCategory(ClassDef *) = 0;
- virtual void setCategoryRelation(MemberDef *) = 0;
+ virtual void setCategoryRelation(const MemberDef *) = 0;
virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) = 0;
virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) = 0;
diff --git a/src/membergroup.cpp b/src/membergroup.cpp
index bd3bf0c..77f5842 100644
--- a/src/membergroup.cpp
+++ b/src/membergroup.cpp
@@ -30,22 +30,20 @@
#include "md5.h"
MemberGroup::MemberGroup(const Definition *container,int id,const char *hdr,const char *d,const char *docFile,int docLine)
- : m_container(container), grpId(id), grpHeader(hdr), doc(d), m_docFile(docFile), m_docLine(docLine)
+ : m_container(container),
+ memberList(std::make_unique<MemberList>(MemberListType_memberGroup)),
+ grpId(id), grpHeader(hdr), doc(d), m_docFile(docFile), m_docLine(docLine)
{
- static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
-
//printf("New member group id=%d header=%s desc=%s\n",id,hdr,d);
- memberList = new MemberList(MemberListType_memberGroup);
- memberList->setNeedsSorting(sortBriefDocs); // detailed sections are already sorted elsewhere.
+ memberList->setNeedsSorting(Config_getBool(SORT_BRIEF_DOCS)); // detailed sections are already sorted elsewhere.
//printf("Member group docs='%s'\n",doc.data());
}
MemberGroup::~MemberGroup()
{
- delete memberList;
}
-void MemberGroup::insertMember(MemberDef *md)
+void MemberGroup::insertMember(const MemberDef *md)
{
//printf("MemberGroup::insertMember memberList=%p count=%d"
// " member section list: %p: md=%p:%s\n",
@@ -54,7 +52,7 @@ void MemberGroup::insertMember(MemberDef *md)
// md->getSectionList(),
// md,md->name().data());
- MemberDef *firstMd = memberList->getFirst();
+ const MemberDef *firstMd = memberList->empty() ? 0 : memberList->front();
if (inSameSection && firstMd &&
firstMd->getSectionList(m_container)!=md->getSectionList(m_container))
{
@@ -65,7 +63,7 @@ void MemberGroup::insertMember(MemberDef *md)
inDeclSection = const_cast<MemberList*>(md->getSectionList(m_container));
//printf("inDeclSection=%p type=%d\n",inDeclSection,inDeclSection->listType());
}
- memberList->append(md);
+ memberList->push_back(md);
// copy the group of the first member in the memberGroup
GroupDef *gd;
@@ -131,16 +129,14 @@ void MemberGroup::addGroupedInheritedMembers(OutputList &ol,const ClassDef *cd,
const ClassDef *inheritedFrom,const QCString &inheritId) const
{
//printf("** addGroupedInheritedMembers()\n");
- MemberListIterator li(*memberList);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : *memberList)
{
//printf("matching %d == %d\n",lt,md->getSectionList()->listType());
const MemberList *ml = md->getSectionList(m_container);
if (ml && lt==ml->listType())
{
MemberList mml(lt);
- mml.append(md);
+ mml.push_back(md);
mml.countDecMembers();
mml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId);
}
@@ -151,9 +147,7 @@ int MemberGroup::countGroupedInheritedMembers(MemberListType lt)
{
//printf("** countGroupedInheritedMembers()\n");
int count=0;
- MemberListIterator li(*memberList);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ for (const auto &md : *memberList)
{
//printf("matching %d == %d\n",lt,md->getSectionList()->listType());
const MemberList *ml = md->getSectionList(m_container);
@@ -203,26 +197,25 @@ int MemberGroup::countInheritableMembers(const ClassDef *inheritedFrom) const
void MemberGroup::distributeMemberGroupDocumentation()
{
//printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",grpHeader.data());
- MemberListIterator li(*memberList);
- MemberDef *md;
- for (li.toFirst();(md=li.current());++li)
+ const MemberDef *md = 0;
+ for (const auto &smd : *memberList)
{
//printf("checking md=%s\n",md->name().data());
// find the first member of the group with documentation
- if (!md->documentation().isEmpty() ||
- !md->briefDescription().isEmpty() ||
- !md->inbodyDocumentation().isEmpty()
+ if (!smd->documentation().isEmpty() ||
+ !smd->briefDescription().isEmpty() ||
+ !smd->inbodyDocumentation().isEmpty()
)
{
//printf("found it!\n");
+ md = smd;
break;
}
}
if (md) // distribute docs of md to other members of the list
{
//printf("Member %s has documentation!\n",md->name().data());
- MemberDef *iomd;
- for (li.toFirst();(iomd=li.current());++li)
+ for (const auto &iomd : *memberList)
{
MemberDefMutable *omd = toMemberDefMutable(iomd);
if (omd && md!=omd && omd->documentation().isEmpty() &&
@@ -239,57 +232,6 @@ void MemberGroup::distributeMemberGroupDocumentation()
}
}
-#if 0
-int MemberGroup::varCount() const
-{
- return memberList->varCount();
-}
-
-int MemberGroup::funcCount() const
-{
- return memberList->funcCount();
-}
-
-int MemberGroup::enumCount() const
-{
- return memberList->enumCount();
-}
-
-int MemberGroup::enumValueCount() const
-{
- return memberList->enumValueCount();
-}
-
-int MemberGroup::typedefCount() const
-{
- return memberList->typedefCount();
-}
-
-int MemberGroup::sequenceCount() const
-{
- return memberList->sequenceCount();
-}
-
-int MemberGroup::dictionaryCount() const
-{
- return memberList->dictionaryCount();
-}
-
-int MemberGroup::protoCount() const
-{
- return memberList->protoCount();
-}
-
-int MemberGroup::defineCount() const
-{
- return memberList->defineCount();
-}
-
-int MemberGroup::friendCount() const
-{
- return memberList->friendCount();
-}
-#endif
int MemberGroup::numDecMembers() const
{
diff --git a/src/membergroup.h b/src/membergroup.h
index 8d49716..d9a392e 100644
--- a/src/membergroup.h
+++ b/src/membergroup.h
@@ -50,7 +50,7 @@ class MemberGroup
~MemberGroup();
QCString header() const { return grpHeader; }
int groupId() const { return grpId; }
- void insertMember(MemberDef *md);
+ void insertMember(const MemberDef *md);
void setAnchors();
void writePlainDeclarations(OutputList &ol,
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
@@ -86,7 +86,7 @@ class MemberGroup
void setInGroup(bool b);
void addListReferences(Definition *d);
void setRefItems(const RefItemVector &sli);
- MemberList *members() const { return memberList; }
+ const MemberList &members() const { return *memberList.get(); }
QCString anchor() const;
QCString docFile() const { return m_docFile; }
@@ -94,7 +94,7 @@ class MemberGroup
private:
const Definition *m_container;
- MemberList *memberList = 0; // list of all members in the group
+ std::unique_ptr<MemberList> memberList; // list of all members in the group
MemberList *inDeclSection = 0;
int grpId = 0;
QCString grpHeader;
@@ -106,8 +106,13 @@ class MemberGroup
RefItemVector m_xrefListItems;
};
-using MemberGroupRefList = std::vector<MemberGroup *>;
-using MemberGroupList = std::vector< std::unique_ptr<MemberGroup> >;
+class MemberGroupRefList : public std::vector<MemberGroup *>
+{
+};
+
+class MemberGroupList : public std::vector< std::unique_ptr<MemberGroup> >
+{
+};
/** Data collected for a member group */
struct MemberGroupInfo
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index 1be1ec7..9181e3f 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -92,17 +92,10 @@ int genericCompareMembers(const MemberDef *c1,const MemberDef *c2)
return cmp;
}
-int MemberList::compareValues(const MemberDef *c1, const MemberDef *c2) const
-{
- return genericCompareMembers(c1,c2);
-}
-
int MemberList::countInheritableMembers(const ClassDef *inheritedFrom) const
{
int count=0;
- QListIterator<MemberDef> mli(*this);
- const MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : m_members)
{
if (md->isBriefSectionVisible())
{
@@ -146,9 +139,7 @@ void MemberList::countDecMembers()
m_typeCnt=m_seqCnt=m_dictCnt=m_protoCnt=m_defCnt=m_friendCnt=0;
*/
m_numDecMembers=0;
- QListIterator<MemberDef> mli(*this);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : m_members)
{
//printf("MemberList::countDecMembers(md=%s,%d)\n",md->name().data(),md->isBriefSectionVisible());
if (md->isBriefSectionVisible())
@@ -227,9 +218,7 @@ void MemberList::countDocMembers()
{
if (m_numDocMembers!=-1) return; // used cached value
m_numDocMembers=0;
- QListIterator<MemberDef> mli(*this);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : m_members)
{
if (md->isDetailedSectionVisible(m_inGroup,m_inFile) && !md->isAlias())
{
@@ -250,57 +239,10 @@ void MemberList::countDocMembers()
//printf("MemberList::countDocMembers()=%d memberGroupList=%p\n",m_numDocMembers,memberGroupList);
}
-void MemberList::inSort(const MemberDef *md)
-{
- QList<MemberDef>::inSort(md);
-}
-
-void MemberList::append(const MemberDef *md)
-{
- QList<MemberDef>::append(md);
-}
-
-void MemberList::remove(const MemberDef *md)
-{
- QList<MemberDef>::remove(md);
-}
-
-void MemberList::sort()
-{
- QList<MemberDef>::sort();
-}
-
-uint MemberList::count() const
-{
- return QList<MemberDef>::count();
-}
-
-int MemberList::findRef(const MemberDef *md) const
-{
- return QList<MemberDef>::findRef(md);
-}
-
-MemberDef *MemberList::getFirst() const
-{
- return QList<MemberDef>::getFirst();
-}
-
-MemberDef *MemberList::take(uint index)
-{
- return QList<MemberDef>::take(index);
-}
-
-MemberListIterator::MemberListIterator(const MemberList &l) :
- QListIterator<MemberDef>(l)
-{
-}
-
void MemberList::setAnonymousEnumType()
{
//printf("MemberList(%p)::setAnonymousEnumType()\n",this);
- MemberListIterator mli(*this);
- const MemberDef *md;
- for ( ; (md=mli.current()); ++mli )
+ for (const auto &md : m_members)
{
if (md->isBriefSectionVisible())
{
@@ -309,21 +251,15 @@ void MemberList::setAnonymousEnumType()
if (i!=-1) name=name.right(name.length()-i-2);
if (md->memberType()==MemberType_Enumeration && name[0]=='@')
{
- const MemberList *mfl = md->enumFieldList();
- if (mfl)
+ for (const auto &vmd : md->enumFieldList())
{
- MemberListIterator vmli(*mfl);
- MemberDef *vmd;
- for ( ; (vmd=vmli.current()) ; ++vmli)
+ MemberDefMutable *vmdm = toMemberDefMutable(vmd);
+ if (vmdm)
{
- MemberDefMutable *vmdm = toMemberDefMutable(vmd);
- if (vmdm)
+ QCString vtype=vmd->typeString();
+ if ((vtype.find(name))!=-1)
{
- QCString vtype=vmd->typeString();
- if ((vtype.find(name))!=-1)
- {
- vmdm->setAnonymousEnumType(md);
- }
+ vmdm->setAnonymousEnumType(md);
}
}
}
@@ -339,14 +275,12 @@ void MemberList::setAnonymousEnumType()
int MemberList::countEnumValues(const MemberDef *md) const
{
int numEnumValues=0;
- MemberListIterator vmli(*this);
- const MemberDef *vmd;
QCString name(md->name());
int i=name.findRev("::");
if (i!=-1) name=name.right(name.length()-i-2);
if (name[0]=='@')
{
- for ( ; (vmd=vmli.current()) ; ++vmli)
+ for (const auto &vmd : m_members)
{
QCString vtype=vmd->typeString();
if ((vtype.find(name))!=-1)
@@ -360,9 +294,7 @@ int MemberList::countEnumValues(const MemberDef *md) const
bool MemberList::declVisible() const
{
- MemberListIterator mli(*this);
- const MemberDef *md;
- for ( ; (md=mli.current()); ++mli )
+ for (const auto &md : m_members)
{
if (md->isBriefSectionVisible())
{
@@ -430,9 +362,7 @@ void MemberList::writePlainDeclarations(OutputList &ol,
ol.pushGeneratorState();
bool first=TRUE;
- const MemberDef *md;
- MemberListIterator mli(*this);
- for ( ; (md=mli.current()); ++mli )
+ for (const auto &md : m_members)
{
//printf(">>> Member '%s' type=%d visible=%d\n",
// md->name().data(),md->memberType(),md->isBriefSectionVisible());
@@ -557,7 +487,7 @@ void MemberList::writePlainDeclarations(OutputList &ol,
// no variables of the anonymous compound type exist.
if (cd)
{
- for ( mli.toFirst(); (md=mli.current()) ; ++mli )
+ for (const auto &md : m_members)
{
if (md->fromAnonymousScope() && !md->anonymousDeclShown())
{
@@ -763,9 +693,6 @@ void MemberList::writeDocumentation(OutputList &ol,
}
ol.startMemberDocList();
- MemberListIterator mli(*this);
- const MemberDef *md;
-
struct OverloadInfo
{
uint count = 1;
@@ -773,7 +700,7 @@ void MemberList::writeDocumentation(OutputList &ol,
};
std::unordered_map<std::string,OverloadInfo> overloadInfo;
// count the number of overloaded members
- for (mli.toFirst() ; (md=mli.current()) ; ++mli)
+ for (const auto &md : m_members)
{
if (md->isDetailedSectionVisible(m_inGroup,container->definitionType()==Definition::TypeFile) &&
!(md->isEnumValue() && !showInline))
@@ -783,7 +710,7 @@ void MemberList::writeDocumentation(OutputList &ol,
}
}
- for (mli.toFirst() ; (md=mli.current()) ; ++mli)
+ for (const auto &md : m_members)
{
if (md->isDetailedSectionVisible(m_inGroup,container->definitionType()==Definition::TypeFile) &&
!(md->isEnumValue() && !showInline))
@@ -820,9 +747,7 @@ void MemberList::writeSimpleDocumentation(OutputList &ol,
cd = toClassDef(container);
}
ol.startMemberDocSimple(cd && cd->isJavaEnum());
- MemberListIterator mli(*this);
- const MemberDef *md;
- for ( ; (md=mli.current()) ; ++mli)
+ for (const auto &md : m_members)
{
MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
@@ -847,9 +772,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
std::unordered_map<std::string,OverloadInfo> overloadInfo;
// count the number of overloaded members
- MemberListIterator mli(*this);
- const MemberDef *imd;
- for (mli.toFirst() ; (imd=mli.current()) ; ++mli)
+ for (const auto &imd : m_members)
{
MemberDefMutable *md = toMemberDefMutable(imd);
@@ -860,7 +783,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
}
}
- for ( mli.toFirst() ; (imd=mli.current()) ; ++mli)
+ for (const auto &imd : m_members)
{
Definition *container_d = toDefinition(const_cast<DefinitionMutable*>(container));
MemberDefMutable *md = toMemberDefMutable(imd);
@@ -920,21 +843,17 @@ void MemberList::addMemberGroup(MemberGroup *mg)
void MemberList::addListReferences(Definition *def)
{
- MemberListIterator mli(*this);
- MemberDef *imd;
- for ( ; (imd=mli.current()) ; ++mli)
+ for (const auto &imd : m_members)
{
MemberDefMutable *md = toMemberDefMutable(imd);
if (md && !md->isAlias() && (md->getGroupDef()==0 || def->definitionType()==Definition::TypeGroup))
{
md->addListReference(def);
- const MemberList *enumFields = md->enumFieldList();
- if (md->memberType()==MemberType_Enumeration && enumFields)
+ const MemberList &enumFields = md->enumFieldList();
+ if (md->memberType()==MemberType_Enumeration && !enumFields.empty())
{
//printf(" Adding enum values!\n");
- MemberListIterator vmli(*enumFields);
- MemberDef *vmd;
- for ( ; (vmd=vmli.current()) ; ++vmli)
+ for (const auto &vmd : enumFields)
{
MemberDefMutable *vmdm = toMemberDefMutable(vmd);
if (vmdm)
@@ -954,9 +873,7 @@ void MemberList::addListReferences(Definition *def)
void MemberList::findSectionsInDocumentation(const Definition *d)
{
- MemberListIterator mli(*this);
- MemberDef *imd;
- for ( ; (imd=mli.current()) ; ++mli)
+ for (const auto &imd : m_members)
{
MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
@@ -1035,9 +952,7 @@ QCString MemberList::listTypeAsString(MemberListType type)
void MemberList::writeTagFile(FTextStream &tagFile)
{
- MemberListIterator mli(*this);
- MemberDef *imd;
- for ( ; (imd=mli.current()) ; ++mli)
+ for (const auto &imd : m_members)
{
MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
@@ -1045,11 +960,9 @@ void MemberList::writeTagFile(FTextStream &tagFile)
if (md->getLanguage()!=SrcLangExt_VHDL)
{
md->writeTagFile(tagFile);
- if (md->memberType()==MemberType_Enumeration && md->enumFieldList() && !md->isStrong())
+ if (md->memberType()==MemberType_Enumeration && !md->isStrong())
{
- MemberListIterator vmli(*md->enumFieldList());
- MemberDef *ivmd;
- for ( ; (ivmd=vmli.current()) ; ++vmli)
+ for (const auto &ivmd : md->enumFieldList())
{
MemberDefMutable *vmd = toMemberDefMutable(ivmd);
if (vmd)
@@ -1075,9 +988,7 @@ void MemberList::writeTagFile(FTextStream &tagFile)
void MemberList::setAnchors()
{
//int count=0;
- MemberListIterator mli(*this);
- MemberDef *md;
- for (;(md=mli.current());++mli)
+ for (const auto &md : m_members)
{
MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm && !md->isReference())
diff --git a/src/memberlist.h b/src/memberlist.h
index 08e2873..aef227a 100644
--- a/src/memberlist.h
+++ b/src/memberlist.h
@@ -19,7 +19,6 @@
#include <vector>
#include <algorithm>
-#include <qlist.h>
#include "memberdef.h"
#include "linkedmap.h"
#include "types.h"
@@ -27,8 +26,10 @@
class GroupDef;
+int genericCompareMembers(const MemberDef *c1,const MemberDef *c2);
+
/** A list of MemberDef objects. */
-class MemberList : private QList<MemberDef>
+class MemberList
{
friend class MemberListIterator;
public:
@@ -38,28 +39,45 @@ class MemberList : private QList<MemberDef>
MemberListType listType() const { return m_listType; }
static QCString listTypeAsString(MemberListType type);
- /* ---- standard QList methods ---- */
- void inSort(const MemberDef *md);
- void append(const MemberDef *md);
- void remove(const MemberDef *md);
- void sort();
- uint count() const;
- int findRef(const MemberDef *md) const;
- MemberDef *getFirst() const;
- MemberDef *take(uint index);
+ /* --- standard vector interface ---- */
+ using Ptr = const MemberDef *;
+ using Vec = std::vector<Ptr>;
+ using iterator = typename Vec::iterator;
+ using const_iterator = typename Vec::const_iterator;
+ void push_back(const MemberDef *md) { m_members.push_back(md); }
+ iterator begin() { return m_members.begin(); }
+ iterator end() { return m_members.end(); }
+ const_iterator begin() const { return m_members.cbegin(); }
+ const_iterator end() const { return m_members.cend(); }
+ bool empty() const { return m_members.empty(); }
+ size_t size() const { return m_members.size(); }
+ Ptr& front() { return m_members.front(); }
+ Ptr& back() { return m_members.back(); }
+
+ /* --- other methods ---- */
+ static bool lessThan(const MemberDef *md1,const MemberDef *md2)
+ {
+ return genericCompareMembers(md1,md2)<0;
+ }
+ void sort()
+ {
+ std::sort(m_members.begin(),m_members.end(),lessThan);
+ }
+ void inSort(const MemberDef *md)
+ {
+ m_members.insert( std::upper_bound( m_members.begin(), m_members.end(), md, lessThan), md);
+ }
+ void remove(const MemberDef *md)
+ {
+ auto it = std::find(m_members.begin(),m_members.end(),md);
+ if (it!=m_members.end()) m_members.erase(it);
+ }
+ bool contains(const MemberDef *md)
+ {
+ auto it = std::find(m_members.begin(),m_members.end(),md);
+ return it!=m_members.end();
+ }
-/*
- int varCount() const { ASSERT(m_numDecMembers!=-1); return m_varCnt; }
- int funcCount() const { ASSERT(m_numDecMembers!=-1); return m_funcCnt; }
- int enumCount() const { ASSERT(m_numDecMembers!=-1); return m_enumCnt; }
- int enumValueCount() const { ASSERT(m_numDecMembers!=-1); return m_enumValCnt; }
- int typedefCount() const { ASSERT(m_numDecMembers!=-1); return m_typeCnt; }
- int sequenceCount() const { ASSERT(m_numDecMembers!=-1); return m_seqCnt; }
- int dictionaryCount() const { ASSERT(m_numDecMembers!=-1); return m_dictCnt; }
- int protoCount() const { ASSERT(m_numDecMembers!=-1); return m_protoCnt; }
- int defineCount() const { ASSERT(m_numDecMembers!=-1); return m_defCnt; }
- int friendCount() const { ASSERT(m_numDecMembers!=-1); return m_friendCnt; }
-*/
int numDecMembers() const { ASSERT(m_numDecMembers!=-1); return m_numDecMembers; }
int numDecEnumValues() const { return m_numDecEnumValues; }
int numDocMembers() const { ASSERT(m_numDocMembers!=-1); return m_numDocMembers; }
@@ -95,21 +113,7 @@ class MemberList : private QList<MemberDef>
void setAnchors();
private:
- MemberList(const MemberList &) = delete;
- MemberList &operator=(const MemberList &) = delete;
- int compareValues(const MemberDef *item1,const MemberDef *item2) const;
int countEnumValues(const MemberDef *md) const;
- /*
- int m_varCnt;
- int m_funcCnt;
- int m_enumCnt;
- int m_typeCnt;
- int m_seqCnt;
- int m_dictCnt;
- int m_protoCnt;
- int m_defCnt;
- int m_friendCnt;
- */
int m_numDecMembers; // number of members in the brief part of the memberlist
int m_numDecEnumValues;
int m_numDocMembers; // number of members in the detailed part of the memberlist
@@ -119,15 +123,7 @@ class MemberList : private QList<MemberDef>
bool m_inFile; // is this list part of a file definition
MemberListType m_listType;
bool m_needsSorting;
- QDict<int> m_overloadCount;
-};
-
-/** An iterator for MemberDef objects in a MemberList. */
-class MemberListIterator : public QListIterator<MemberDef>
-{
- public:
- MemberListIterator(const MemberList &list);
- virtual ~MemberListIterator() {}
+ Vec m_members;
};
class MemberLinkedRefMap : public LinkedRefMap<const MemberDef>
@@ -153,6 +149,5 @@ class MemberLists : public std::vector< std::unique_ptr<MemberList> >
MemberLists &operator=(const MemberLists &) = delete;
};
-int genericCompareMembers(const MemberDef *c1,const MemberDef *c2);
#endif
diff --git a/src/membername.h b/src/membername.h
index 9d56182..1a788af 100644
--- a/src/membername.h
+++ b/src/membername.h
@@ -67,12 +67,12 @@ class MemberNameLinkedMap : public LinkedMap<MemberName>
class MemberInfo
{
public:
- MemberInfo(MemberDef *md,Protection p,Specifier v,bool inh) :
+ MemberInfo(const MemberDef *md,Protection p,Specifier v,bool inh) :
m_memberDef(md), m_prot(p), m_virt(v), m_inherited(inh) {}
~MemberInfo() {}
// getters
- MemberDef *memberDef() { return m_memberDef; }
+ const MemberDef *memberDef() { return m_memberDef; }
const MemberDef *memberDef() const { return m_memberDef; }
Protection prot() const { return m_prot; }
Specifier virt() const { return m_virt; }
@@ -87,7 +87,7 @@ class MemberInfo
void setAmbigClass(const ClassDef *cd) { m_ambigClass = cd; }
private:
- MemberDef *m_memberDef;
+ const MemberDef *m_memberDef;
Protection m_prot;
Specifier m_virt;
bool m_inherited;
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index d35ca6f..d28f783 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -445,7 +445,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType_allMembersList));
allMemberList = m_memberLists.back().get();
}
- allMemberList->append(md);
+ allMemberList->push_back(md);
//printf("%s::m_allMembersDict->append(%s)\n",name().data(),md->localName().data());
m_allMembers.add(md->localName(),md);
//::addNamespaceMemberNameToIndex(md);
@@ -1057,9 +1057,7 @@ void NamespaceDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *cur
MemberList *allMemberList = getMemberList(MemberListType_allMembersList);
if (allMemberList)
{
- MemberListIterator mli(*allMemberList);
- MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *allMemberList)
{
if (md->getNamespaceDef()==this && md->isLinkable() && !md->isEnumValue())
{
@@ -1322,7 +1320,7 @@ void NamespaceDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
ml->setNeedsSorting(
((ml->listType()&MemberListType_declarationLists) && sortBriefDocs) ||
((ml->listType()&MemberListType_documentationLists) && sortMemberDocs));
- ml->append(md);
+ ml->push_back(md);
if (ml->listType()&MemberListType_declarationLists)
{
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
index 854b3df..ace627a 100644
--- a/src/perlmodgen.cpp
+++ b/src/perlmodgen.cpp
@@ -1676,13 +1676,11 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini
if (md->memberType()==MemberType_Enumeration) // enum
{
- const MemberList *enumFields = md->enumFieldList();
- if (enumFields)
+ const MemberList &enumFields = md->enumFieldList();
+ if (!enumFields.empty())
{
m_output.openList("values");
- MemberListIterator emli(*enumFields);
- const MemberDef *emd;
- for (emli.toFirst();(emd=emli.current());++emli)
+ for (const auto &emd : enumFields)
{
m_output.openHash()
.addFieldQuotedString("name", emd->name());
@@ -1713,14 +1711,13 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini
.addFieldQuotedString("name", rmd->name())
.closeHash();
- MemberList *rbml = md->reimplementedBy();
- if (rbml)
+ const MemberList &rbml = md->reimplementedBy();
+ if (!rbml.empty())
{
- MemberListIterator mli(*rbml);
m_output.openList("reimplemented_by");
- for (mli.toFirst();(rmd=mli.current());++mli)
+ for (const auto &rbmd : rbml)
m_output.openHash()
- .addFieldQuotedString("name", rmd->name())
+ .addFieldQuotedString("name", rbmd->name())
.closeHash();
m_output.closeList();
}
@@ -1739,9 +1736,7 @@ void PerlModGenerator::generatePerlModSection(const Definition *d,
m_output.addFieldQuotedString("header", header);
m_output.openList("members");
- MemberListIterator mli(*ml);
- const MemberDef *md;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
generatePerlModForMember(md,d);
}
@@ -1787,12 +1782,10 @@ void PerlModGenerator::generatePerlUserDefinedSection(const Definition *d, const
if (mg->header())
m_output.addFieldQuotedString("header", mg->header());
- if (mg->members())
+ if (!mg->members().empty())
{
m_output.openList("members");
- MemberListIterator mli(*mg->members());
- const MemberDef *md;
- for (mli.toFirst(); (md = mli.current()); ++mli)
+ for (const auto &md : mg->members())
{
generatePerlModForMember(md, d);
}
diff --git a/src/pycode.l b/src/pycode.l
index 65788cc..1ab724b 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -1355,7 +1355,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",scope.data(),locName.data(),mcd));
if (mcd)
{
- MemberDef *mmd = mcd->getMemberByName(locName);
+ const MemberDef *mmd = mcd->getMemberByName(locName);
if (mmd)
{
yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,mmd->typeString(),mmd->getOuterScope())));
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp
index 67adebf..f59e3fa 100644
--- a/src/sqlite3gen.cpp
+++ b/src/sqlite3gen.cpp
@@ -1848,10 +1848,7 @@ static void generateSqlite3Section( const Definition *d,
const char * /*documentation*/=0)
{
if (ml==0) return;
- MemberListIterator mli(*ml);
- const MemberDef *md;
-
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
// TODO: necessary? just tracking what xmlgen does; xmlgen says:
// namespace members are also inserted in the file scope, but
@@ -1869,7 +1866,7 @@ static void associateAllClassMembers(const ClassDef *cd, struct Refid scope_refi
{
for (auto &mi : *mni)
{
- MemberDef *md = mi->memberDef();
+ const MemberDef *md = mi->memberDef();
QCString qrefid = md->getOutputFileBase() + "_1" + md->anchor();
associateMember(md, insertRefid(qrefid), scope_refid);
}
@@ -2007,7 +2004,7 @@ static void generateSqlite3ForClass(const ClassDef *cd)
// + member groups
for (const auto &mg : cd->getMemberGroups())
{
- generateSqlite3Section(cd,mg->members(),refid,"user-defined",mg->header(),
+ generateSqlite3Section(cd,&mg->members(),refid,"user-defined",mg->header(),
mg->documentation());
}
@@ -2064,7 +2061,7 @@ static void generateSqlite3ForNamespace(const NamespaceDef *nd)
// + member groups
for (const auto &mg : nd->getMemberGroups())
{
- generateSqlite3Section(nd,mg->members(),refid,"user-defined",mg->header(),
+ generateSqlite3Section(nd,&mg->members(),refid,"user-defined",mg->header(),
mg->documentation());
}
@@ -2219,7 +2216,7 @@ static void generateSqlite3ForFile(const FileDef *fd)
// + member groups
for (const auto &mg : fd->getMemberGroups())
{
- generateSqlite3Section(fd,mg->members(),refid,"user-defined",mg->header(),
+ generateSqlite3Section(fd,&mg->members(),refid,"user-defined",mg->header(),
mg->documentation());
}
@@ -2286,7 +2283,7 @@ static void generateSqlite3ForGroup(const GroupDef *gd)
// + member groups
for (const auto &mg : gd->getMemberGroups())
{
- generateSqlite3Section(gd,mg->members(),refid,"user-defined",mg->header(),
+ generateSqlite3Section(gd,&mg->members(),refid,"user-defined",mg->header(),
mg->documentation());
}
diff --git a/src/util.cpp b/src/util.cpp
index b616132..50f3aec 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -2415,27 +2415,21 @@ bool getDefs(const QCString &scName,
if (tmd && tmd->isEnumerate() && tmd->isStrong()) // scoped enum
{
//printf("Found scoped enum!\n");
- const MemberList *tml = tmd->enumFieldList();
- if (tml)
+ for (const auto &emd : tmd->enumFieldList())
{
- MemberListIterator tmi(*tml);
- MemberDef *emd;
- for (;(emd=tmi.current());++tmi)
+ if (emd->localName()==mName)
{
- if (emd->localName()==mName)
+ if (emd->isLinkable())
{
- if (emd->isLinkable())
- {
- cd=tmd->getClassDef();
- md=emd;
- return TRUE;
- }
- else
- {
- cd=0;
- md=0;
- return FALSE;
- }
+ cd=tmd->getClassDef();
+ md=emd;
+ return TRUE;
+ }
+ else
+ {
+ cd=0;
+ md=0;
+ return FALSE;
}
}
}
@@ -4303,51 +4297,57 @@ void addMembersToMemberGroup(MemberList *ml,
ASSERT(context!=0);
//printf("addMemberToMemberGroup() context=%s\n",context->name().data());
if (ml==0) return;
- MemberListIterator mli(*ml);
- MemberDef *md;
- uint index;
- for (index=0;(md=mli.current());)
+
+ struct MoveMemberInfo
+ {
+ MoveMemberInfo(const MemberDef *md,MemberGroup *mg,const RefItemVector &rv)
+ : memberDef(md), memberGroup(mg), sli(rv) {}
+ const MemberDef *memberDef;
+ MemberGroup *memberGroup;
+ RefItemVector sli;
+ };
+ std::vector<MoveMemberInfo> movedMembers;
+
+ for (const auto &md : *ml)
{
if (md->isEnumerate()) // insert enum value of this enum into groups
{
- const MemberList *fmdl=md->enumFieldList();
- if (fmdl!=0)
+ for (const auto &fmd : md->enumFieldList())
{
- MemberListIterator fmli(*fmdl);
- MemberDef *fmd;
- for (fmli.toFirst();(fmd=fmli.current());++fmli)
+ int groupId=fmd->getMemberGroupId();
+ if (groupId!=-1)
{
- int groupId=fmd->getMemberGroupId();
- if (groupId!=-1)
+ auto it = Doxygen::memberGroupInfoMap.find(groupId);
+ if (it!=Doxygen::memberGroupInfoMap.end())
{
- auto it = Doxygen::memberGroupInfoMap.find(groupId);
- if (it!=Doxygen::memberGroupInfoMap.end())
+ auto &info = it->second;
+ auto mg_it = std::find_if(pMemberGroups->begin(),
+ pMemberGroups->end(),
+ [&groupId](const auto &g)
+ { return g->groupId()==groupId; }
+ );
+ MemberGroup *mg_ptr = 0;
+ if (mg_it==pMemberGroups->end())
{
- auto &info = it->second;
- auto mg_it = std::find_if(pMemberGroups->begin(),
- pMemberGroups->end(),
- [&groupId](const auto &g)
- { return g->groupId()==groupId; }
- );
- MemberGroup *mg_ptr = 0;
- if (mg_it==pMemberGroups->end())
- {
- auto mg = std::make_unique<MemberGroup>(
- context,
- groupId,
- info->header,
- info->doc,
- info->docFile,
- info->docLine);
- mg_ptr = mg.get();
- pMemberGroups->push_back(std::move(mg));
- }
- else
- {
- mg_ptr = (*mg_it).get();
- }
- mg_ptr->insertMember(fmd); // insert in member group
- fmd->setMemberGroup(mg_ptr);
+ auto mg = std::make_unique<MemberGroup>(
+ context,
+ groupId,
+ info->header,
+ info->doc,
+ info->docFile,
+ info->docLine);
+ mg_ptr = mg.get();
+ pMemberGroups->push_back(std::move(mg));
+ }
+ else
+ {
+ mg_ptr = (*mg_it).get();
+ }
+ mg_ptr->insertMember(fmd); // insert in member group
+ MemberDefMutable *fmdm = toMemberDefMutable(fmd);
+ if (fmdm)
+ {
+ fmdm->setMemberGroup(mg_ptr);
}
}
}
@@ -4382,14 +4382,22 @@ void addMembersToMemberGroup(MemberList *ml,
{
mg_ptr = (*mg_it).get();
}
- md = ml->take(index); // remove from member list
- mg_ptr->insertMember(md->resolveAlias()); // insert in member group
- mg_ptr->setRefItems(info->m_sli);
- md->setMemberGroup(mg_ptr);
- continue;
+ movedMembers.push_back(MoveMemberInfo(md,mg_ptr,info->m_sli));
}
}
- ++mli;++index;
+ }
+
+ // move the members to their group
+ for (const auto &mmi : movedMembers)
+ {
+ ml->remove(mmi.memberDef); // remove from member list
+ mmi.memberGroup->insertMember(mmi.memberDef->resolveAlias()); // insert in member group
+ mmi.memberGroup->setRefItems(mmi.sli);
+ MemberDefMutable *rmdm = toMemberDefMutable(mmi.memberDef);
+ if (rmdm)
+ {
+ rmdm->setMemberGroup(mmi.memberGroup);
+ }
}
}
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index 0f52356..59872f3 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -125,9 +125,9 @@ static void nextCodeLine(yyscan_t yyscanner);
static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class=0,bool classLink=false);
static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl=0,bool classlink=false,bool comment=false);
static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
- Definition *d,
+ const Definition *d,
const char *text);
-static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef* mdef);
+static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef* mdef);
static int countLines(yyscan_t yyscanner);
static void endFontClass(yyscan_t yyscanner);
static void startFontClass(yyscan_t yyscanner,const char *s);
@@ -1024,7 +1024,7 @@ static void startCodeLine(yyscan_t yyscanner)
{
//ClassDef *cf=VhdlDocGen::getClass(yyextra->tempComp.data());
QCString nn=yyextra->currentMemberDef->name();
- MemberDef* mdeff=VhdlDocGen::findMember(yyextra->tempComp,nn);
+ const MemberDef* mdeff=VhdlDocGen::findMember(yyextra->tempComp,nn);
if (mdeff)
{
yyextra->currentMemberDef=mdeff;
@@ -1224,7 +1224,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl,bool
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
- Definition *d,
+ const Definition *d,
const char *text)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
@@ -1263,7 +1263,7 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
/*! writes a link to a function or procedure
*/
-static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef* mdef)
+static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef* mdef)
{
//printf("generateFuncLink(FuncName=%s)\n",mdef->name().data());
QCString memberName=mdef->name();
@@ -1291,11 +1291,10 @@ static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString
QCString className=clName;
- MemberDef *md=0;
//MemberDef *comp=0;
//bool isLocal=false;
- md=VhdlDocGen::findMember(className,memberName);
+ const MemberDef *md=VhdlDocGen::findMember(className,memberName);
ClassDef *po=VhdlDocGen::getClass(className.data());
if (md==0 && po && (VhdlDocGen::VhdlClasses)po->protection()==VhdlDocGen::PACKBODYCLASS)
@@ -1504,7 +1503,7 @@ static void writeFuncProto(yyscan_t yyscanner)
{
temp.stripPrefix("_");// _{package body name}
}
- MemberDef *mdef=VhdlDocGen::findFunction(name,temp);
+ const MemberDef *mdef=VhdlDocGen::findFunction(name,temp);
if (mdef)
{
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index 7afc832..dcbbae0 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -456,19 +456,15 @@ static void writeClassToDot(FTextStream &t,ClassDef* cd)
static QList<MemberDef>* getPorts(ClassDef *cd)
{
- MemberDef* md;
- QList<MemberDef> *portList=new QList<MemberDef>;
MemberList *ml=cd->getMemberList(MemberListType_variableMembers);
if (ml==0)
{
- delete portList;
return 0;
}
- MemberListIterator fmni(*ml);
-
- for (fmni.toFirst();(md=fmni.current());++fmni)
+ QList<MemberDef> *portList=new QList<MemberDef>;
+ for (const auto &md : *ml)
{
if (md->getMemberSpecifiers()==VhdlDocGen::PORT)
{
@@ -642,14 +638,14 @@ ClassDef* VhdlDocGen::getPackageName(const QCString & name)
return getClass(name);
}
-static std::map<std::string,MemberDef*> g_varMap;
+static std::map<std::string,const MemberDef*> g_varMap;
static std::vector<ClassDef*> g_classList;
static std::map<ClassDef*,std::vector<ClassDef*> > g_packages;
-MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName)
+const MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName)
{
ClassDef* cd,*ecd=0;
- MemberDef *mdef=0;
+ const MemberDef *mdef=0;
cd=getClass(className);
//printf("VhdlDocGen::findMember(%s,%s)=%p\n",className.data(),memName.data(),cd);
@@ -746,37 +742,30 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
* This function returns the entity|package
* in which the key (type) is found
*/
-MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberListType type)
+const MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberListType type)
{
- MemberDef *md=0;
- MemberList *ml=0;
QCString keyType=cd->symbolName()+"@"+key;
//printf("\n %s | %s | %s",cd->symbolName().data(),key.data(,),keyType.data());
auto it = g_varMap.find(keyType.str());
if (it!=g_varMap.end())
{
- md=it->second;
- if (md)
- {
- return md;
- }
+ return it->second;
}
if (std::find(g_classList.begin(),g_classList.end(),cd)!=g_classList.end())
{
return 0;
}
- ml=cd->getMemberList(type);
+ const MemberList *ml=cd->getMemberList(type);
g_classList.push_back(cd);
if (!ml)
{
return 0;
}
- MemberListIterator fmni(*ml);
//int l=ml->count();
// fprintf(stderr,"\n loading entity %s %s: %d",cd->symbolName().data(),keyType.data(),l);
- for (fmni.toFirst();(md=fmni.current());++fmni)
+ for (const auto &md : *ml)
{
QCString tkey=cd->symbolName()+"@"+md->name();
if (g_varMap.find(tkey.str())==g_varMap.end())
@@ -787,11 +776,7 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
it=g_varMap.find(keyType.str());
if (it!=g_varMap.end())
{
- md=it->second;
- if (md)
- {
- return md;
- }
+ return it->second;
}
return 0;
}//findMemberDef
@@ -805,24 +790,22 @@ void VhdlDocGen::findAllPackages( ClassDef *cdef)
if (g_packages.find(cdef)!=g_packages.end()) return;
std::vector<ClassDef*> cList;
MemberList *mem=cdef->getMemberList(MemberListType_variableMembers);
- MemberDef *md;
-
- if (!mem) return;
-
- MemberListIterator fmni(*mem);
- for (fmni.toFirst();(md=fmni.current());++fmni)
+ if (mem)
{
- if (VhdlDocGen::isPackage(md))
+ for (const auto &md : *mem)
{
- ClassDef* cd=VhdlDocGen::getPackageName(md->name());
- if (cd)
+ if (VhdlDocGen::isPackage(md))
{
- cList.push_back(cd);
- VhdlDocGen::findAllPackages(cd);
- g_packages.insert({cdef,cList});
+ ClassDef* cd=VhdlDocGen::getPackageName(md->name());
+ if (cd)
+ {
+ cList.push_back(cd);
+ VhdlDocGen::findAllPackages(cd);
+ g_packages.insert({cdef,cList});
+ }
}
- }
- }//for
+ }//for
+ }
}// findAllPackages
@@ -831,18 +814,15 @@ void VhdlDocGen::findAllPackages( ClassDef *cdef)
* is called in vhdlcode.l
*/
-MemberDef* VhdlDocGen::findFunction(const QCString& funcname, const QCString& package)
+const MemberDef* VhdlDocGen::findFunction(const QCString& funcname, const QCString& package)
{
- MemberDef* mdef=0;
ClassDef *cdef=getClass(package.data());
if (cdef==0) return 0;
MemberList *mem=cdef->getMemberList(MemberListType_pubMethods);
-
if (mem)
{
- MemberListIterator fmni(*mem);
- for (fmni.toFirst();(mdef=fmni.current());++fmni)
+ for (const auto &mdef : *mem)
{
QCString mname=mdef->name();
if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (compareString(funcname,mname)==0))
@@ -1704,7 +1684,7 @@ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit
QCString nn=mdef->typeString();
nn=nn.stripWhiteSpace();
QCString na=cd->name();
- MemberDef* memdef=VhdlDocGen::findMember(na,nn);
+ const MemberDef* memdef=VhdlDocGen::findMember(na,nn);
if (memdef && memdef->isLinkable())
{
ol.docify(" ");
@@ -2126,9 +2106,7 @@ void VhdlDocGen::writePlainVHDLDeclarations(
StringSet pack;
bool first=TRUE;
- MemberDef *imd;
- MemberListIterator mli(*mlist);
- for ( ; (imd=mli.current()); ++mli )
+ for (const auto &imd : *mlist)
{
MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
@@ -2156,9 +2134,7 @@ void VhdlDocGen::writePlainVHDLDeclarations(
static bool membersHaveSpecificType(const MemberList *ml,uint64 type)
{
if (ml==0) return FALSE;
- MemberDef *mdd=0;
- MemberListIterator mmli(*ml);
- for ( ; (mdd=mmli.current()); ++mmli )
+ for (const auto &mdd : *ml)
{
if (mdd->getMemberSpecifiers()==type) //is type in class
{
@@ -2167,9 +2143,9 @@ static bool membersHaveSpecificType(const MemberList *ml,uint64 type)
}
for (const auto &mg : ml->getMemberGroupList())
{
- if (mg->members())
+ if (!mg->members().empty())
{
- if (membersHaveSpecificType(mg->members(),type)) return TRUE;
+ if (membersHaveSpecificType(&mg->members(),type)) return TRUE;
}
}
return FALSE;
@@ -2200,7 +2176,7 @@ void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol,
for (const auto &mg : ml->getMemberGroupList())
{
- if (membersHaveSpecificType(mg->members(),type))
+ if (membersHaveSpecificType(&mg->members(),type))
{
//printf("mg->header=%s\n",mg->header().data());
bool hasHeader=mg->header()!="[NOHEADER]";
@@ -2220,7 +2196,7 @@ void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol,
}
ol.startMemberGroup();
//printf("--- mg->writePlainDeclarations ---\n");
- VhdlDocGen::writePlainVHDLDeclarations(mg->members(),ol,cd,nd,fd,gd,type);
+ VhdlDocGen::writePlainVHDLDeclarations(&mg->members(),ol,cd,nd,fd,gd,type);
ol.endMemberGroup(hasHeader);
}
}
@@ -2252,7 +2228,7 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
if (cd)
{
QCString n=cd->name();
- MemberDef* memdef=VhdlDocGen::findMember(n,mem);
+ const MemberDef* memdef=VhdlDocGen::findMember(n,mem);
if (memdef && memdef->isLinkable())
{
ol.startBold();
diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h
index 22751c5..22e4a6f 100644
--- a/src/vhdldocgen.h
+++ b/src/vhdldocgen.h
@@ -133,14 +133,14 @@ class VhdlDocGen
static const char* findKeyWord(const QCString& word);
static ClassDef* getPackageName(const QCString& name);
- static MemberDef* findMember(const QCString& className,
+ static const MemberDef* findMember(const QCString& className,
const QCString& memName);
static void findAllPackages(ClassDef*);
- static MemberDef* findMemberDef(ClassDef* cd,
+ static const MemberDef* findMemberDef(ClassDef* cd,
const QCString& key,
MemberListType type);
static ClassDef *getClass(const char *name);
- static MemberDef* findFunction(const QCString& name,
+ static const MemberDef* findFunction(const QCString& name,
const QCString& package);
static QCString getClassTitle(const ClassDef*);
static void writeInlineClassLink(const ClassDef*,
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 70fcd70..57e63f0 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -838,16 +838,11 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream
<< memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
<< convertToXML(rmd->name()) << "</reimplements>" << endl;
}
- MemberList *rbml = md->reimplementedBy();
- if (rbml)
+ for (const auto &rbmd : md->reimplementedBy())
{
- MemberListIterator mli(*rbml);
- for (mli.toFirst();(rmd=mli.current());++mli)
- {
- t << " <reimplementedby refid=\""
- << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
- << convertToXML(rmd->name()) << "</reimplementedby>" << endl;
- }
+ t << " <reimplementedby refid=\""
+ << memberOutputFileBase(rbmd) << "_1" << rbmd->anchor() << "\">"
+ << convertToXML(rbmd->name()) << "</reimplementedby>" << endl;
}
if (md->isFriendClass()) // for friend classes we show a link to the class as a "parameter"
@@ -955,44 +950,38 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream
if (md->memberType()==MemberType_Enumeration) // enum
{
- const MemberList *enumFields = md->enumFieldList();
- if (enumFields)
+ for (const auto &emd : md->enumFieldList())
{
- MemberListIterator emli(*enumFields);
- const MemberDef *emd;
- for (emli.toFirst();(emd=emli.current());++emli)
- {
- ti << " <member refid=\"" << memberOutputFileBase(md)
- << "_1" << emd->anchor() << "\" kind=\"enumvalue\"><name>"
- << convertToXML(emd->name()) << "</name></member>" << endl;
+ ti << " <member refid=\"" << memberOutputFileBase(md)
+ << "_1" << emd->anchor() << "\" kind=\"enumvalue\"><name>"
+ << convertToXML(emd->name()) << "</name></member>" << endl;
- t << " <enumvalue id=\"" << memberOutputFileBase(md) << "_1"
- << emd->anchor() << "\" prot=\"";
- switch (emd->protection())
- {
- case Public: t << "public"; break;
- case Protected: t << "protected"; break;
- case Private: t << "private"; break;
- case Package: t << "package"; break;
- }
- t << "\">" << endl;
- t << " <name>";
- writeXMLString(t,emd->name());
- t << "</name>" << endl;
- if (!emd->initializer().isEmpty())
- {
- t << " <initializer>";
- writeXMLString(t,emd->initializer());
- t << "</initializer>" << endl;
- }
- t << " <briefdescription>" << endl;
- writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
- t << " </briefdescription>" << endl;
- t << " <detaileddescription>" << endl;
- writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
- t << " </detaileddescription>" << endl;
- t << " </enumvalue>" << endl;
+ t << " <enumvalue id=\"" << memberOutputFileBase(md) << "_1"
+ << emd->anchor() << "\" prot=\"";
+ switch (emd->protection())
+ {
+ case Public: t << "public"; break;
+ case Protected: t << "protected"; break;
+ case Private: t << "private"; break;
+ case Package: t << "package"; break;
+ }
+ t << "\">" << endl;
+ t << " <name>";
+ writeXMLString(t,emd->name());
+ t << "</name>" << endl;
+ if (!emd->initializer().isEmpty())
+ {
+ t << " <initializer>";
+ writeXMLString(t,emd->initializer());
+ t << "</initializer>" << endl;
}
+ t << " <briefdescription>" << endl;
+ writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
+ t << " </briefdescription>" << endl;
+ t << " <detaileddescription>" << endl;
+ writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
+ t << " </detaileddescription>" << endl;
+ t << " </enumvalue>" << endl;
}
}
t << " <briefdescription>" << endl;
@@ -1058,10 +1047,8 @@ static void generateXMLSection(const Definition *d,FTextStream &ti,FTextStream &
const char *documentation=0)
{
if (ml==0) return;
- MemberListIterator mli(*ml);
- const MemberDef *md;
int count=0;
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
if (memberVisible(d,md) && (md->memberType()!=MemberType_EnumValue) &&
!md->isHidden())
@@ -1082,7 +1069,7 @@ static void generateXMLSection(const Definition *d,FTextStream &ti,FTextStream &
writeXMLDocBlock(t,d->docFile(),d->docLine(),d,0,documentation);
t << "</description>" << endl;
}
- for (mli.toFirst();(md=mli.current());++mli)
+ for (const auto &md : *ml)
{
if (memberVisible(d,md))
{
@@ -1357,7 +1344,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti)
writeTemplateList(cd,t);
for (const auto &mg : cd->getMemberGroups())
{
- generateXMLSection(cd,ti,t,mg->members(),"user-defined",mg->header(),
+ generateXMLSection(cd,ti,t,&mg->members(),"user-defined",mg->header(),
mg->documentation());
}
@@ -1454,7 +1441,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti)
for (const auto &mg : nd->getMemberGroups())
{
- generateXMLSection(nd,ti,t,mg->members(),"user-defined",mg->header(),
+ generateXMLSection(nd,ti,t,&mg->members(),"user-defined",mg->header(),
mg->documentation());
}
@@ -1578,7 +1565,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti)
for (const auto &mg : fd->getMemberGroups())
{
- generateXMLSection(fd,ti,t,mg->members(),"user-defined",mg->header(),
+ generateXMLSection(fd,ti,t,&mg->members(),"user-defined",mg->header(),
mg->documentation());
}
@@ -1651,7 +1638,7 @@ static void generateXMLForGroup(const GroupDef *gd,FTextStream &ti)
for (const auto &mg : gd->getMemberGroups())
{
- generateXMLSection(gd,ti,t,mg->members(),"user-defined",mg->header(),
+ generateXMLSection(gd,ti,t,&mg->members(),"user-defined",mg->header(),
mg->documentation());
}