Skip to content

Commit 9cb220d

Browse files
committed
issue #11624 Classes always ordered alphabetically
1 parent e7d5417 commit 9cb220d

File tree

9 files changed

+107
-66
lines changed

9 files changed

+107
-66
lines changed

src/classdef.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4611,14 +4611,17 @@ void ClassDefImpl::sortMemberLists()
46114611
{
46124612
if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); }
46134613
}
4614-
std::stable_sort(m_innerClasses.begin(),
4615-
m_innerClasses.end(),
4616-
[](const auto &c1,const auto &c2)
4617-
{
4618-
return Config_getBool(SORT_BY_SCOPE_NAME) ?
4619-
qstricmp_sort(c1->name(), c2->name() )<0 :
4620-
qstricmp_sort(c1->className(), c2->className())<0 ;
4621-
});
4614+
if (Config_getBool(SORT_BRIEF_DOCS))
4615+
{
4616+
std::stable_sort(m_innerClasses.begin(),
4617+
m_innerClasses.end(),
4618+
[](const auto &c1,const auto &c2)
4619+
{
4620+
return Config_getBool(SORT_BY_SCOPE_NAME) ?
4621+
qstricmp_sort(c1->name(), c2->name() )<0 :
4622+
qstricmp_sort(c1->className(), c2->className())<0 ;
4623+
});
4624+
}
46224625
}
46234626

46244627
int ClassDefImpl::countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom,

src/filedef.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,13 @@ void FileDefImpl::sortMemberLists()
17741774
std::stable_sort(m_structs.begin(), m_structs.end(), classComp);
17751775
std::stable_sort(m_exceptions.begin(),m_exceptions.end(),classComp);
17761776

1777+
auto conceptComp = [](const ConceptLinkedRefMap::Ptr &c1,const ConceptLinkedRefMap::Ptr &c2)
1778+
{
1779+
return qstricmp_sort(c1->name(),c2->name())<0;
1780+
};
1781+
1782+
std::stable_sort(m_concepts.begin(), m_concepts.end(), conceptComp);
1783+
17771784
auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
17781785
{
17791786
return qstricmp_sort(n1->name(),n2->name())<0;

src/groupdef.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,24 @@ void GroupDefImpl::sortMemberLists()
18671867
};
18681868

18691869
std::stable_sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp);
1870+
1871+
auto moduleComp = [](const ModuleLinkedRefMap::Ptr &m1,const ModuleLinkedRefMap::Ptr &m2)
1872+
{
1873+
return qstricmp_sort(m1->name(),m2->name())<0;
1874+
};
1875+
1876+
std::stable_sort(m_modules.begin(), m_modules.end(), moduleComp);
1877+
1878+
auto conceptComp = [](const ConceptLinkedRefMap::Ptr &c1,const ConceptLinkedRefMap::Ptr &c2)
1879+
{
1880+
return qstricmp_sort(c1->name(),c2->name())<0;
1881+
};
1882+
1883+
std::stable_sort(m_concepts.begin(), m_concepts.end(), conceptComp);
1884+
1885+
std::stable_sort(m_dirList.begin(), m_dirList.end(), compareDirDefs);
1886+
std::stable_sort(m_fileList.begin(), m_fileList.end(), compareFileDefs);
1887+
18701888
}
18711889
else
18721890
{
@@ -1917,10 +1935,13 @@ void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md)
19171935

19181936
void GroupDefImpl::sortSubGroups()
19191937
{
1920-
std::stable_sort(m_groups.begin(),
1921-
m_groups.end(),
1922-
[](const auto &g1,const auto &g2)
1923-
{ return g1->groupTitle() < g2->groupTitle(); });
1938+
if (Config_getBool(SORT_BRIEF_DOCS))
1939+
{
1940+
std::stable_sort(m_groups.begin(),
1941+
m_groups.end(),
1942+
[](const auto &g1,const auto &g2)
1943+
{ return g1->groupTitle() < g2->groupTitle(); });
1944+
}
19241945
}
19251946

19261947
static bool hasNonReferenceNestedGroupRec(const GroupDef *gd,int level)

src/namespacedef.cpp

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable>
108108
const MemberLists &getMemberLists() const override { return m_memberLists; }
109109
const MemberDef *getMemberByName(const QCString &) const override;
110110
const MemberGroupList &getMemberGroups() const override { return m_memberGroups; }
111-
ClassLinkedRefMap getClasses() const override { return classes; }
112-
ClassLinkedRefMap getInterfaces() const override { return interfaces; }
113-
ClassLinkedRefMap getStructs() const override { return structs; }
114-
ClassLinkedRefMap getExceptions() const override { return exceptions; }
115-
NamespaceLinkedRefMap getNamespaces() const override { return namespaces; }
111+
ClassLinkedRefMap getClasses() const override { return m_classes; }
112+
ClassLinkedRefMap getInterfaces() const override { return m_interfaces; }
113+
ClassLinkedRefMap getStructs() const override { return m_structs; }
114+
ClassLinkedRefMap getExceptions() const override { return m_exceptions; }
115+
NamespaceLinkedRefMap getNamespaces() const override { return m_namespaces; }
116116
ConceptLinkedRefMap getConcepts() const override { return m_concepts; }
117117
void setName(const QCString &name) override;
118118

@@ -158,12 +158,12 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable>
158158
MemberLinkedRefMap m_allMembers;
159159
MemberLists m_memberLists;
160160
MemberGroupList m_memberGroups;
161-
ClassLinkedRefMap classes;
162-
ClassLinkedRefMap interfaces;
163-
ClassLinkedRefMap structs;
164-
ClassLinkedRefMap exceptions;
161+
ClassLinkedRefMap m_classes;
162+
ClassLinkedRefMap m_interfaces;
163+
ClassLinkedRefMap m_structs;
164+
ClassLinkedRefMap m_exceptions;
165165
ConceptLinkedRefMap m_concepts;
166-
NamespaceLinkedRefMap namespaces;
166+
NamespaceLinkedRefMap m_namespaces;
167167
bool m_subGrouping = false;
168168
enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type;
169169
bool m_isPublished = false;
@@ -409,21 +409,21 @@ void NamespaceDefImpl::addInnerCompound(Definition *d)
409409

410410
void NamespaceDefImpl::insertClass(ClassDef *cd)
411411
{
412-
ClassLinkedRefMap *d = &classes;
412+
ClassLinkedRefMap *d = &m_classes;
413413

414414
if (Config_getBool(OPTIMIZE_OUTPUT_SLICE))
415415
{
416416
if (cd->compoundType()==ClassDef::Interface)
417417
{
418-
d = &interfaces;
418+
d = &m_interfaces;
419419
}
420420
else if (cd->compoundType()==ClassDef::Struct)
421421
{
422-
d = &structs;
422+
d = &m_structs;
423423
}
424424
else if (cd->compoundType()==ClassDef::Exception)
425425
{
426-
d = &exceptions;
426+
d = &m_exceptions;
427427
}
428428
}
429429

@@ -437,7 +437,7 @@ void NamespaceDefImpl::insertConcept(ConceptDef *cd)
437437

438438
void NamespaceDefImpl::insertNamespace(NamespaceDef *nd)
439439
{
440-
namespaces.add(nd->name(),nd);
440+
m_namespaces.add(nd->name(),nd);
441441
}
442442

443443

@@ -617,7 +617,7 @@ void NamespaceDefImpl::writeTagFile(TextStream &tagFile)
617617
{
618618
case LayoutDocEntry::NamespaceNestedNamespaces:
619619
{
620-
for (const auto &nd : namespaces)
620+
for (const auto &nd : m_namespaces)
621621
{
622622
if (nd->isLinkableInProject())
623623
{
@@ -628,22 +628,22 @@ void NamespaceDefImpl::writeTagFile(TextStream &tagFile)
628628
break;
629629
case LayoutDocEntry::NamespaceClasses:
630630
{
631-
writeClassesToTagFile(tagFile, classes);
631+
writeClassesToTagFile(tagFile, m_classes);
632632
}
633633
break;
634634
case LayoutDocEntry::NamespaceInterfaces:
635635
{
636-
writeClassesToTagFile(tagFile, interfaces);
636+
writeClassesToTagFile(tagFile, m_interfaces);
637637
}
638638
break;
639639
case LayoutDocEntry::NamespaceStructs:
640640
{
641-
writeClassesToTagFile(tagFile, structs);
641+
writeClassesToTagFile(tagFile, m_structs);
642642
}
643643
break;
644644
case LayoutDocEntry::NamespaceExceptions:
645645
{
646-
writeClassesToTagFile(tagFile, exceptions);
646+
writeClassesToTagFile(tagFile, m_exceptions);
647647
}
648648
break;
649649
case LayoutDocEntry::NamespaceConcepts:
@@ -817,13 +817,13 @@ void NamespaceDefImpl::writeConcepts(OutputList &ol,const QCString &title)
817817

818818
void NamespaceDefImpl::writeInlineClasses(OutputList &ol)
819819
{
820-
classes.writeDocumentation(ol,this);
820+
m_classes.writeDocumentation(ol,this);
821821
}
822822

823823
void NamespaceDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title,
824824
bool const isConstantGroup)
825825
{
826-
namespaces.writeDeclaration(ol,title,isConstantGroup,TRUE);
826+
m_namespaces.writeDeclaration(ol,title,isConstantGroup,TRUE);
827827
}
828828

829829
void NamespaceDefImpl::writeMemberGroups(OutputList &ol)
@@ -859,37 +859,37 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const
859859
for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace))
860860
{
861861
const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
862-
if (lde->kind()==LayoutDocEntry::NamespaceClasses && classes.declVisible() && ls)
862+
if (lde->kind()==LayoutDocEntry::NamespaceClasses && m_classes.declVisible() && ls)
863863
{
864864
QCString label = "nested-classes";
865865
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
866866
first=FALSE;
867867
}
868-
else if (lde->kind()==LayoutDocEntry::NamespaceInterfaces && interfaces.declVisible() && ls)
868+
else if (lde->kind()==LayoutDocEntry::NamespaceInterfaces && m_interfaces.declVisible() && ls)
869869
{
870870
QCString label = "interfaces";
871871
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
872872
first=FALSE;
873873
}
874-
else if (lde->kind()==LayoutDocEntry::NamespaceStructs && structs.declVisible() && ls)
874+
else if (lde->kind()==LayoutDocEntry::NamespaceStructs && m_structs.declVisible() && ls)
875875
{
876876
QCString label = "structs";
877877
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
878878
first=FALSE;
879879
}
880-
else if (lde->kind()==LayoutDocEntry::NamespaceExceptions && exceptions.declVisible() && ls)
880+
else if (lde->kind()==LayoutDocEntry::NamespaceExceptions && m_exceptions.declVisible() && ls)
881881
{
882882
QCString label = "exceptions";
883883
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
884884
first=FALSE;
885885
}
886-
else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible(false) && ls)
886+
else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && m_namespaces.declVisible(false) && ls)
887887
{
888888
QCString label = "namespaces";
889889
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
890890
first=FALSE;
891891
}
892-
else if (lde->kind()==LayoutDocEntry::NamespaceNestedConstantGroups && namespaces.declVisible(true) && ls)
892+
else if (lde->kind()==LayoutDocEntry::NamespaceNestedConstantGroups && m_namespaces.declVisible(true) && ls)
893893
{
894894
QCString label = "constantgroups";
895895
ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
@@ -1014,22 +1014,22 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol)
10141014
break;
10151015
case LayoutDocEntry::NamespaceClasses:
10161016
{
1017-
if (ls) writeClassDeclarations(ol,ls->title(lang),classes);
1017+
if (ls) writeClassDeclarations(ol,ls->title(lang),m_classes);
10181018
}
10191019
break;
10201020
case LayoutDocEntry::NamespaceInterfaces:
10211021
{
1022-
if (ls) writeClassDeclarations(ol,ls->title(lang),interfaces);
1022+
if (ls) writeClassDeclarations(ol,ls->title(lang),m_interfaces);
10231023
}
10241024
break;
10251025
case LayoutDocEntry::NamespaceStructs:
10261026
{
1027-
if (ls) writeClassDeclarations(ol,ls->title(lang),structs);
1027+
if (ls) writeClassDeclarations(ol,ls->title(lang),m_structs);
10281028
}
10291029
break;
10301030
case LayoutDocEntry::NamespaceExceptions:
10311031
{
1032-
if (ls) writeClassDeclarations(ol,ls->title(lang),exceptions);
1032+
if (ls) writeClassDeclarations(ol,ls->title(lang),m_exceptions);
10331033
}
10341034
break;
10351035
case LayoutDocEntry::NamespaceConcepts:
@@ -1453,25 +1453,35 @@ void NamespaceDefImpl::sortMemberLists()
14531453
if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); }
14541454
}
14551455

1456-
auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2)
1456+
if (Config_getBool(SORT_BRIEF_DOCS))
14571457
{
1458-
return Config_getBool(SORT_BY_SCOPE_NAME) ?
1459-
qstricmp_sort(c1->name(), c2->name())<0 :
1460-
qstricmp_sort(c1->className(), c2->className())<0;
1461-
};
1458+
auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2)
1459+
{
1460+
return Config_getBool(SORT_BY_SCOPE_NAME) ?
1461+
qstricmp_sort(c1->name(), c2->name())<0 :
1462+
qstricmp_sort(c1->className(), c2->className())<0;
1463+
};
14621464

1463-
std::stable_sort(classes.begin(), classes.end(), classComp);
1464-
std::stable_sort(interfaces.begin(),interfaces.end(),classComp);
1465-
std::stable_sort(structs.begin(), structs.end(), classComp);
1466-
std::stable_sort(exceptions.begin(),exceptions.end(),classComp);
1465+
std::stable_sort(m_classes.begin(), m_classes.end(), classComp);
1466+
std::stable_sort(m_interfaces.begin(),m_interfaces.end(),classComp);
1467+
std::stable_sort(m_structs.begin(), m_structs.end(), classComp);
1468+
std::stable_sort(m_exceptions.begin(),m_exceptions.end(),classComp);
14671469

1470+
auto conceptComp = [](const ConceptLinkedRefMap::Ptr &c1,const ConceptLinkedRefMap::Ptr &c2)
1471+
{
1472+
return qstricmp_sort(c1->name(),c2->name())<0;
1473+
};
14681474

1469-
auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
1470-
{
1471-
return qstricmp_sort(n1->name(),n2->name())<0;
1472-
};
1475+
std::stable_sort(m_concepts.begin(), m_concepts.end(), conceptComp);
1476+
1477+
auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
1478+
{
1479+
return qstricmp_sort(n1->name(),n2->name())<0;
1480+
};
1481+
1482+
std::stable_sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp);
1483+
}
14731484

1474-
std::stable_sort(namespaces.begin(),namespaces.end(),namespaceComp);
14751485
}
14761486

14771487
MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const

testing/057/namespacelibrary.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<compounddef id="namespacelibrary" kind="namespace" language="C++">
44
<compoundname>library</compoundname>
55
<innerclass refid="classlibrary_1_1v2_1_1foo" prot="public">library::foo</innerclass>
6-
<innernamespace refid="namespacelibrary_1_1v2_1_1_n_s">library::NS</innernamespace>
76
<innernamespace refid="namespacelibrary_1_1v1">library::v1</innernamespace>
87
<innernamespace refid="namespacelibrary_1_1v2" inline="yes">library::v2</innernamespace>
8+
<innernamespace refid="namespacelibrary_1_1v2_1_1_n_s">library::NS</innernamespace>
99
<sectiondef kind="func">
1010
<memberdef kind="function" id="namespacelibrary_1_1v2_1aba9375172f5b36e1f4fda9b1dec39d90" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
1111
<type>void</type>

testing/090/namespacemymodule.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
33
<compounddef id="namespacemymodule" kind="namespace" language="Fortran">
44
<compoundname>mymodule</compoundname>
5-
<innerclass refid="interfacemymodule_1_1abstractproc" prot="public">mymodule::abstractproc</innerclass>
65
<innerclass refid="interfacemymodule_1_1externalproc" prot="public">mymodule::externalproc</innerclass>
76
<innerclass refid="interfacemymodule_1_1genericproc" prot="public">mymodule::genericproc</innerclass>
7+
<innerclass refid="interfacemymodule_1_1abstractproc" prot="public">mymodule::abstractproc</innerclass>
88
<innerclass refid="interfacemymodule_1_1operator_07_8cross_8_08" prot="private">mymodule::operator(.cross.)</innerclass>
99
<innerclass refid="interfacemymodule_1_1operator_07_2_2_08" prot="private">mymodule::operator(//)</innerclass>
1010
<sectiondef kind="func">

testing/092/namespacestrings.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
33
<compounddef id="namespacestrings" kind="namespace" language="Fortran">
44
<compoundname>strings</compoundname>
5+
<innerclass refid="structstrings_1_1string" prot="public">strings::string</innerclass>
56
<innerclass refid="interfacestrings_1_1append" prot="public">strings::append</innerclass>
67
<innerclass refid="interfacestrings_1_1appendifunique" prot="public">strings::appendifunique</innerclass>
78
<innerclass refid="interfacestrings_1_1find" prot="public">strings::find</innerclass>
9+
<innerclass refid="interfacestrings_1_1operator_07_0a_0a_08" prot="public">strings::operator(==)</innerclass>
810
<innerclass refid="interfacestrings_1_1grow" prot="public">strings::grow</innerclass>
911
<innerclass refid="interfacestrings_1_1join" prot="public">strings::join</innerclass>
10-
<innerclass refid="interfacestrings_1_1len" prot="public">strings::len</innerclass>
11-
<innerclass refid="interfacestrings_1_1operator_07_0a_0a_08" prot="public">strings::operator(==)</innerclass>
1212
<innerclass refid="interfacestrings_1_1pack" prot="public">strings::pack</innerclass>
13-
<innerclass refid="interfacestrings_1_1push" prot="private">strings::push</innerclass>
1413
<innerclass refid="interfacestrings_1_1replace" prot="public">strings::replace</innerclass>
1514
<innerclass refid="interfacestrings_1_1shrink" prot="public">strings::shrink</innerclass>
16-
<innerclass refid="structstrings_1_1string" prot="public">strings::string</innerclass>
15+
<innerclass refid="interfacestrings_1_1push" prot="private">strings::push</innerclass>
16+
<innerclass refid="interfacestrings_1_1len" prot="public">strings::len</innerclass>
1717
<sectiondef kind="var">
1818
<memberdef kind="variable" id="namespacestrings_1a45584f6a9f6f13e5370bd883d744f0a6" prot="private" static="no" mutable="no">
1919
<type>integer, parameter</type>

testing/096/namespacem3.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
33
<compounddef id="namespacem3" kind="namespace" language="C++">
44
<compoundname>m3</compoundname>
5-
<innerclass refid="structm3_1_1t1" prot="public">m3::t1</innerclass>
65
<innerclass refid="structm3_1_1t4" prot="public">m3::t4</innerclass>
6+
<innerclass refid="structm3_1_1t1" prot="public">m3::t1</innerclass>
77
<briefdescription>
88
</briefdescription>
99
<detaileddescription>

testing/105/namespaceitpp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
33
<compounddef id="namespaceitpp" kind="namespace" language="C++">
44
<compoundname>itpp</compoundname>
5-
<innerclass refid="classitpp_1_1_c_fix" prot="public">itpp::CFix</innerclass>
65
<innerclass refid="classitpp_1_1_vec" prot="public">itpp::Vec</innerclass>
6+
<innerclass refid="classitpp_1_1_c_fix" prot="public">itpp::CFix</innerclass>
77
<sectiondef kind="typedef">
88
<memberdef kind="typedef" id="namespaceitpp_1a057e78df9719352a7a2ae36c0e190982" prot="public" static="no">
99
<type><ref refid="classitpp_1_1_vec" kindref="compound">Vec</ref>&lt; <ref refid="classitpp_1_1_c_fix" kindref="compound">CFix</ref> &gt;</type>

0 commit comments

Comments
 (0)