summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-01-06 18:04:25 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-01-22 20:45:18 (GMT)
commit9ae55baa95f886d9abde07bb6d5ac425b1efb566 (patch)
treebdd60e11566c5f94e3f77badc8a0ff92af123ccb /src
parent09edc28292f90497c9f9282691fdaccd478eb405 (diff)
downloadDoxygen-9ae55baa95f886d9abde07bb6d5ac425b1efb566.zip
Doxygen-9ae55baa95f886d9abde07bb6d5ac425b1efb566.tar.gz
Doxygen-9ae55baa95f886d9abde07bb6d5ac425b1efb566.tar.bz2
Refactoring: modernize overloadTotalDict and overloadCountDict
Diffstat (limited to 'src')
-rw-r--r--src/memberlist.cpp64
1 files changed, 26 insertions, 38 deletions
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index c71390c..1be1ec7 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -766,26 +766,20 @@ void MemberList::writeDocumentation(OutputList &ol,
MemberListIterator mli(*this);
const MemberDef *md;
+ struct OverloadInfo
+ {
+ uint count = 1;
+ uint total = 0;
+ };
+ std::unordered_map<std::string,OverloadInfo> overloadInfo;
// count the number of overloaded members
- QDict<uint> overloadTotalDict(67);
- QDict<uint> overloadCountDict(67);
- overloadTotalDict.setAutoDelete(TRUE);
- overloadCountDict.setAutoDelete(TRUE);
for (mli.toFirst() ; (md=mli.current()) ; ++mli)
{
if (md->isDetailedSectionVisible(m_inGroup,container->definitionType()==Definition::TypeFile) &&
!(md->isEnumValue() && !showInline))
{
- uint *pCount = overloadTotalDict.find(md->name());
- if (pCount)
- {
- (*pCount)++;
- }
- else
- {
- overloadTotalDict.insert(md->name(),new uint(1));
- overloadCountDict.insert(md->name(),new uint(1));
- }
+ auto it = overloadInfo.insert(std::make_pair(md->name(),OverloadInfo())).first;
+ it->second.total++;
}
}
@@ -794,14 +788,14 @@ void MemberList::writeDocumentation(OutputList &ol,
if (md->isDetailedSectionVisible(m_inGroup,container->definitionType()==Definition::TypeFile) &&
!(md->isEnumValue() && !showInline))
{
- uint overloadCount = *overloadTotalDict.find(md->name());
- uint *pCount = overloadCountDict.find(md->name());
+ auto it = overloadInfo.find(md->name().str());
+ uint overloadCount = it->second.total;
+ uint &count = it->second.count;
MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
- mdm->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container,
+ mdm->writeDocumentation(this,count++,overloadCount,ol,scopeName,container,
m_inGroup,showEnumValues,showInline);
- (*pCount)++;
}
}
}
@@ -845,11 +839,14 @@ void MemberList::writeDocumentationPage(OutputList &ol,
{
static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
+ struct OverloadInfo
+ {
+ uint count = 1;
+ uint total = 0;
+ };
+ std::unordered_map<std::string,OverloadInfo> overloadInfo;
+
// count the number of overloaded members
- QDict<uint> overloadTotalDict(67);
- QDict<uint> overloadCountDict(67);
- overloadTotalDict.setAutoDelete(TRUE);
- overloadCountDict.setAutoDelete(TRUE);
MemberListIterator mli(*this);
const MemberDef *imd;
for (mli.toFirst() ; (imd=mli.current()) ; ++mli)
@@ -858,16 +855,8 @@ void MemberList::writeDocumentationPage(OutputList &ol,
if (md->isDetailedSectionLinkable())
{
- uint *pCount = overloadTotalDict.find(md->name());
- if (pCount)
- {
- (*pCount)++;
- }
- else
- {
- overloadTotalDict.insert(md->name(),new uint(1));
- overloadCountDict.insert(md->name(),new uint(1));
- }
+ auto it = overloadInfo.insert(std::make_pair(md->name(),OverloadInfo())).first;
+ it->second.total++;
}
}
@@ -877,8 +866,9 @@ void MemberList::writeDocumentationPage(OutputList &ol,
MemberDefMutable *md = toMemberDefMutable(imd);
if (md->isDetailedSectionLinkable())
{
- uint overloadCount = *overloadTotalDict.find(md->name());
- uint *pCount = overloadCountDict.find(md->name());
+ auto it = overloadInfo.find(md->name().str());
+ uint overloadCount = it->second.total;
+ uint &count = it->second.count;
QCString diskName=md->getOutputFileBase();
QCString title=md->qualifiedName();
startFile(ol,diskName,md->name(),title,HLI_None,!generateTreeView,diskName);
@@ -891,8 +881,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
if (generateTreeView)
{
- md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container_d,m_inGroup);
- (*pCount)++;
+ md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_inGroup);
ol.endContents();
endFileWithNavPath(container_d,ol);
@@ -908,8 +897,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
ol.writeString(" </td>\n");
ol.writeString(" <td valign=\"top\" class=\"mempage\">\n");
- md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container_d,m_inGroup);
- (*pCount)++;
+ md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_inGroup);
ol.writeString(" </td>\n");
ol.writeString(" </tr>\n");