20#include <QtCore/qobjectdefs.h>
24QList<Section> Sections::s_stdSummarySections {
25 {
"Namespaces",
"namespace",
"namespaces",
"", Section::Summary },
26 {
"Classes",
"class",
"classes",
"", Section::Summary },
27 {
"Types",
"type",
"types",
"", Section::Summary },
28 {
"Variables",
"variable",
"variables",
"", Section::Summary },
29 {
"Static Variables",
"static variable",
"static variables",
"", Section::Summary },
30 {
"Functions",
"function",
"functions",
"", Section::Summary },
31 {
"Macros",
"macro",
"macros",
"", Section::Summary },
34QList<Section>
Sections::s_stdDetailsSections {
35 {
"Namespaces",
"namespace",
"namespaces",
"nmspace", Section::Details },
36 {
"Classes",
"class",
"classes",
"classes", Section::Details },
37 {
"Type Documentation",
"type",
"types",
"types", Section::Details },
38 {
"Variable Documentation",
"variable",
"variables",
"vars", Section::Details },
39 {
"Static Variables",
"static variable",
"static variables", QString(), Section::Details },
40 {
"Function Documentation",
"function",
"functions",
"func", Section::Details },
41 {
"Macro Documentation",
"macro",
"macros",
"macros", Section::Details },
44QList<Section>
Sections::s_stdCppClassSummarySections {
45 {
"Public Types",
"public type",
"public types",
"", Section::Summary },
46 {
"Properties",
"property",
"properties",
"", Section::Summary },
47 {
"Public Functions",
"public function",
"public functions",
"", Section::Summary },
48 {
"Public Slots",
"public slot",
"public slots",
"", Section::Summary },
49 {
"Signals",
"signal",
"signals",
"", Section::Summary },
50 {
"Public Variables",
"public variable",
"public variables",
"", Section::Summary },
51 {
"Static Public Members",
"static public member",
"static public members",
"", Section::Summary },
52 {
"Protected Types",
"protected type",
"protected types",
"", Section::Summary },
53 {
"Protected Functions",
"protected function",
"protected functions",
"", Section::Summary },
54 {
"Protected Slots",
"protected slot",
"protected slots",
"", Section::Summary },
55 {
"Protected Variables",
"protected type",
"protected variables",
"", Section::Summary },
56 {
"Static Protected Members",
"static protected member",
"static protected members",
"", Section::Summary },
57 {
"Private Types",
"private type",
"private types",
"", Section::Summary },
58 {
"Private Functions",
"private function",
"private functions",
"", Section::Summary },
59 {
"Private Slots",
"private slot",
"private slots",
"", Section::Summary },
60 {
"Static Private Members",
"static private member",
"static private members",
"", Section::Summary },
61 {
"Related Non-Members",
"related non-member",
"related non-members",
"", Section::Summary },
62 {
"Macros",
"macro",
"macros",
"", Section::Summary },
65QList<Section>
Sections::s_stdCppClassDetailsSections {
66 {
"Member Type Documentation",
"member",
"members",
"types", Section::Details },
67 {
"Property Documentation",
"member",
"members",
"prop", Section::Details },
68 {
"Member Function Documentation",
"member",
"members",
"func", Section::Details },
69 {
"Member Variable Documentation",
"member",
"members",
"vars", Section::Details },
70 {
"Related Non-Members",
"member",
"members",
"relnonmem", Section::Details },
71 {
"Macro Documentation",
"member",
"members",
"macros", Section::Details },
74QList<Section>
Sections::s_stdQmlTypeSummarySections {
75 {
"Properties",
"property",
"properties",
"", Section::Summary },
76 {
"Attached Properties",
"attached property",
"attached properties",
"", Section::Summary },
77 {
"Signals",
"signal",
"signals",
"", Section::Summary },
78 {
"Signal Handlers",
"signal handler",
"signal handlers",
"", Section::Summary },
79 {
"Attached Signals",
"attached signal",
"attached signals",
"", Section::Summary },
80 {
"Methods",
"method",
"methods",
"", Section::Summary },
81 {
"Attached Methods",
"attached method",
"attached methods",
"", Section::Summary },
84QList<Section>
Sections::s_stdQmlTypeDetailsSections {
85 {
"Property Documentation",
"member",
"members",
"qmlprop", Section::Details },
86 {
"Attached Property Documentation",
"member",
"members",
"qmlattprop", Section::Details },
87 {
"Signal Documentation",
"signal",
"signals",
"qmlsig", Section::Details },
88 {
"Signal Handler Documentation",
"signal handler",
"signal handlers",
"qmlsighan", Section::Details },
89 {
"Attached Signal Documentation",
"signal",
"signals",
"qmlattsig", Section::Details },
90 {
"Method Documentation",
"member",
"members",
"qmlmeth", Section::Details },
91 {
"Attached Method Documentation",
"member",
"members",
"qmlattmeth", Section::Details },
94QList<Section>
Sections::s_sinceSections {
95 {
"New Namespaces",
"",
"",
"", Section::Details },
96 {
"New Classes",
"",
"",
"", Section::Details },
97 {
"New Member Functions",
"",
"",
"", Section::Details },
98 {
"New Functions in Namespaces",
"",
"",
"", Section::Details },
99 {
"New Global Functions",
"",
"",
"", Section::Details },
100 {
"New Macros",
"",
"",
"", Section::Details },
101 {
"New Enum Types",
"",
"",
"", Section::Details },
102 {
"New Enum Values",
"",
"",
"", Section::Details },
103 {
"New Type Aliases",
"",
"",
"", Section::Details },
104 {
"New Properties",
"",
"",
"", Section::Details },
105 {
"New Variables",
"",
"",
"", Section::Details },
106 {
"New QML Types",
"",
"",
"", Section::Details },
107 {
"New QML Properties",
"",
"",
"", Section::Details },
108 {
"New QML Signals",
"",
"",
"", Section::Details },
109 {
"New QML Signal Handlers",
"",
"",
"", Section::Details },
110 {
"New QML Methods",
"",
"",
"", Section::Details },
113QList<Section>
Sections::s_allMembers{ {
"",
"member",
"members",
"", Section::AllMembers } };
116
117
118
121
122
123
130
131
132
133
134
137 m_reimplementedMemberMap.clear();
139 m_obsoleteMembers.clear();
140 m_reimplementedMembers.clear();
141 m_inheritedMembers.clear();
142 m_classNodesList.clear();
143 m_aggregate =
nullptr;
147
148
149
152 QString nodeName{node->name()};
155 for (qsizetype i = nodeName.size() - 1; i > 0; --i) {
156 if (nodeName.at(i).digitValue() == -1)
163 for (
int i = 0; i < 4 - numDigits; ++i)
164 nodeName.insert(nodeName.size() - numDigits - 1, QLatin1Char(
'0'));
168 return QLatin1Char(
'A') + nodeName;
171 const auto *fn =
static_cast<
const FunctionNode *>(node);
175 sortNo = QLatin1String(
"C");
177 sortNo = QLatin1String(
"D");
179 sortNo = QLatin1String(
"E");
181 sortNo = QLatin1String(
"F");
182 else if (nodeName.startsWith(QLatin1String(
"operator")) && nodeName.size() > 8
183 && !nodeName[8].isLetterOrNumber())
184 sortNo = QLatin1String(
"H");
186 sortNo = QLatin1String(
"G");
188 return sortNo + nodeName + QLatin1Char(
' ') + QString::number(fn->overloadNumber(), 36);
191 if (node->isFunction(Node::QML))
192 return QLatin1Char(
'E') + nodeName + QLatin1Char(
' ') +
193 QString::number(
static_cast<
const FunctionNode*>(node)->overloadNumber(), 36);
196 return QLatin1Char(
'G') + nodeName;
198 return QLatin1Char(
'B') + nodeName;
202
203
204
207 bool irrelevant =
false;
208 bool inherited =
false;
224 irrelevant = (inherited && m_style !=
AllMembers);
226 const auto *tdn =
static_cast<
const TypedefNode *>(node);
233 QString key = sortName(node);
235 m_obsoleteMembers.push_back(node);
238 m_members.push_back(node);
241 if (m_inheritedMembers.isEmpty()
242 || m_inheritedMembers.last().first != node->parent()) {
244 m_inheritedMembers.append(p);
246 m_inheritedMembers.last().second++;
253
254
255
256
257
258
259
263 const auto *fn =
static_cast<
const FunctionNode *>(node);
264 if (!fn->overridesThis().isEmpty()) {
266 QString key = sortName(fn);
267 if (!m_reimplementedMemberMap.contains(key)) {
268 m_reimplementedMemberMap.insert(key, node);
278
279
280
317 static auto node_less_than = [](
const Node* left,
const Node* right) {
318 return sortName(left) < sortName(right);
321 std::stable_sort(m_members.begin(), m_members.end(), node_less_than);
322 std::stable_sort(m_obsoleteMembers.begin(), m_obsoleteMembers.end(), node_less_than);
324 m_reimplementedMembers = m_reimplementedMemberMap.values().toVector();
326 for (
auto &cn : m_classNodesList) {
327 std::stable_sort(cn.second.begin(), cn.second.end(), node_less_than);
332
333
334
335
336
337
338
341
342
343
346 initAggregate(s_allMembers, m_aggregate);
351 initAggregate(s_stdCppClassSummarySections, m_aggregate);
352 initAggregate(s_stdCppClassDetailsSections, m_aggregate);
357 initAggregate(s_stdQmlTypeSummarySections, m_aggregate);
358 initAggregate(s_stdQmlTypeDetailsSections, m_aggregate);
365 initAggregate(s_stdSummarySections, m_aggregate);
366 initAggregate(s_stdDetailsSections, m_aggregate);
373
374
375
381 for (
auto it = nsmap.constBegin(); it != nsmap.constEnd(); ++it) {
382 Node *node = it.value();
385 sections[SinceQmlTypes].appendMember(node);
387 case Node::Namespace:
388 sections[SinceNamespaces].appendMember(node);
393 sections[SinceClasses].appendMember(node);
399 if (!it.key().isEmpty())
400 sections[SinceEnumTypes].appendMember(node);
402 sections[SinceEnumValues].appendMember(node);
406 case Node::TypeAlias:
407 sections[SinceTypeAliases].appendMember(node);
410 const auto *fn =
static_cast<
const FunctionNode *>(node);
411 switch (fn->metaness()) {
412 case FunctionNode::QmlSignal:
413 sections[SinceQmlSignals].appendMember(node);
415 case FunctionNode::QmlSignalHandler:
416 sections[SinceQmlSignalHandlers].appendMember(node);
418 case FunctionNode::QmlMethod:
419 sections[SinceQmlMethods].appendMember(node);
423 sections[SinceMacros].appendMember(node);
425 Node *p = fn->parent();
428 sections[SinceMemberFunctions].appendMember(node);
430 if (p->name().isEmpty())
431 sections[SinceGlobalFunctions].appendMember(node);
433 sections[SinceNamespaceFunctions].appendMember(node);
435 sections[SinceGlobalFunctions].appendMember(node);
437 sections[SinceGlobalFunctions].appendMember(node);
444 sections[SinceProperties].appendMember(node);
447 sections[SinceVariables].appendMember(node);
449 case Node::QmlProperty:
450 sections[SinceQmlProperties].appendMember(node);
459
460
461
462
463
487 m_aggregate =
nullptr;
494
495
498 for (Section §ion : v)
499 section.setAggregate(aggregate);
503
504
507 for (Section §ion : v)
512
513
516 for (Section §ion : v)
521
522
523
524
525
526
527
528
532 if (
auto *scn =
static_cast<
SharedCommentNode *>(node); scn->collective().size())
533 return scn->collective().first();
539
540
545 case Node::Namespace:
546 v[StdNamespaces].insert(n);
551 v[StdClasses].insert(n);
555 case Node::TypeAlias:
556 v[StdTypes].insert(n);
561 v[StdMacros].insert(n);
563 v[StdFunctions].insert(n);
568 if (!var
->doc().isEmpty()) {
570 v[StdStaticVariables].insert(n);
572 v[StdVariables].insert(n);
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
600 bool documentAll =
true;
606 for (
auto it = m_aggregate->constBegin(); it != m_aggregate->constEnd(); ++it) {
615 const QList<Node *> &relatedBy = m_aggregate->relatedByProxy();
616 for (
const auto &node : relatedBy)
617 stdRefPageSwitch(stdSummarySections(), node);
620
621
622
623
625 const QList<Node *> &children = ns->includedChildren();
626 for (
const auto &child : children) {
627 if (documentAll || child->hasDoc())
628 stdRefPageSwitch(stdSummarySections(), child);
637
638
639
640
649 sv[Macros].insert(n);
651 sv[RelatedNonmembers].insert(n);
658 sv[PublicSlots].insert(fn);
659 else if (fn->isPrivate())
660 sv[PrivateSlots].insert(fn);
662 sv[ProtectedSlots].insert(fn);
665 sv[Signals].insert(fn);
668 sv[StaticPublicMembers].insert(fn);
669 else if (!sv[PublicFunctions].insertReimplementedMember(fn))
670 sv[PublicFunctions].insert(fn);
673 sv[StaticPrivateMembers].insert(fn);
674 else if (!sv[PrivateFunctions].insertReimplementedMember(fn))
675 sv[PrivateFunctions].insert(fn);
678 sv[StaticProtectedMembers].insert(fn);
679 else if (!sv[ProtectedFunctions].insertReimplementedMember(fn))
680 sv[ProtectedFunctions].insert(fn);
685 sv[RelatedNonmembers].insert(n);
691 sv[StaticPublicMembers].insert(n);
692 else if (n->isPrivate())
693 sv[StaticPrivateMembers].insert(n);
695 sv[StaticProtectedMembers].insert(n);
698 sv[PublicVariables].insert(n);
699 else if (!n->isPrivate())
700 sv[ProtectedVariables].insert(n);
705
706
707
708 if (n
->isTypedef() && (n->name() == QLatin1String(
"QtGadgetHelper")))
711 sv[Properties].insert(n);
712 else if (n->isPublic())
713 sv[PublicTypes].insert(n);
714 else if (n->isPrivate())
715 sv[PrivateTypes].insert(n);
717 sv[ProtectedTypes].insert(n);
721
722
723
724
735 dv[DetailsMacros].insert(n);
737 dv[DetailsRelatedNonmembers].insert(n);
742 if (!fn->hasAssociatedProperties() || !fn->doc().isEmpty())
743 dv[DetailsMemberFunctions].insert(n);
747 dv[DetailsRelatedNonmembers].insert(n);
751 if (t->name() != QLatin1String(
"QtGadgetHelper"))
752 dv[DetailsMemberTypes].insert(n);
756 dv[DetailsProperties].insert(n);
757 else if (t->isVariable() && !t->doc().isEmpty())
758 dv[DetailsMemberVariables].insert(n);
768 dv[QmlProperties].insert(n);
774 if (pn->isAttached())
775 dv[QmlAttachedProperties].insert(n);
777 dv[QmlProperties].insert(n);
781 if (fn->isAttached())
782 dv[QmlAttachedSignals].insert(n);
784 dv[QmlSignals].insert(n);
786 dv[QmlSignalHandlers].insert(n);
788 if (fn->isAttached())
789 dv[QmlAttachedMethods].insert(n);
791 dv[QmlMethods].insert(n);
797
798
799
800
807 if (pn->isAttached())
808 sv[QmlAttachedProperties].insert(pn);
810 sv[QmlProperties].insert(pn);
814 if (fn->isAttached())
815 sv[QmlAttachedSignals].insert(fn);
817 sv[QmlSignals].insert(fn);
819 sv[QmlSignalHandlers].insert(fn);
821 if (fn->isAttached())
822 sv[QmlAttachedMethods].insert(fn);
824 sv[QmlMethods].insert(fn);
829 sv[QmlProperties].insert(scn);
831 for (
const auto &child : scn->collective())
832 distributeQmlNodeInSummaryVector(sv, child,
true);
839 const QList<RelatedClass> baseClasses = cn->baseClasses();
840 for (
const auto &cls : baseClasses) {
842 stack.prepend(cls.m_node);
847
848
849
856 for (
auto it = m_aggregate->constBegin(); it != m_aggregate->constEnd(); ++it) {
862 distributeNodeInSummaryVector(summarySections, n);
863 distributeNodeInDetailsVector(detailsSections, n);
866 const QList<Node *> relatedBy = m_aggregate->relatedByProxy();
867 for (
const auto &node : relatedBy)
868 distributeNodeInSummaryVector(summarySections, node);
871 QStack<ClassNode *> stack;
872 auto *cn =
static_cast<
ClassNode *>(m_aggregate);
873 pushBaseClasses(stack, cn);
874 while (!stack.isEmpty()) {
876 for (
auto it = cn->constBegin(); it != cn->constEnd(); ++it) {
882 pushBaseClasses(stack, cn);
890
891
892
904 for (
const auto n : qtn->childNodes()) {
909 if (qtn != m_aggregate && qtn->isAbstract()) {
911 m_aggregate->findChildren(n->name(), candidates);
912 if (std::any_of(candidates.cbegin(), candidates.cend(), [&n](
const Node *c) {
913 if (c->nodeType() == n->nodeType()) {
914 if (!n->isFunction() ||
915 compare(
static_cast<
const FunctionNode *>(n),
916 static_cast<
const FunctionNode *>(c)) == 0)
925 if (!n->isSharedCommentNode() || n->isPropertyGroup()) {
926 allMembers.insert(n);
927 classNodes->second.push_back(n);
931 if (qtn == m_aggregate || qtn->isAbstract()) {
932 distributeQmlNodeInSummaryVector(summarySections, n);
933 distributeQmlNodeInDetailsVector(detailsSections, n);
937 qCDebug(lcQdoc,
"error: circular type definition: '%s' inherits itself",
938 qPrintable(qtn->name()));
950
951
952
953
954
965 for (
const auto §ion : *sections) {
966 if (!section.obsoleteMembers().isEmpty())
967 summary_spv->append(§ion);
975 for (
const auto &it : *sections) {
976 if (!it.obsoleteMembers().isEmpty())
977 details_spv->append(&it);
979 return !summary_spv->isEmpty();
virtual QmlTypeNode * qmlBaseNode() const
If this Aggregate is a QmlTypeNode, this function returns a pointer to the QmlTypeNode that is its ba...
NodeList & relatedByProxy()
Returns a reference to a list of node pointers where each element points to a node in an index file f...
The ClassNode represents a C++ class.
This node is used to represent any kind of function being documented.
bool isIgnored() const
In some cases, it is ok for a public function to be not documented.
bool isQmlSignalHandler() const
This class represents a C++ namespace.
const NodeList & includedChildren() const
Returns a const reference to the namespace node's list of included children, which contains pointers ...
const Doc & doc() const
Returns a reference to the node's Doc data member.
virtual bool isStatic() const
Returns true if the FunctionNode represents a static function.
bool isPrivate() const
Returns true if this node's access is Private.
virtual bool isAbstract() const
Returns true if the ClassNode or QmlTypeNode is marked abstract.
bool isNamespace() const
Returns true if the node type is Namespace.
bool isTypedef() const
Returns true if the node type is Typedef.
bool isFunction(Genus g=DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
bool isEnumType() const
Returns true if the node type is Enum.
Aggregate * parent() const
Returns the node's parent pointer.
bool isPublic() const
Returns true if this node's access is Public.
bool isVariable() const
Returns true if the node type is Variable.
virtual bool isDeprecated() const
Returns true if this node's status is Deprecated.
NodeType nodeType() const
Returns this node's type.
bool isProperty() const
Returns true if the node type is Property.
virtual bool isPropertyGroup() const
Returns true if the node is a SharedCommentNode for documenting multiple C++ properties or multiple Q...
bool isSharingComment() const
This function returns true if the node is sharing a comment with other nodes.
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
LinkType
An unsigned char value that probably should be moved out of the Node base class.
bool isRelatedNonmember() const
Returns true if this is a related nonmember of something.
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
A class for containing the elements of one documentation section.
void clear()
A Section is now an element in a static vector, so we don't have to repeatedly construct and destroy ...
void insert(Node *node)
Inserts the node into this section if it is appropriate for this section.
void reduce()
If this section is not empty, convert its maps to sequential structures for better traversal during d...
ClassNodesList & classNodesList()
bool insertReimplementedMember(Node *node)
Returns true if the node is a reimplemented member function of the current class.
~Section()
The destructor must delete the members of collections when the members are allocated on the heap.
A class for creating vectors of collections for documentation.
const SectionVector & stdCppClassDetailsSections() const
void buildStdCppClassRefPageSections()
Build the section vectors for a standard reference page, when the aggregate node is a C++.
Sections(Aggregate *aggregate)
This constructor builds the vectors of sections based on the type of the aggregate node.
SectionVector & stdCppClassSummarySections()
SectionVector & stdQmlTypeSummarySections()
~Sections()
The behavior of the destructor depends on the type of the Aggregate node that was passed to the const...
SectionVector & stdDetailsSections()
const SectionVector & stdQmlTypeDetailsSections() const
const SectionVector & stdCppClassSummarySections() const
const SectionVector & stdQmlTypeSummarySections() const
void buildStdRefPageSections()
Build the section vectors for a standard reference page, when the aggregate node is not a C++ class o...
void clear(SectionVector &v)
Reset each Section in vector v to its initialized state.
SectionVector & stdCppClassDetailsSections()
void reduce(SectionVector &v)
Linearize the maps in each Section in v.
const SectionVector & stdDetailsSections() const
void buildStdQmlTypeRefPageSections()
Build the section vectors for a standard reference page, when the aggregate node is a QML type.
SectionVector & stdQmlTypeDetailsSections()
SectionVector & sinceSections()
Sections(const NodeMultiMap &nsmap)
This constructor builds a vector of sections from the since node map, nsmap.
bool hasObsoleteMembers(SectionPtrVector *summary_spv, SectionPtrVector *details_spv) const
Returns true if any sections in this object contain obsolete members.
SectionVector & stdSummarySections()
const SectionVector & stdSummarySections() const
static Section & allMembersSection()
const EnumNode * associatedEnum() const
Combined button and popup list for selecting options.
QList< Node * > NodeVector
QString sortName(const Node *node)
Construct a name for the node that can be used for sorting a set of nodes into equivalence classes.
static Node * nodeToTestForDistribution(Node *node)
static void pushBaseClasses(QStack< ClassNode * > &stack, ClassNode *cn)
std::pair< const QmlTypeNode *, NodeVector > ClassNodes
QList< const Section * > SectionPtrVector
QList< Section > SectionVector