Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
node.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#include "node.h"
5
6#include "aggregate.h"
7#include "codemarker.h"
8#include "config.h"
9#include "enumnode.h"
10#include "functionnode.h"
11#include "generator.h"
13#include "nodecontext.h"
14#include "qdocdatabase.h"
15#include "qdoclogging.h"
16#include "qmltypenode.h"
18#include "relatedclass.h"
20#include "tokenizer.h"
21#include "tree.h"
22
23#include <QtCore/quuid.h>
24#include <QtCore/qversionnumber.h>
25
26#include <utility>
27
29
30using namespace Qt::StringLiterals;
31
32/*!
33 \class Node
34 \brief The Node class is the base class for all the nodes in QDoc's parse tree.
35
36 Class Node is the base class of all the node subclasses. There is a subclass of Node
37 for each type of entity that QDoc can document. The types of entities that QDoc can
38 document are listed in the enum type NodeType.
39
40 After ClangCodeParser has parsed all the header files to build its precompiled header,
41 it then visits the clang Abstract Syntax Tree (AST). For each node in the AST that it
42 determines is in the public API and must be documented, it creates an instance of one
43 of the Node subclasses and adds it to the QDoc Tree.
44
45 Each instance of a sublass of Node has a parent pointer to link it into the Tree. The
46 parent pointer is obtained by calling \l {parent()}, which returns a pointer to an
47 instance of the Node subclass, Aggregate, which is never instantiated directly, but
48 as the base class for certain subclasses of Node that can have children. For example,
49 ClassNode and QmlTypeNode can have children, so they both inherit Aggregate, while
50 PropertyNode and QmlPropertyNode can not have children, so they both inherit Node.
51
52 \sa Aggregate, ClassNode, PropertyNode
53 */
54
55// Helper macro for comparing any a < b
56#define LT_RETURN_IF_NOT_EQUAL(a, b)
57 if ((a) != (b))
58 return (a) < (b);
59
60// Helper macro for comparing strings a < b
61#define LT_RETURN_IF_NOT_EQUAL_QSTR(a, b)
62 if ((a) != (b))
63 return QString::compare(a, b) < 0;
64
65/*!
66 Returns \c true if the node \a n1 is less than node \a n2. The
67 comparison is performed by comparing properties of the nodes
68 in order of increasing complexity.
69
70 String properties are compared in a locale- and platform-
71 independent manner.
72
73 Use for sorting lists of Nodes for output not intended for
74 human consumption, for example, ordering elements in an index
75 file.
76
77 \sa nodeNameLessThan()
78 */
79bool Node::nodeLessThan(const Node *n1, const Node *n2)
80{
81 if (n1->isFunction() && n2->isFunction()) {
82 const auto *f1 = static_cast<const FunctionNode *>(n1);
83 const auto *f2 = static_cast<const FunctionNode *>(n2);
84
85 LT_RETURN_IF_NOT_EQUAL(f1->isConst(), f2->isConst());
86 LT_RETURN_IF_NOT_EQUAL_QSTR(f1->signature(Node::SignatureReturnType),
87 f2->signature(Node::SignatureReturnType));
88 }
89
91 LT_RETURN_IF_NOT_EQUAL_QSTR(n1->name(), n2->name());
92 LT_RETURN_IF_NOT_EQUAL_QSTR(n1->logicalModuleName(), n2->logicalModuleName());
94 LT_RETURN_IF_NOT_EQUAL_QSTR(n1->location().filePath(), n2->location().filePath());
96
97 return false;
98}
99
100/*!
101 Returns \c true if the node \a n1 is less than node \a n2. The
102 comparison is performed by comparing properties of the nodes
103 in order of increasing complexity.
104
105 Use for sorting lists of Nodes for output intended for human
106 consumption. Sorting by name/title takes precedence over other
107 properties.
108
109 \sa nodeLessThan()
110 */
111bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
112{
113 if (n1->isPageNode() && n2->isPageNode()) {
114 LT_RETURN_IF_NOT_EQUAL(n1->fullName(), n2->fullName());
115 LT_RETURN_IF_NOT_EQUAL(n1->fullTitle(), n2->fullTitle());
116 }
117
118 if (n1->isFunction() && n2->isFunction()) {
119 const auto *f1 = static_cast<const FunctionNode *>(n1);
120 const auto *f2 = static_cast<const FunctionNode *>(n2);
121
122 LT_RETURN_IF_NOT_EQUAL(f1->isConst(), f2->isConst());
124 f2->signature(Node::SignatureReturnType));
125 }
126
128 LT_RETURN_IF_NOT_EQUAL(n1->name(), n2->name());
129 LT_RETURN_IF_NOT_EQUAL(n1->logicalModuleName(), n2->logicalModuleName());
131 LT_RETURN_IF_NOT_EQUAL(n1->location().filePath(), n2->location().filePath());
132
133 return false;
134}
135
136bool Node::nodeNameOverloadLessThan(const Node *n1, const Node *n2)
137{
138 if (n1->isFunction() && n2->isFunction()) {
139 const auto *f1 = static_cast<const FunctionNode *>(n1);
140 const auto *f2 = static_cast<const FunctionNode *>(n2);
141
142 LT_RETURN_IF_NOT_EQUAL(f1->overloadNumber(), f2->overloadNumber());
143 }
144
145 return nodeNameLessThan(n1, n2);
146}
147
148/*!
149 Returns \c true if node \a n1 is less than node \a n2 when comparing
150 the sort keys, defined with
151
152 \badcode
153 \meta sortkey {<value>}
154 \endcode
155
156 in the respective nodes' documentation. If the two sort keys are equal,
157 falls back to nodeNameLessThan(). If \a n1 defines a sort key and \a n2
158 does not, then n1 < n2.
159
160*/
161bool Node::nodeSortKeyOrNameLessThan(const Node *n1, const Node *n2)
162{
163 const QString default_sortkey{QChar{QChar::LastValidCodePoint}};
164 const auto *n1_metamap{n1->doc().metaTagMap()};
165 const auto *n2_metamap{n2->doc().metaTagMap()};
166 if (auto cmp = QString::compare(
167 n1_metamap ? n1_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey,
168 n2_metamap ? n2_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey); cmp != 0) {
169 return cmp < 0;
170 }
171 return nodeNameLessThan(n1, n2);
172}
173
174
176{
177 NodeContext context;
178 context.type = nodeType();
179 if (isFunction())
180 context.metaness = static_cast<const FunctionNode *>(this)->metaness();
181 context.isPrivate = isPrivate();
182 context.isInternal = isInternal();
186
187 return context;
188}
189
190
191/*!
192 \internal
193 \fn setComparisonCategory(const ComparisonCategory category)
194
195 Sets the comparison category of this node to \a category.
196
197 \sa ComparisonCategory, comparisonCategory()
198 */
199
200/*!
201 \internal
202 \fn ComparisonCategory comparisonCategory()
203
204 Returns the comparison category of this node.
205
206 \sa ComparisonCategory, setComparisonCategory()
207 */
208
209/*!
210 \enum Access
211
212 An unsigned char value that indicates the C++ access level.
213
214 \value Public The element has public access.
215 \value Protected The element has protected access.
216 \value Private The element has private access.
217*/
218
219/*!
220 \enum Node::Status
221
222 An unsigned char that specifies the status of the documentation element in
223 the documentation set.
224
225 \value Deprecated The element has been deprecated.
226 \value Preliminary The element is new; the documentation is preliminary.
227 \value Active The element is current.
228 \value Internal The element is for internal use only, not to be published.
229 \value DontDocument The element is not to be documented.
230*/
231
232/*!
233 \enum Node::ThreadSafeness
234
235 An unsigned char that specifies the degree of thread-safeness of the element.
236
237 \value UnspecifiedSafeness The thread-safeness is not specified.
238 \value NonReentrant The element is not reentrant.
239 \value Reentrant The element is reentrant.
240 \value ThreadSafe The element is threadsafe.
241*/
242
243/*!
244 \enum Node::LinkType
245
246 An unsigned char value that probably should be moved out of the Node base class.
247
248 \value StartLink
249 \value NextLink
250 \value PreviousLink
251 \value ContentsLink
252 */
253
254/*!
255 \enum Node::FlagValue
256
257 A value used in PropertyNode and QmlPropertyNode that can be -1, 0, or +1.
258 Properties and QML properties have flags, which can be 0 or 1, false or true,
259 or not set. FlagValueDefault is the not set value. In other words, if a flag
260 is set to FlagValueDefault, the meaning is the flag has not been set.
261
262 \value FlagValueDefault -1 Not set.
263 \value FlagValueFalse 0 False.
264 \value FlagValueTrue 1 True.
265*/
266
267/*!
268 \fn Node::~Node()
269
270 The default destructor is virtual so any subclass of Node can be
271 deleted by deleting a pointer to Node.
272 */
273
274/*! \fn bool Node::isActive() const
275 Returns true if this node's status is \c Active.
276 */
277
278/*! \fn bool Node::isClass() const
279 Returns true if the node type is \c Class.
280 */
281
282/*! \fn bool Node::isCppNode() const
283 Returns true if this node's Genus value is \c CPP.
284 */
285
286/*! \fn bool Node::isDeprecated() const
287 Returns true if this node's status is \c Deprecated.
288 */
289
290/*! \fn bool Node::isDontDocument() const
291 Returns true if this node's status is \c DontDocument.
292 */
293
294/*! \fn bool Node::isEnumType() const
295 Returns true if the node type is \c Enum.
296 */
297
298/*! \fn bool Node::isExample() const
299 Returns true if the node type is \c Example.
300 */
301
302/*! \fn bool Node::isExternalPage() const
303 Returns true if the node type is \c ExternalPage.
304 */
305
306/*! \fn bool Node::isFunction(Genus g = DontCare) const
307 Returns true if this is a FunctionNode and its Genus is set to \a g.
308 */
309
310/*! \fn bool Node::isGroup() const
311 Returns true if the node type is \c Group.
312 */
313
314/*! \fn bool Node::isHeader() const
315 Returns true if the node type is \c HeaderFile.
316 */
317
318/*! \fn bool Node::isIndexNode() const
319 Returns true if this node was created from something in an index file.
320 */
321
322/*! \fn bool Node::isModule() const
323 Returns true if the node type is \c Module.
324 */
325
326/*! \fn bool Node::isNamespace() const
327 Returns true if the node type is \c Namespace.
328 */
329
330/*! \fn bool Node::isPage() const
331 Returns true if the node type is \c Page.
332 */
333
334/*! \fn bool Node::isPreliminary() const
335 Returns true if this node's status is \c Preliminary.
336 */
337
338/*! \fn bool Node::isPrivate() const
339 Returns true if this node's access is \c Private.
340 */
341
342/*! \fn bool Node::isProperty() const
343 Returns true if the node type is \c Property.
344 */
345
346/*! \fn bool Node::isProxyNode() const
347 Returns true if the node type is \c Proxy.
348 */
349
350/*! \fn bool Node::isPublic() const
351 Returns true if this node's access is \c Public.
352 */
353
354/*! \fn bool Node::isProtected() const
355 Returns true if this node's access is \c Protected.
356 */
357
358/*! \fn bool Node::isQmlBasicType() const
359 Returns true if the node type is \c QmlBasicType.
360 */
361
362/*! \fn bool Node::isQmlModule() const
363 Returns true if the node type is \c QmlModule.
364 */
365
366/*! \fn bool Node::isQmlNode() const
367 Returns true if this node's Genus value is \c QML.
368 */
369
370/*! \fn bool Node::isQmlProperty() const
371 Returns true if the node type is \c QmlProperty.
372 */
373
374/*! \fn bool Node::isQmlType() const
375 Returns true if the node type is \c QmlType or \c QmlValueType.
376 */
377
378/*! \fn bool Node::isRelatedNonmember() const
379 Returns true if this is a related nonmember of something.
380 */
381
382/*! \fn bool Node::isStruct() const
383 Returns true if the node type is \c Struct.
384 */
385
386/*! \fn bool Node::isSharedCommentNode() const
387 Returns true if the node type is \c SharedComment.
388 */
389
390/*! \fn bool Node::isTypeAlias() const
391 Returns true if the node type is \c Typedef.
392 */
393
394/*! \fn bool Node::isTypedef() const
395 Returns true if the node type is \c Typedef.
396 */
397
398/*! \fn bool Node::isUnion() const
399 Returns true if the node type is \c Union.
400 */
401
402/*! \fn bool Node::isVariable() const
403 Returns true if the node type is \c Variable.
404 */
405
406/*! \fn bool Node::isGenericCollection() const
407 Returns true if the node type is \c Collection.
408 */
409
410/*! \fn bool Node::isAbstract() const
411 Returns true if the ClassNode or QmlTypeNode is marked abstract.
412*/
413
414/*! \fn bool Node::isAggregate() const
415 Returns true if this node is an aggregate, which means it
416 inherits Aggregate and can therefore have children.
417*/
418
419/*! \fn bool Node::isFirstClassAggregate() const
420 Returns true if this Node is an Aggregate but not a ProxyNode.
421*/
422
423/*! \fn bool Node::isAlias() const
424 Returns true if this QML property is marked as an alias.
425*/
426
427/*! \fn bool Node::isAttached() const
428 Returns true if the QML property or QML method node is marked as attached.
429*/
430
431/*! \fn bool Node::isClassNode() const
432 Returns true if this is an instance of ClassNode.
433*/
434
435/*! \fn bool Node::isCollectionNode() const
436 Returns true if this is an instance of CollectionNode.
437*/
438
439/*! \fn bool Node::isDefault() const
440 Returns true if the QML property node is marked as default.
441*/
442
443/*! \fn bool Node::isMacro() const
444 returns true if either FunctionNode::isMacroWithParams() or
445 FunctionNode::isMacroWithoutParams() returns true.
446*/
447
448/*! \fn bool Node::isPageNode() const
449 Returns true if this node represents something that generates a documentation
450 page. In other words, if this Node's subclass inherits PageNode, then this
451 function will return \e true.
452*/
453
454/*! \fn bool Node::isRelatableType() const
455 Returns true if this node is something you can relate things to with
456 the \e relates command. NamespaceNode, ClassNode, HeaderNode, and
457 ProxyNode are relatable types.
458*/
459
460/*! \fn bool Node::isMarkedReimp() const
461 Returns true if the FunctionNode is marked as a reimplemented function.
462 That means it is virtual in the base class and it is reimplemented in
463 the subclass.
464*/
465
466/*! \fn bool Node::isPropertyGroup() const
467 Returns true if the node is a SharedCommentNode for documenting
468 multiple C++ properties or multiple QML properties.
469*/
470
471/*! \fn bool Node::isStatic() const
472 Returns true if the FunctionNode represents a static function.
473*/
474
475/*! \fn bool Node::isTextPageNode() const
476 Returns true if the node is a PageNode but not an Aggregate.
477*/
478
479/*!
480 Returns this node's name member. Appends "()" to the returned
481 name if this node is a function node, but not if it is a macro
482 because macro names normally appear without parentheses.
483 */
485{
486 if (isFunction() && !isMacro())
487 return m_name + QLatin1String("()");
488 return m_name;
489}
490
491/*!
492 Constructs and returns the node's fully qualified name by
493 recursively ascending the parent links and prepending each
494 parent name + "::". Breaks out when reaching a HeaderNode,
495 or when the parent pointer is \a relative. Typically, calls
496 to this function pass \c nullptr for \a relative.
497 */
498QString Node::plainFullName(const Node *relative) const
499{
500 if (m_name.isEmpty())
501 return QLatin1String("global");
502 if (isHeader())
503 return plainName();
504
505 QStringList parts;
506 const Node *node = this;
507 while (node && !node->isHeader()) {
508 parts.prepend(node->plainName());
509 if (node->parent() == relative || node->parent()->name().isEmpty())
510 break;
511 node = node->parent();
512 }
513 return parts.join(QLatin1String("::"));
514}
515
516/*!
517 Constructs and returns the node's fully qualified signature
518 by recursively ascending the parent links and prepending each
519 parent name + "::" to the plain signature. The return type is
520 not included.
521 */
523{
524 if (m_name.isEmpty())
525 return QLatin1String("global");
526
527 QString fullName;
528 const Node *node = this;
529 while (node) {
530 fullName.prepend(node->signature(Node::SignaturePlain));
531 if (node->parent()->name().isEmpty())
532 break;
533 fullName.prepend(QLatin1String("::"));
534 node = node->parent();
535 }
536 return fullName;
537}
538
539/*!
540 Constructs and returns this node's full name. The full name is
541 often just the title(). When it is not the title, it is the
542 plainFullName().
543 */
544QString Node::fullName(const Node *relative) const
545{
546 if ((isTextPageNode() || isGroup()) && !title().isEmpty())
547 return title();
548 return plainFullName(relative);
549}
550
551/*!
552 Sets this Node's Doc to \a doc. If \a replace is false and
553 this Node already has a Doc, and if this doc is not marked
554 with the \\reimp command, a warning is reported that the
555 existing Doc is being overridden, and it reports where the
556 previous Doc was found. If \a replace is true, the Doc is
557 replaced silently. Auto-generated documentation (for explicitly
558 defaulted or deleted functions) is also silently replaced.
559 */
560void Node::setDoc(const Doc &doc, bool replace)
561{
562 if (!m_doc.isEmpty() && !replace && !doc.isMarkedReimp() && !m_doc.isAutoGenerated()) {
563 doc.location().warning(QStringLiteral("Overrides a previous doc"),
564 QStringLiteral("from here: %1").arg(m_doc.location().toString()));
565 }
566 m_doc = doc;
567}
568
569/*!
570 Sets the node's status to \a t.
571
572 \sa Status
573*/
575{
576 m_status = t;
577
578 // Set non-null, empty URL to nodes that are ignored as
579 // link targets
580 switch (t) {
581 case Status::Internal:
583 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
585 break;
586 Q_FALLTHROUGH();
587 }
588 case Status::DontDocument:
589 m_url = QStringLiteral("");
590 break;
591 default:
592 break;
593 }
594}
595
596/*!
597 Construct a node with the given \a type and having the
598 given \a parent and \a name. The new node is added to the
599 parent's child list.
600 */
601Node::Node(NodeType type, Aggregate *parent, QString name)
602 : m_nodeType(type),
603 m_indexNodeFlag(false),
604 m_relatedNonmember(false),
605 m_hadDoc(false),
606 m_parent(parent),
608{
609 if (m_parent)
610 m_parent->addChild(this);
611
613}
614
615/*!
616 Determines the appropriate Genus value for the NodeType
617 value \a t and returns that Genus value. Note that this
618 function is called in the Node() constructor. It always
619 returns Node::CPP when \a t is Node::Function, which
620 means the FunctionNode() constructor must determine its
621 own Genus value separately, because class FunctionNode
622 is a subclass of Node.
623 */
625{
626 switch (t) {
627 case NodeType::Enum:
628 case NodeType::Class:
629 case NodeType::Struct:
630 case NodeType::Union:
631 case NodeType::Module:
640 return Genus::CPP;
646 return Genus::QML;
647 case NodeType::Page:
648 case NodeType::Group:
651 return Genus::DOC;
654 case NodeType::Proxy:
655 default:
656 return Genus::DontCare;
657 }
658}
659
660/*! \fn QString Node::url() const
661 Returns the node's URL, which is the url of the documentation page
662 created for the node or the url of an external page if the node is
663 an ExternalPageNode. The url is used for generating a link to the
664 page the node represents.
665
666 \sa Node::setUrl()
667 */
668
669/*! \fn void Node::setUrl(const QString &url)
670 Sets the node's URL to \a url, which is the url to the page that the
671 node represents. This function is only called when an index file is
672 read. In other words, a node's url is set when qdoc decides where its
673 page will be and what its name will be, which happens when qdoc writes
674 the index file for the module being documented.
675
676 \sa QDocIndexFiles
677 */
678
679/*!
680 Returns this node's type as a string for use as an
681 attribute value in XML or HTML.
682 */
684{
685 if (isFunction()) {
686 const auto *fn = static_cast<const FunctionNode *>(this);
687 return fn->kindString();
688 }
689 return nodeTypeString(nodeType());
690}
691
692/*!
693 Returns the node type \a t as a string for use as an
694 attribute value in XML or HTML.
695 */
696QString Node::nodeTypeString(NodeType t)
697{
698 switch (t) {
700 return QLatin1String("namespace");
701 case NodeType::Class:
702 return QLatin1String("class");
703 case NodeType::Struct:
704 return QLatin1String("struct");
705 case NodeType::Union:
706 return QLatin1String("union");
708 return QLatin1String("header");
709 case NodeType::Page:
710 return QLatin1String("page");
711 case NodeType::Enum:
712 return QLatin1String("enum");
714 return QLatin1String("example");
716 return QLatin1String("external page");
719 return QLatin1String("typedef");
721 return QLatin1String("function");
723 return QLatin1String("property");
724 case NodeType::Proxy:
725 return QLatin1String("proxy");
727 return QLatin1String("variable");
728 case NodeType::Group:
729 return QLatin1String("group");
730 case NodeType::Module:
731 return QLatin1String("module");
733 return QLatin1String("concept");
735 return QLatin1String("enumeration");
737 return QLatin1String("QML type");
739 return QLatin1String("QML value type");
741 return QLatin1String("QML module");
743 return QLatin1String("QML property");
744
746 return QLatin1String("shared comment");
748 return QLatin1String("collection");
749 default:
750 break;
751 }
752 return QString();
753}
754
755/*! Converts the boolean value \a b to an enum representation
756 of the boolean type, which includes an enum value for the
757 \e {default value} of the item, i.e. true, false, or default.
758 */
760{
761 return b ? FlagValueTrue : FlagValueFalse;
762}
763
764/*!
765 Converts the enum \a fv back to a boolean value.
766 If \a fv is neither the true enum value nor the
767 false enum value, the boolean value returned is
768 \a defaultValue.
769 */
770bool Node::fromFlagValue(FlagValue fv, bool defaultValue)
771{
772 switch (fv) {
773 case FlagValueTrue:
774 return true;
775 case FlagValueFalse:
776 return false;
777 default:
778 return defaultValue;
779 }
780}
781
782/*!
783 This function creates a pair that describes a link.
784 The pair is composed from \a link and \a desc. The
785 \a linkType is the map index the pair is filed under.
786 */
787void Node::setLink(LinkType linkType, QString link, QString desc)
788{
789 m_linkMap[linkType] = std::make_pair(std::move(link), std::move(desc));
790}
791
792/*!
793 Sets the information about the project and version a node was introduced
794 in, unless the version is lower than the 'ignoresince.<project>'
795 configuration variable.
796 */
797void Node::setSince(const QString &since)
798{
799 QStringList parts = since.split(QLatin1Char(' '));
800 QString project;
801 if (parts.size() > 1)
802 project = Config::dot + parts.first();
803
804 QVersionNumber cutoff =
805 QVersionNumber::fromString(Config::instance().get(CONFIG_IGNORESINCE + project).asString())
806 .normalized();
807
808 if (!cutoff.isNull() && QVersionNumber::fromString(parts.last()).normalized() < cutoff)
809 return;
810
811 m_since = parts.join(QLatin1Char(' '));
812}
813
814/*!
815 Extract a class name from the type \a string and return it.
816 */
817QString Node::extractClassName(const QString &string) const
818{
819 QString result;
820 for (int i = 0; i <= string.size(); ++i) {
821 QChar ch;
822 if (i != string.size())
823 ch = string.at(i);
824
825 QChar lower = ch.toLower();
826 if ((lower >= QLatin1Char('a') && lower <= QLatin1Char('z')) || ch.digitValue() >= 0
827 || ch == QLatin1Char('_') || ch == QLatin1Char(':')) {
828 result += ch;
829 } else if (!result.isEmpty()) {
830 if (result != QLatin1String("const"))
831 return result;
832 result.clear();
833 }
834 }
835 return result;
836}
837
838/*!
839 Returns the thread safeness value for whatever this node
840 represents. But if this node has a parent and the thread
841 safeness value of the parent is the same as the thread
842 safeness value of this node, what is returned is the
843 value \c{UnspecifiedSafeness}. Why?
844 */
846{
847 if (m_parent && m_safeness == m_parent->inheritedThreadSafeness())
848 return UnspecifiedSafeness;
849 return m_safeness;
850}
851
852/*!
853 If this node has a parent, the parent's thread safeness
854 value is returned. Otherwise, this node's thread safeness
855 value is returned. Why?
856 */
858{
859 if (m_parent && m_safeness == UnspecifiedSafeness)
860 return m_parent->inheritedThreadSafeness();
861 return m_safeness;
862}
863
864/*!
865 Returns \c true if the node's status is \c Internal, or if
866 its parent is a class with \c Internal status.
867 */
868bool Node::isInternal() const
869{
871 return true;
872 if (parent() && !parent()->isAbstract()) {
873 const Status parentStatus = parent()->status();
874 return parentStatus == Status::Internal || parentStatus == Status::InternalAuto;
875 }
876 return false;
877}
878
879/*! \fn void Node::markInternal()
880 Sets the node's access to Private and its status to Internal.
881 */
882
883/*!
884 Returns a pointer to the root of the Tree this node is in.
885 */
886Aggregate *Node::root() const
887{
888 if (parent() == nullptr)
889 return (this->isAggregate() ? static_cast<Aggregate *>(const_cast<Node *>(this)) : nullptr);
890 Aggregate *t = parent();
891 while (t->parent() != nullptr)
892 t = t->parent();
893 return t;
894}
895
896/*!
897 Returns a pointer to the Tree this node is in.
898 */
899Tree *Node::tree() const
900{
901 return root()->tree();
902}
903
904/*!
905 Sets the node's declaration location, its definition
906 location, or both, depending on the suffix of the file
907 name from the file path in location \a t.
908 */
909void Node::setLocation(const Location &t)
910{
911 QString suffix = t.fileSuffix();
912 if (suffix == "h")
913 m_declLocation = t;
914 else if (suffix == "cpp")
915 m_defLocation = t;
916 else {
917 m_declLocation = t;
918 m_defLocation = t;
919 }
920}
921
922/*!
923 Returns \c true if this node is considered to be
924 part of the API as per the InclusionPolicy retrieved
925 from configuration.
926*/
927bool Node::isInAPI() const
928{
929 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
930 bool inPolicy = InclusionFilter::isIncluded(policy, this->createContext());
931
932 return inPolicy && !isDontDocument() && hasDoc();
933}
934
935/*!
936 Returns \c true if this node is documented, or it represents
937 a documented node read from the index ('had doc'), or this
938 node is sharing a non-empty doc with other nodes.
939
940 \sa Doc
941 */
942bool Node::hasDoc() const
943{
944 if (m_hadDoc)
945 return true;
946
947 if (!m_doc.isEmpty())
948 return true;
949
950 return (m_sharedCommentNode && m_sharedCommentNode->hasDoc());
951}
952
953/*!
954 Returns the CPP node's qualified name by prepending the
955 namespaces name + "::" if there isw a namespace.
956 */
958{
959 if (m_parent && m_parent->isNamespace() && !m_parent->name().isEmpty())
960 return m_parent->name() + "::" + m_name;
961 return m_name;
962}
963
964/*!
965 Return the name of this node qualified with the parent name
966 and "::" if there is a parent name.
967 */
969{
970 if (m_parent && !m_parent->name().isEmpty())
971 return m_parent->name() + "::" + m_name;
972 return m_name;
973}
974
975/*!
976 Returns the QML node's qualified name by prepending the logical
977 module name.
978 */
980{
981 return logicalModuleName() + "::" + m_name;
982}
983
984/*!
985 Returns \c true if the node is a class node or a QML type node
986 that is marked as being a wrapper class or wrapper QML type,
987 or if it is a member of a wrapper class or type.
988 */
989bool Node::isWrapper() const
990{
991 return m_parent != nullptr && m_parent->isWrapper();
992}
993
994/*!
995 Construct the full document name for this node and return it.
996 */
998{
999 QStringList pieces;
1000 const Node *n = this;
1001
1002 do {
1003 if (!n->name().isEmpty())
1004 pieces.insert(0, n->name());
1005
1006 if (n->isQmlType() && !n->logicalModuleName().isEmpty()) {
1007 pieces.insert(0, n->logicalModuleName());
1008 break;
1009 }
1010
1011 if (n->isTextPageNode())
1012 break;
1013
1014 // Examine the parent if the node is a member
1016 break;
1017
1018 n = n->parent();
1019 } while (true);
1020
1021 // Create a name based on the type of the ancestor node.
1022 QString concatenator = "::";
1023 if (n->isQmlType())
1024 concatenator = QLatin1Char('.');
1025
1026 if (n->isTextPageNode())
1027 concatenator = QLatin1Char('#');
1028
1029 return pieces.join(concatenator);
1030}
1031
1032/*!
1033 Sets the Node status to Node::Deprecated, unless \a sinceVersion represents
1034 a future version.
1035
1036 Stores \a sinceVersion representing the version in which the deprecation
1037 took (or will take) place.
1038
1039 Fetches the current version from the config ('version' variable) as a
1040 string, and compared to \a sinceVersion. If both string represent a valid
1041 version and \a sinceVersion is greater than the currect version, do not
1042 mark the node as deprecated; leave it active.
1043*/
1044void Node::setDeprecated(const QString &sinceVersion)
1045{
1046
1047 if (!m_deprecatedSince.isEmpty())
1048 qCWarning(lcQdoc) << QStringLiteral(
1049 "Setting deprecated since version for %1 to %2 even though it "
1050 "was already set to %3. This is very unexpected.")
1051 .arg(this->m_name, sinceVersion, this->m_deprecatedSince);
1052 m_deprecatedSince = sinceVersion;
1053
1054 if (!sinceVersion.isEmpty()) {
1055 QVersionNumber since = QVersionNumber::fromString(sinceVersion).normalized();
1056 QVersionNumber current = QVersionNumber::fromString(
1057 Config::instance().get(CONFIG_VERSION).asString())
1058 .normalized();
1059 if (!current.isNull() && !since.isNull()) {
1060 if (current < since)
1061 return;
1062 }
1063 }
1065}
1066
1067/*! \fn Node *Node::clone(Aggregate *parent)
1068
1069 When reimplemented in a subclass, this function creates a
1070 clone of this node on the heap and makes the clone a child
1071 of \a parent. A pointer to the clone is returned.
1072
1073 Here in the base class, this function does nothing and returns
1074 nullptr.
1075 */
1076
1077/*! \fn NodeType Node::nodeType() const
1078 Returns this node's type.
1079
1080 \sa NodeType
1081*/
1082
1083/*! \fn Genus Node::genus() const
1084 Returns this node's Genus.
1085
1086 \sa Genus
1087*/
1088
1089/*! void Node::setGenus(Genus t)
1090 Sets this node's Genus to \a t.
1091*/
1092
1093/*! \fn QString Node::signature(Node::SignatureOptions options) const
1094
1095 Specific parts of the signature are included according to flags in
1096 \a options.
1097
1098 If this node is not a FunctionNode, this function returns plainName().
1099
1100 \sa FunctionNode::signature()
1101*/
1102
1103/*! \fn const QString &Node::fileNameBase() const
1104 Returns the node's file name base string, which is built once, when
1105 Generator::fileBase() is called and stored in the Node.
1106*/
1107
1108/*! \fn bool Node::hasFileNameBase() const
1109 Returns true if the node's file name base has been set.
1110
1111 \sa Node::fileNameBase()
1112*/
1113
1114/*! \fn void Node::setFileNameBase(const QString &t)
1115 Sets the node's file name base to \a t. Only called by
1116 Generator::fileBase().
1117*/
1118
1119/*! \fn void Node::setAccess(Access t)
1120 Sets the node's access type to \a t.
1121
1122 \sa Access
1123*/
1124
1125/*! \fn void Node::setThreadSafeness(ThreadSafeness t)
1126 Sets the node's thread safeness to \a t.
1127
1128 \sa ThreadSafeness
1129*/
1130
1131/*! \fn void Node::setPhysicalModuleName(const QString &name)
1132 Sets the node's physical module \a name.
1133*/
1134
1135/*! \fn void Node::setReconstitutedBrief(const QString &t)
1136 When reading an index file, this function is called with the
1137 reconstituted brief clause \a t to set the node's brief clause.
1138 I think this is needed for linking to something in the brief clause.
1139*/
1140
1141/*! \fn void Node::setParent(Aggregate *n)
1142 Sets the node's parent pointer to \a n. Such a thing
1143 is not lightly done. All the calls to this function
1144 are in other member functions of Node subclasses. See
1145 the code in the subclass implementations to understand
1146 when this function can be called safely and why it is called.
1147*/
1148
1149/*! \fn void Node::setDeclarationParent(Aggregate *n)
1150 Sets the node's declaration parent pointer to \a n, the aggregate
1151 in whose C++ scope the node was declared. This pointer is set when
1152 the node is adopted by the \c relates command, whose target becomes
1153 the node's documentation parent. It is \c null unless the node was
1154 adopted from another aggregate.
1155
1156 \sa declarationParent()
1157*/
1158
1159/*! \fn void Node::setIndexNodeFlag(bool isIndexNode = true)
1160 Sets a flag in this Node that indicates the node was created
1161 for something in an index file. This is important to know
1162 because an index node is not to be documented in the current
1163 module. When the index flag is set, it means the Node
1164 represents something in another module, and it will be
1165 documented in that module's documentation.
1166*/
1167
1168/*! \fn void Node::setRelatedNonmember(bool b)
1169 Sets a flag in the node indicating whether this node is a related nonmember
1170 of something. This function is called when the \c relates command is seen.
1171 */
1172
1173/*! \fn void Node::addMember(Node *node)
1174 In a CollectionNode, this function adds \a node to the collection
1175 node's members list. It does nothing if this node is not a CollectionNode.
1176 */
1177
1178/*! \fn bool Node::hasNamespaces() const
1179 Returns \c true if this is a CollectionNode and its members list
1180 contains namespace nodes. Otherwise it returns \c false.
1181 */
1182
1183/*! \fn bool Node::hasClasses() const
1184 Returns \c true if this is a CollectionNode and its members list
1185 contains class nodes. Otherwise it returns \c false.
1186 */
1187
1188/*! \fn void Node::setAbstract(bool b)
1189 If this node is a ClassNode or a QmlTypeNode, the node's abstract flag
1190 data member is set to \a b.
1191 */
1192
1193/*! \fn void Node::setWrapper()
1194 If this node is a ClassNode or a QmlTypeNode, the node's wrapper flag
1195 data member is set to \c true.
1196 */
1197
1198/*! \fn void Node::setDataType(const QString &dataType)
1199 If this node is a PropertyNode or a QmlPropertyNode, its
1200 data type data member is set to \a dataType. Otherwise,
1201 this function does nothing.
1202 */
1203
1204/*! \fn bool Node::wasSeen() const
1205 Returns the \c seen flag data member of this node if it is a NamespaceNode
1206 or a CollectionNode. Otherwise it returns \c false. If \c true is returned,
1207 it means that the location where the namespace or collection is to be
1208 documented has been found.
1209 */
1210
1211/*! \fn void appendGroupName(const QString &t)
1212 If this node is a PageNode, the group name \a t is appended to the node's
1213 list of group names. It is not clear to me what this list of group names
1214 is used for, but it is written to the index file, and it is used in the
1215 navigation bar.
1216 */
1217
1218/*! \fn QString Node::element() const
1219 If this node is a QmlPropertyNode or a FunctionNode, this function
1220 returns the name of the parent node. Otherwise it returns an empty
1221 string.
1222 */
1223
1224/*! \fn bool Node::docMustBeGenerated() const
1225 This function is called to perform a test to decide if the node must have
1226 documentation generated. In the Node base class, it always returns \c false.
1227
1228 In the ProxyNode class it always returns \c true. There aren't many proxy
1229 nodes, but when one appears, it must generate documentation. In the overrides
1230 in NamespaceNode and ClassNode, a meaningful test is performed to decide if
1231 documentation must be generated.
1232 */
1233
1234/*! \fn QString Node::title() const
1235 Returns a string that can be used to print a title in the documentation for
1236 whatever this Node is. In the Node base class, the node's name() is returned.
1237 In a PageNode, the function returns the title data member. In a HeaderNode,
1238 if the title() is empty, the name() is returned.
1239 */
1240
1241/*! \fn QString Node::subtitle() const { return QString(); }
1242 Returns a string that can be used to print a subtitle in the documentation for
1243 whatever this Node is. In the Node base class, the empty string is returned.
1244 In a PageNode, the function returns the subtitle data member. In a HeaderNode,
1245 the subtitle data member is returned.
1246 */
1247
1248/*! \fn QString Node::fullTitle() const
1249 Returns a string that can be used as the full title for the documentation of
1250 this node. In this base class, the name() is returned. In a PageNode, title()
1251 is returned. In a HeaderNode, if the title() is empty, the name() is returned.
1252 If the title() is not empty then name-title is returned. In a CollectionNode,
1253 the title() is returned.
1254 */
1255
1256/*! \fn bool Node::setTitle(const QString &title)
1257 Sets the node's \a title, which is used for the title of
1258 the documentation page, if one is generated for this node.
1259 Returns \c true if the title is set. In this base class,
1260 there is no title string stored, so in the base class,
1261 nothing happens and \c false is returned. The override in
1262 the PageNode class is where the title is set.
1263 */
1264
1265/*! \fn bool Node::setSubtitle(const QString &subtitle)
1266 Sets the node's \a subtitle, which is used for the subtitle
1267 of the documentation page, if one is generated for this node.
1268 Returns \c true if the subtitle is set. In this base class,
1269 there is no subtitle string stored, so in the base class,
1270 nothing happens and \c false is returned. The override in
1271 the PageNode and HeaderNode classes is where the subtitle is
1272 set.
1273 */
1274
1275/*! \fn void Node::markDefault()
1276 If this node is a QmlPropertyNode, it is marked as the default property.
1277 Otherwise the function does nothing.
1278 */
1279
1280/*! \fn void Node::markReadOnly(bool flag)
1281 If this node is a QmlPropertyNode, then the property's read-only
1282 flag is set to \a flag.
1283 */
1284
1285/*! \fn Aggregate *Node::parent() const
1286 Returns the node's parent pointer, that is, the aggregate under which
1287 the node is documented. For a related nonmember adopted by the
1288 \c relates command, this is the related aggregate, which may differ
1289 from the aggregate in whose C++ scope the node was declared.
1290
1291 \sa declarationParent()
1292*/
1293
1294/*! \fn Aggregate *Node::declarationParent() const
1295 Returns the aggregate in whose C++ scope the node was declared, or
1296 \c null if the node was not adopted by the \c relates command. Use
1297 this, rather than parent(), to qualify names with the node's
1298 declaration scope.
1299
1300 \sa parent()
1301*/
1302
1303/*! \fn const QString &Node::name() const
1304 Returns the node's name data member.
1305*/
1306
1307/*! \fn void Node::setQtVariable(const QString &v)
1308 If this node is a CollectionNode, its QT variable is set to \a v.
1309 Otherwise the function does nothing. I don't know what the QT variable
1310 is used for.
1311 */
1312
1313/*! \fn QString Node::qtVariable() const
1314 If this node is a CollectionNode, its QT variable is returned.
1315 Otherwise an empty string is returned. I don't know what the QT
1316 variable is used for.
1317 */
1318
1319/*! \fn bool Node::hasTag(const QString &t) const
1320 If this node is a FunctionNode, the function returns \c true if
1321 the function has the tag \a t. Otherwise the function returns
1322 \c false. I don't know what the tag is used for.
1323 */
1324
1325/*! \fn const QMap<LinkType, std::pair<QString, QString> > &Node::links() const
1326 Returns a reference to this node's link map. The link map should
1327 probably be moved to the PageNode, because it contains links to the
1328 start page, next page, previous page, and contents page, and these
1329 are only used in PageNode, I think.
1330 */
1331
1332/*! \fn Access Node::access() const
1333 Returns the node's Access setting, which can be \c Public,
1334 \c Protected, or \c Private.
1335 */
1336
1337/*! \fn const Location& Node::declLocation() const
1338 Returns the Location where this node's declaration was seen.
1339 Normally the declaration location is in an \e include file.
1340 The declaration location is used in qdoc error/warning messages
1341 about the declaration.
1342 */
1343
1344/*! \fn const Location& Node::defLocation() const
1345 Returns the Location where this node's dedefinition was seen.
1346 Normally the definition location is in a \e .cpp file.
1347 The definition location is used in qdoc error/warning messages
1348 when the error is discovered at the location of the definition,
1349 although the way to correct the problem often requires changing
1350 the declaration.
1351 */
1352
1353/*! \fn const Location& Node::location() const
1354 If this node's definition location is empty, this function
1355 returns this node's declaration location. Otherwise it
1356 returns the definition location.
1357
1358 \sa Location
1359 */
1360
1361/*! \fn const Doc &Node::doc() const
1362 Returns a reference to the node's Doc data member.
1363
1364 \sa Doc
1365 */
1366
1367/*! \fn Status Node::status() const
1368 Returns the node's status value.
1369
1370 \sa Status
1371 */
1372
1373/*! \fn QString Node::since() const
1374 Returns the node's since string, which can be empty.
1375 */
1376
1377/*! \fn QString Node::templateStuff() const
1378 Returns the node's template parameters string, if this node
1379 represents a templated element.
1380 */
1381
1382/*! \fn bool Node::isSharingComment() const
1383 This function returns \c true if the node is sharing a comment
1384 with other nodes. For example, multiple functions can be documented
1385 with a single qdoc comment by listing the \c {\\fn} signatures for
1386 all the functions in the single qdoc comment.
1387 */
1388
1389/*! \fn QString Node::qmlTypeName() const
1390 If this is a QmlPropertyNode or a FunctionNode representing a QML
1391 method, this function returns the qmlTypeName() of
1392 the parent() node. Otherwise it returns the name data member.
1393 */
1394
1395/*! \fn QString Node::qmlFullBaseName() const
1396 If this is a QmlTypeNode, this function returns the QML full
1397 base name. Otherwise it returns an empty string.
1398 */
1399
1400/*! \fn QString Node::logicalModuleName() const
1401 If this is a CollectionNode, this function returns the logical
1402 module name. Otherwise it returns an empty string.
1403 */
1404
1405/*! \fn QString Node::logicalModuleVersion() const
1406 If this is a CollectionNode, this function returns the logical
1407 module version number. Otherwise it returns an empty string.
1408 */
1409
1410/*! \fn QString Node::logicalModuleIdentifier() const
1411 If this is a CollectionNode, this function returns the logical
1412 module identifier. Otherwise it returns an empty string.
1413 */
1414
1415/*! \fn void Node::setLogicalModuleInfo(const QString &arg)
1416 If this node is a CollectionNode, this function splits \a arg
1417 on the blank character to get a logical module name and version
1418 number. If the version number is present, it splits the version
1419 number on the '.' character to get a major version number and a
1420 minor version number. If the version number is present, both the
1421 major and minor version numbers should be there, but the minor
1422 version number is not absolutely necessary.
1423
1424 The strings are stored in the appropriate data members for use
1425 when the QML module page is generated.
1426 */
1427
1428/*! \fn void Node::setLogicalModuleInfo(const QStringList &info)
1429 If this node is a CollectionNode, this function accepts the
1430 logical module \a info as a string list. If the logical module
1431 info contains the version number, it splits the version number
1432 on the '.' character to get the major and minor version numbers.
1433 Both major and minor version numbers should be provided, but
1434 the minor version number is not strictly necessary.
1435
1436 The strings are stored in the appropriate data members for use
1437 when the QML module page is generated. This overload
1438 of the function is called when qdoc is reading an index file.
1439 */
1440
1441/*! \fn CollectionNode *Node::logicalModule() const
1442 If this is a QmlTypeNode, a pointer to its QML module is returned,
1443 which is a pointer to a CollectionNode. Otherwise the \c nullptr
1444 is returned.
1445 */
1446
1447/*! \fn void Node::setQmlModule(CollectionNode *t)
1448 If this is a QmlTypeNode, this function sets the QML type's QML module
1449 pointer to the CollectionNode \a t. Otherwise the function does nothing.
1450 */
1451
1452/*! \fn ClassNode *Node::classNode()
1453 If this is a QmlTypeNode, this function returns the pointer to
1454 the C++ ClassNode that this QML type represents. Otherwise the
1455 \c nullptr is returned.
1456 */
1457
1458/*! \fn void Node::setClassNode(ClassNode *cn)
1459 If this is a QmlTypeNode, this function sets the C++ class node
1460 to \a cn. The C++ ClassNode is the C++ implementation of the QML
1461 type.
1462 */
1463
1464/*! \fn NodeType Node::goal(const QString &t)
1465 When a square-bracket parameter is used in a qdoc command, this
1466 function might be called to convert the text string \a t obtained
1467 from inside the square brackets to be a Goal value, which is returned.
1468
1469 \sa Goal
1470 */
1471
1472QT_END_NAMESPACE
void addChild(Node *child)
Adds the child to this node's child list and sets the child's parent pointer to this Aggregate.
Definition doc.h:32
const Location & location() const
Returns the starting location of a qdoc comment.
Definition doc.cpp:89
Doc & operator=(const Doc &doc)
Definition doc.cpp:74
bool isMarkedReimp() const
Returns true if the set of metacommands used in the doc comment contains {reimp}.
Definition doc.cpp:235
bool isAutoGenerated() const
Returns true if this documentation was auto-generated by QDoc rather than written by an author.
Definition doc.cpp:244
QStringMultiMap * metaTagMap() const
Definition doc.cpp:342
bool isEmpty() const
Definition doc.cpp:109
static bool processInternalDocs(const InclusionPolicy &policy)
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
The Location class provides a way to mark a location in a file.
Definition location.h:20
int lineNo() const
Returns the current line number.
Definition location.h:50
Status
Specifies the status of the QQmlIncubator.
This class constructs and maintains a tree of instances of the subclasses of Node.
Definition tree.h:58
#define CONFIG_VERSION
Definition config.h:462
#define CONFIG_IGNORESINCE
Definition config.h:408
NodeType
Definition genustypes.h:165
@ SharedComment
Definition genustypes.h:188
Combined button and popup list for selecting options.
#define LT_RETURN_IF_NOT_EQUAL(a, b)
Definition node.cpp:56
#define LT_RETURN_IF_NOT_EQUAL_QSTR(a, b)
Definition node.cpp:61
@ Deprecated
Definition status.h:12
@ InternalAuto
Definition status.h:16
@ Internal
Definition status.h:15
bool isInternal
Definition nodecontext.h:21
bool isPureVirtual
Definition nodecontext.h:23
NodeType type
Definition nodecontext.h:18
bool isInternalAuto
Definition nodecontext.h:22
bool hasAutoGeneratedDoc
Definition nodecontext.h:24
The Node class is the base class for all the nodes in QDoc's parse tree.
bool isDontDocument() const
Returns true if this node's status is DontDocument.
Definition node.h:93
virtual QString plainName() const
Returns this node's name member.
Definition node.cpp:484
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition node.h:239
void setGenus(Genus t)
Definition node.h:86
virtual bool isWrapper() const
Returns true if the node is a class node or a QML type node that is marked as being a wrapper class o...
Definition node.cpp:989
bool isPrivate() const
Returns true if this node's access is Private.
Definition node.h:113
virtual bool isAbstract() const
Returns true if the ClassNode or QmlTypeNode is marked abstract.
Definition node.h:137
QString nodeTypeString() const
Returns this node's type as a string for use as an attribute value in XML or HTML.
Definition node.cpp:683
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:123
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
Definition node.cpp:868
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:106
NodeType nodeType() const override
Returns this node's type.
Definition node.h:82
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
Definition node.h:150
virtual Status status() const
Returns the node's status value.
Definition node.h:243
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:155
Aggregate * parent() const
Returns the node's parent pointer, that is, the aggregate under which the node is documented.
Definition node.h:211
static bool fromFlagValue(FlagValue fv, bool defaultValue)
Converts the enum fv back to a boolean value.
Definition node.cpp:770
void setLocation(const Location &t)
Sets the node's declaration location, its definition location, or both, depending on the suffix of th...
Definition node.cpp:909
QString plainFullName(const Node *relative=nullptr) const
Constructs and returns the node's fully qualified name by recursively ascending the parent links and ...
Definition node.cpp:498
FlagValue
A value used in PropertyNode and QmlPropertyNode that can be -1, 0, or +1.
Definition node.h:75
@ FlagValueTrue
Definition node.h:75
@ FlagValueFalse
Definition node.h:75
QString qualifyQmlName()
Returns the QML node's qualified name by prepending the logical module name.
Definition node.cpp:979
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:111
QString qualifyCppName()
Returns the CPP node's qualified name by prepending the namespaces name + "::" if there isw a namespa...
Definition node.cpp:957
ThreadSafeness inheritedThreadSafeness() const
If this node has a parent, the parent's thread safeness value is returned.
Definition node.cpp:857
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
Definition node.h:235
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
Definition node.h:232
bool isInternalAuto() const
Definition node.h:90
bool isFunction(Genus g=Genus::DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
Definition node.h:101
ThreadSafeness threadSafeness() const
Returns the thread safeness value for whatever this node represents.
Definition node.cpp:845
Aggregate * root() const
virtual bool isInAPI() const
Returns true if this node is considered to be part of the API as per the InclusionPolicy retrieved fr...
Definition node.cpp:927
QString fullDocumentName() const
Construct the full document name for this node and return it.
Definition node.cpp:997
virtual Tree * tree() const
Returns a pointer to the Tree this node is in.
Definition node.cpp:899
NodeContext createContext() const
Definition node.cpp:175
void setDoc(const Doc &doc, bool replace=false)
Sets this Node's Doc to doc.
Definition node.cpp:560
Node(NodeType type, Aggregate *parent, QString name)
Construct a node with the given type and having the given parent and name.
Definition node.cpp:601
ThreadSafeness
An unsigned char that specifies the degree of thread-safeness of the element.
Definition node.h:58
@ UnspecifiedSafeness
Definition node.h:59
QString fullName(const Node *relative) const
Constructs and returns this node's full name.
Definition node.cpp:544
virtual bool isPureVirtual() const
Definition node.h:118
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
Definition node.cpp:942
static Genus getGenus(NodeType t)
Determines the appropriate Genus value for the NodeType value t and returns that Genus value.
Definition node.cpp:624
static FlagValue toFlagValue(bool b)
Converts the boolean value b to an enum representation of the boolean type, which includes an enum va...
Definition node.cpp:759
bool isRelatedNonmember() const
Returns true if this is a related nonmember of something.
Definition node.h:124
void setSince(const QString &since)
Sets the information about the project and version a node was introduced in, unless the version is lo...
Definition node.cpp:797
virtual void setStatus(Status t)
Sets the node's status to t.
Definition node.cpp:574
QString extractClassName(const QString &string) const
Extract a class name from the type string and return it.
Definition node.cpp:817
void setDeprecated(const QString &sinceVersion)
Sets the Node status to Node::Deprecated, unless sinceVersion represents a future version.
Definition node.cpp:1044
static bool nodeSortKeyOrNameLessThan(const Node *n1, const Node *n2)
Returns true if node n1 is less than node n2 when comparing the sort keys, defined with.
Definition node.cpp:161
@ SignatureReturnType
Definition node.h:68
@ SignaturePlain
Definition node.h:66
static bool nodeNameOverloadLessThan(const Node *first, const Node *second)
Definition node.cpp:136
QString qualifyWithParentName()
Return the name of this node qualified with the parent name and "::" if there is a parent name.
Definition node.cpp:968
QString plainSignature() const
Constructs and returns the node's fully qualified signature by recursively ascending the parent links...
Definition node.cpp:522
static bool nodeLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:79