summaryrefslogtreecommitdiff
path: root/src/memberdef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/memberdef.cpp')
-rw-r--r--src/memberdef.cpp96
1 files changed, 25 insertions, 71 deletions
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index ecc07d7..8f09347 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -195,7 +195,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual void setEnumBaseType(const QCString &type);
virtual QCString enumBaseType() const;
virtual bool hasExamples() const;
- virtual ExampleSDict *getExamples() const;
+ virtual const ExampleList &getExamples() const;
virtual bool isPrototype() const;
virtual const ArgumentList &argumentList() const;
virtual ArgumentList &argumentList();
@@ -247,7 +247,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
virtual void setBitfields(const char *s);
virtual void setMaxInitLines(int lines);
virtual void setMemberClass(const ClassDef *cd);
- virtual void setSectionList(const Definition *container,MemberList *sl);
+ virtual void setSectionList(const Definition *container,const MemberList *sl);
virtual void setGroupDef(const GroupDef *gd,Grouping::GroupPri_t pri,
const QCString &fileName,int startLine,bool hasDocs,
MemberDef *member=0);
@@ -655,7 +655,7 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{ return getMdAlias()->enumBaseType(); }
virtual bool hasExamples() const
{ return getMdAlias()->hasExamples(); }
- virtual ExampleSDict *getExamples() const
+ virtual const ExampleList &getExamples() const
{ return getMdAlias()->getExamples(); }
virtual bool isPrototype() const
{ return getMdAlias()->isPrototype(); }
@@ -1198,7 +1198,7 @@ class MemberDefImpl::IMPL
MemberDef *memDec = 0; // member declaration for this definition
ClassDef *relatedAlso = 0; // points to class marked by relatedAlso
- ExampleSDict *exampleSDict = 0; // a dictionary of all examples for quick access
+ ExampleList examples; // a dictionary of all examples for quick access
QCString type; // return actual type
QCString accessorType; // return type that tell how to get to this member
@@ -1240,7 +1240,7 @@ class MemberDefImpl::IMPL
// as its type then this is computed by
// getClassDefOfAnonymousType() and
// cached here.
- SDict<MemberList> *classSectionSDict = 0; // not accessible
+ std::map<const Definition *,const MemberList *> sectionMap;
const MemberDef *groupAlias = 0; // Member containing the definition
int grpId = 0; // group id
@@ -1302,8 +1302,6 @@ class MemberDefImpl::IMPL
MemberDefImpl::IMPL::IMPL() :
enumFields(0),
redefinedBy(0),
- exampleSDict(0),
- classSectionSDict(0),
category(0),
categoryRelation(0),
declLine(-1),
@@ -1315,9 +1313,7 @@ MemberDefImpl::IMPL::IMPL() :
MemberDefImpl::IMPL::~IMPL()
{
delete redefinedBy;
- delete exampleSDict;
delete enumFields;
- delete classSectionSDict;
}
void MemberDefImpl::IMPL::init(Definition *d,
@@ -1338,7 +1334,6 @@ void MemberDefImpl::IMPL::init(Definition *d,
memDec=0;
group=0;
grpId=-1;
- exampleSDict=0;
enumFields=0;
enumScope=0;
livesInsideEnum=FALSE;
@@ -1391,7 +1386,6 @@ void MemberDefImpl::IMPL::init(Definition *d,
}
metaData = meta;
templateMaster = 0;
- classSectionSDict = 0;
docsForDefinition = TRUE;
isTypedefValCached = FALSE;
cachedTypedefValue = 0;
@@ -1462,9 +1456,7 @@ MemberDef *MemberDefImpl::deepCopy() const
*result->m_impl = *m_impl;
// clear pointers owned by object
result->m_impl->redefinedBy= 0;
- result->m_impl->exampleSDict=0;
result->m_impl->enumFields=0;
- result->m_impl->classSectionSDict=0;
// replace pointers owned by the object by deep copies
if (m_impl->redefinedBy)
{
@@ -1475,15 +1467,6 @@ MemberDef *MemberDefImpl::deepCopy() const
result->insertReimplementedBy(md);
}
}
- if (m_impl->exampleSDict)
- {
- ExampleSDict::Iterator it(*m_impl->exampleSDict);
- Example *e;
- for (it.toFirst();(e=it.current());++it)
- {
- result->addExample(e->anchor,e->name,e->file);
- }
- }
if (m_impl->enumFields)
{
MemberListIterator mli(*m_impl->enumFields);
@@ -1497,16 +1480,6 @@ MemberDef *MemberDefImpl::deepCopy() const
result->m_impl->tArgList = m_impl->tArgList;
result->m_impl->typeConstraints = m_impl->typeConstraints;
result->setDefinitionTemplateParameterLists(m_impl->defTmpArgLists);
- if (m_impl->classSectionSDict)
- {
- result->m_impl->classSectionSDict = new SDict<MemberList>(7);
- SDict<MemberList>::IteratorDict it(*m_impl->classSectionSDict);
- MemberList *ml;
- for (it.toFirst();(ml=it.current());++it)
- {
- result->m_impl->classSectionSDict->append(it.currentKey(),ml);
- }
- }
result->m_impl->declArgList = m_impl->declArgList;
return result;
}
@@ -1598,30 +1571,15 @@ void MemberDefImpl::insertEnumField(MemberDef *md)
m_impl->enumFields->append(md);
}
-bool MemberDefImpl::addExample(const char *anchor,const char *nameStr,
- const char *file)
+bool MemberDefImpl::addExample(const char *anchor,const char *nameStr, const char *file)
{
//printf("%s::addExample(%s,%s,%s)\n",name().data(),anchor,nameStr,file);
- if (m_impl->exampleSDict==0) m_impl->exampleSDict = new ExampleSDict;
- if (m_impl->exampleSDict->find(nameStr)==0)
- {
- //printf("Add reference to example %s to member %s\n",nameStr,name.data());
- Example *e=new Example;
- e->anchor=anchor;
- e->name=nameStr;
- e->file=file;
- m_impl->exampleSDict->inSort(nameStr,e);
- return TRUE;
- }
- return FALSE;
+ return m_impl->examples.inSort(Example(anchor,nameStr,file));
}
bool MemberDefImpl::hasExamples() const
{
- if (m_impl->exampleSDict==0)
- return FALSE;
- else
- return m_impl->exampleSDict->count()>0;
+ return !m_impl->examples.empty();
}
QCString MemberDefImpl::getOutputFileBase() const
@@ -2000,12 +1958,17 @@ bool MemberDefImpl::isBriefSectionVisible() const
// "", //getFileDef()->name().data(),
// argsString());
- MemberGroupInfo *info = Doxygen::memGrpInfoDict[m_impl->grpId];
- //printf("name=%s m_impl->grpId=%d info=%p\n",name().data(),m_impl->grpId,info);
- //QCString *pMemGrp = Doxygen::memberDocDict[grpId];
- bool hasDocs = hasDocumentation() ||
+ auto it = Doxygen::memberGroupInfoMap.find(m_impl->grpId);
+ bool hasDocs = hasDocumentation();
+ if (it!=Doxygen::memberGroupInfoMap.end())
+ {
+ auto &info = it->second;
+ //printf("name=%s m_impl->grpId=%d info=%p\n",name().data(),m_impl->grpId,info);
+ //QCString *pMemGrp = Doxygen::memberDocDict[grpId];
+ hasDocs = hasDocs ||
// part of a documented member group
- (m_impl->grpId!=-1 && info && !(info->doc.isEmpty() && info->header.isEmpty()));
+ (m_impl->grpId!=-1 && !(info->doc.isEmpty() && info->header.isEmpty()));
+ }
// only include static members with file/namespace scope if
// explicitly enabled in the config file
@@ -2996,7 +2959,7 @@ void MemberDefImpl::_writeExamples(OutputList &ol) const
{
ol.startExamples();
ol.startDescForItem();
- writeExample(ol,m_impl->exampleSDict);
+ writeExamples(ol,m_impl->examples);
ol.endDescForItem();
ol.endExamples();
}
@@ -4378,23 +4341,14 @@ void MemberDefImpl::addListReference(Definition *)
const MemberList *MemberDefImpl::getSectionList(const Definition *container) const
{
- const Definition *d = container;
- char key[20];
- sprintf(key,"%p",(void*)d);
- return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0;
+ auto it = m_impl->sectionMap.find(container);
+ return it!=m_impl->sectionMap.end() ? it->second : 0;
}
-void MemberDefImpl::setSectionList(const Definition *container,MemberList *sl)
+void MemberDefImpl::setSectionList(const Definition *container,const MemberList *sl)
{
//printf("MemberDefImpl::setSectionList(%s,%p) name=%s\n",d->name().data(),sl,name().data());
- const Definition *d= container;
- char key[20];
- sprintf(key,"%p",(void*)d);
- if (m_impl->classSectionSDict==0)
- {
- m_impl->classSectionSDict = new SDict<MemberList>(7);
- }
- m_impl->classSectionSDict->append(key,sl);
+ m_impl->sectionMap.insert(std::make_pair(container,sl));
}
Specifier MemberDefImpl::virtualness(int count) const
@@ -5348,9 +5302,9 @@ const MemberList *MemberDefImpl::enumFieldList() const
return m_impl->enumFields;
}
-ExampleSDict *MemberDefImpl::getExamples() const
+const ExampleList &MemberDefImpl::getExamples() const
{
- return m_impl->exampleSDict;
+ return m_impl->examples;
}
bool MemberDefImpl::isPrototype() const