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
classnode.h
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#ifndef CLASSNODE_H
5#define CLASSNODE_H
6
7#include "aggregate.h"
8#include "relatedclass.h"
9
10#include <QtCore/qglobal.h>
11#include <QtCore/qlist.h>
12#include <QtCore/qstring.h>
13
15
16class FunctionNode;
17class PropertyNode;
18class QmlTypeNode;
19
20class ClassNode : public Aggregate
21{
22public:
23 ClassNode(NodeType type, Aggregate *parent, const QString &name) : Aggregate(type, parent, name)
24 {
25 }
26 [[nodiscard]] bool isFirstClassAggregate() const override { return true; }
27 [[nodiscard]] bool isClassNode() const override { return true; }
28 [[nodiscard]] bool isRelatableType() const override { return true; }
29 [[nodiscard]] bool isWrapper() const override { return m_wrapper; }
30 void setWrapper() override { m_wrapper = true; }
31
32 void addResolvedBaseClass(Access access, ClassNode *node);
33 void addDerivedClass(Access access, ClassNode *node);
34 void addUnresolvedBaseClass(Access access, const QStringList &path);
37
38 QList<RelatedClass> &baseClasses() { return m_bases; }
39 QList<RelatedClass> &derivedClasses() { return m_derived; }
40 QList<RelatedClass> &ignoredBaseClasses() { return m_ignoredBases; }
41
42 [[nodiscard]] const QList<RelatedClass> &baseClasses() const { return m_bases; }
43
44 [[nodiscard]] bool isAbstract() const override { return m_abstract; }
45 void setAbstract(bool b) override { m_abstract = b; }
46 PropertyNode *findPropertyNode(const QString &name);
49 [[nodiscard]] bool docMustBeGenerated() const override;
50
51 void insertQmlNativeType(QmlTypeNode *qmlTypeNode) { m_nativeTypeForQml << qmlTypeNode; }
52 bool isQmlNativeType() { return !m_nativeTypeForQml.empty(); }
53 const QSet<QmlTypeNode *> &qmlNativeTypes() { return m_nativeTypeForQml; }
54
55private:
56 void promotePublicBases(const QList<RelatedClass> &bases);
57
58private:
59 QList<RelatedClass> m_bases {};
60 QList<RelatedClass> m_derived {};
61 QList<RelatedClass> m_ignoredBases {};
62 bool m_abstract { false };
63 bool m_wrapper { false };
64 QSet<QmlTypeNode *> m_nativeTypeForQml;
65};
66
67QT_END_NAMESPACE
68
69#endif // CLASSNODE_H
#define ATOM_FORMATTING_TELETYPE
Definition atom.h:207
#define ATOM_FORMATTING_BOLD
Definition atom.h:199
#define ATOM_FORMATTING_TRADEMARK
Definition atom.h:208
#define ATOM_LIST_VALUE
Definition atom.h:214
#define ATOM_FORMATTING_ITALIC
Definition atom.h:201
#define ATOM_FORMATTING_LINK
Definition atom.h:202
const NodeList & childNodes() const
Returns a const reference to the child list.
Definition aggregate.h:41
The Atom class is the fundamental unit for representing documents internally.
Definition atom.h:18
AtomType type() const
Return the type of this atom.
Definition atom.h:149
AtomType
\value AnnotatedList \value AutoLink \value BaseName \value BriefLeft \value BriefRight \value C \val...
Definition atom.h:20
@ DivRight
Definition atom.h:39
@ FormatElse
Definition atom.h:44
@ Code
Definition atom.h:30
@ String
Definition atom.h:92
@ ListLeft
Definition atom.h:62
@ ExampleFileLink
Definition atom.h:40
@ ListRight
Definition atom.h:68
@ ParaRight
Definition atom.h:75
@ FormattingLeft
Definition atom.h:47
@ FormattingRight
Definition atom.h:48
@ Link
Definition atom.h:60
@ FormatEndif
Definition atom.h:45
@ ExampleImageLink
Definition atom.h:41
@ AutoLink
Definition atom.h:22
@ LinkNode
Definition atom.h:61
@ ParaLeft
Definition atom.h:74
@ FormatIf
Definition atom.h:46
const Atom * next() const
Return the next atom in the atom list.
Definition atom.h:146
The ClassNode represents a C++ class.
Definition classnode.h:21
PropertyNode * findPropertyNode(const QString &name)
Search the child list to find the property node with the specified name.
Definition classnode.cpp:57
QList< RelatedClass > & derivedClasses()
Definition classnode.h:39
void addResolvedBaseClass(Access access, ClassNode *node)
Adds the base class node to this class's list of base classes.
Definition classnode.cpp:27
QList< RelatedClass > & baseClasses()
Definition classnode.h:38
PropertyNode * findOverriddenProperty(const FunctionNode *fn)
fn is an overriding function in this class or in a class derived from this class.
FunctionNode * findOverriddenFunction(const FunctionNode *fn)
fn is an overriding function in this class or in a class derived from this class.
const QList< RelatedClass > & baseClasses() const
Definition classnode.h:42
bool isAbstract() const override
Returns true if the ClassNode or QmlTypeNode is marked abstract.
Definition classnode.h:44
QList< RelatedClass > & ignoredBaseClasses()
Definition classnode.h:40
bool isRelatableType() const override
Returns true if this node is something you can relate things to with the relates command.
Definition classnode.h:28
const QSet< QmlTypeNode * > & qmlNativeTypes()
Definition classnode.h:53
void setAbstract(bool b) override
If this node is a ClassNode or a QmlTypeNode, the node's abstract flag data member is set to b.
Definition classnode.h:45
bool docMustBeGenerated() const override
Returns true if the class or struct represented by this class node must be documented.
bool isFirstClassAggregate() const override
Returns true if this Node is an Aggregate but not a ProxyNode.
Definition classnode.h:26
void removePrivateAndInternalBases()
Remove private and internal bases classes from this class's list of base classes.
bool isQmlNativeType()
Definition classnode.h:52
bool isWrapper() const override
Returns true if the node is a class node or a QML type node that is marked as being a wrapper class o...
Definition classnode.h:29
void insertQmlNativeType(QmlTypeNode *qmlTypeNode)
Definition classnode.h:51
bool isClassNode() const override
Returns true if this is an instance of ClassNode.
Definition classnode.h:27
ClassNode(NodeType type, Aggregate *parent, const QString &name)
Definition classnode.h:23
void resolvePropertyOverriddenFromPtrs(PropertyNode *pn)
void addDerivedClass(Access access, ClassNode *node)
Adds the derived class node to this class's list of derived classes.
Definition classnode.cpp:37
void setWrapper() override
If this node is a ClassNode or a QmlTypeNode, the node's wrapper flag data member is set to true.
Definition classnode.h:30
void addUnresolvedBaseClass(Access access, const QStringList &path)
Add an unresolved base class to this class node's list of base classes.
Definition classnode.cpp:48
A class for holding the members of a collection of doc pages.
bool wasSeen() const override
Returns the seen flag data member of this node if it is a NamespaceNode or a CollectionNode.
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:84
bool preparing() const
Definition config.h:181
bool generating() const
Definition config.h:182
const Location & location() const
Returns the starting location of a qdoc comment.
Definition doc.cpp:90
const Text & body() const
Definition doc.cpp:115
QStringMultiMap * metaTagMap() const
Definition doc.cpp:292
Encapsulate the logic that QDoc uses to find files whose path is provided by the user and that are re...
This node is used to represent any kind of function being documented.
signed short overloadNumber() const
Returns the overload number for this function.
bool isPrivateSignal() const
const Parameters & parameters() const
bool isMAssign() const
bool isVirtual() const
bool isCAssign() const
bool isInvokable() const
bool isDeprecated() const override
\reimp
bool hasOverloads() const
Returns true if this function has overloads.
bool returnsBool() const
bool isMarkedReimp() const override
Returns true if the FunctionNode is marked as a reimplemented function.
bool isDtor() const
bool isSignal() const
bool isQmlSignal() const
bool isOverload() const
bool isIgnored() const
In some cases, it is ok for a public function to be not documented.
bool isCCtor() const
bool isMCtor() const
bool isCtor() const
bool hasAssociatedProperties() const
Metaness metaness() const
bool m_quoting
Definition generator.h:203
void signatureList(const NodeList &nodes, const Node *relative, CodeMarker *marker)
Generate a bullet list of function signatures.
void appendSignature(Text &text, const Node *node)
Append the signature for the function named in node to text, so that is a link to the documentation f...
virtual void generateCollectionNode(CollectionNode *, CodeMarker *)
Definition generator.h:89
virtual void generateProxyPage(Aggregate *, CodeMarker *)
Definition generator.h:86
virtual void generateCppReferencePage(Aggregate *, CodeMarker *)
Definition generator.h:85
bool generateComparisonCategory(const Node *node, CodeMarker *marker=nullptr)
QMap< QString, QString > & formattingRightMap()
virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker, bool generateNote)
Generates an addendum note of type type for node, using marker as the code marker.
virtual QString typeString(const Node *node)
static bool hasExceptions(const Node *node, NodeList &reentrant, NodeList &threadsafe, NodeList &nonreentrant)
void generateEnumValuesForQmlProperty(const Node *node, CodeMarker *marker)
FileResolver & file_resolver
Definition generator.h:194
virtual void initializeFormat()
Reads format-specific variables from config, sets output (sub)directories, creates them on the filesy...
virtual void generateDocumentation(Node *node)
Recursive writing of HTML files from the root node.
static void initialize()
const Atom * generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, bool generate, int &numGeneratedAtoms)
void generateStatus(const Node *node, CodeMarker *marker)
virtual void generateAlsoList(const Node *node, CodeMarker *marker)
void appendFullName(Text &text, const Node *apparentNode, const Node *relative, const Node *actualNode=nullptr)
Definition generator.cpp:92
virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images)
This function is called when the documentation for an example is being formatted.
void generateThreadSafeness(const Node *node, CodeMarker *marker)
Generates text that explains how threadsafe and/or reentrant node is.
static void terminate()
Generator(FileResolver &file_resolver)
Constructs the generator base class.
Definition generator.cpp:76
QDocDatabase * m_qdb
Definition generator.h:196
bool m_inContents
Definition generator.h:198
bool generateComparisonList(const Node *node)
Generates a list of types that compare to node with the comparison category that applies for the rela...
static bool useOutputSubdirs()
Definition generator.h:68
void generateNoexceptNote(const Node *node, CodeMarker *marker)
void unknownAtom(const Atom *atom)
virtual bool generateText(const Text &text, const Node *relative, CodeMarker *marker)
Generate the documentation for relative.
virtual void terminateGenerator()
static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType)
QString fullDocumentLocation(const Node *node)
Returns the full document location.
bool m_inLink
Definition generator.h:197
void addImageToCopy(const ExampleNode *en, const ResolvedFile &resolved_file)
virtual void generateDocs()
Traverses the database recursively to generate all the documentation.
int appendSortedQmlNames(Text &text, const Node *base, const NodeList &subs)
bool m_inTableHeader
Definition generator.h:200
void generateOverloadedSignal(const Node *node, CodeMarker *marker)
If the node is an overloaded signal, add a node with an example on how to connect to it.
static bool appendTrademark(const Atom *atom)
Returns true if a trademark symbol should be appended to the output as determined by atom.
bool m_inSectionHeading
Definition generator.h:199
virtual int skipAtoms(const Atom *atom, Atom::AtomType type) const
int m_numTableRows
Definition generator.h:204
bool m_threeColumnEnumValueTable
Definition generator.h:201
virtual void generateQmlTypePage(QmlTypeNode *, CodeMarker *)
Definition generator.h:87
QTextStream & out()
virtual void generateBody(const Node *node, CodeMarker *marker)
Generate the body of the documentation from the qdoc comment found with the entity represented by the...
QString outFileName()
virtual void generatePageNode(PageNode *, CodeMarker *)
Definition generator.h:88
virtual ~Generator()
Destroys the generator after removing it from the list of output generators.
Definition generator.cpp:87
void generateSince(const Node *node, CodeMarker *marker)
QMap< QString, QString > & formattingLeftMap()
int appendSortedNames(Text &text, const ClassNode *classe, const QList< RelatedClass > &classes)
void endSubPage()
Flush the text stream associated with the subpage, and then pop it off the text stream stack and dele...
virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker)
Definition generator.h:122
static void resetUseOutputSubdirs()
Definition generator.h:67
@ AssociatedProperties
Definition generator.h:39
@ PrivateSignal
Definition generator.h:37
@ QmlSignalHandler
Definition generator.h:38
@ BindableProperty
Definition generator.h:40
bool m_showInternal
Definition generator.h:202
virtual void generateGenericCollectionPage(CollectionNode *, CodeMarker *)
Definition generator.h:90
virtual QString fileBase(const Node *node) const
virtual void initializeGenerator()
Updates the generator's m_showInternal from the Config.
void initializeTextOutput()
Resets the variables used during text output.
void generateRequiredLinks(const Node *node, CodeMarker *marker)
Generates either a link to the project folder for example node, or a list of links files/images if 'u...
static Generator * currentGenerator()
Definition generator.h:57
The Location class provides a way to mark a location in a file.
Definition location.h:15
Location()
Constructs an empty location.
Definition location.cpp:40
bool isGenericCollection() const
Returns true if the node type is Collection.
Definition node.h:166
bool isExternalPage() const
Returns true if the node type is ExternalPage.
Definition node.h:134
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition node.h:271
bool isQmlNode() const
Returns true if this node's Genus value is QML.
Definition node.h:153
virtual bool docMustBeGenerated() const
This function is called to perform a test to decide if the node must have documentation generated.
Definition node.h:228
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:953
bool isPrivate() const
Returns true if this node's access is Private.
Definition node.h:146
NodeType
An unsigned char value that identifies an object as a particular subclass of Node.
Definition node.h:54
@ Variable
Definition node.h:69
@ Module
Definition node.h:71
@ Struct
Definition node.h:58
@ QmlModule
Definition node.h:73
@ Typedef
Definition node.h:66
@ QmlValueType
Definition node.h:75
@ Function
Definition node.h:65
@ TypeAlias
Definition node.h:67
@ Union
Definition node.h:59
@ Page
Definition node.h:61
@ Group
Definition node.h:70
@ Enum
Definition node.h:62
@ HeaderFile
Definition node.h:60
@ QmlProperty
Definition node.h:74
@ QmlType
Definition node.h:72
@ SharedComment
Definition node.h:76
@ Namespace
Definition node.h:56
@ Property
Definition node.h:68
@ Class
Definition node.h:57
bool isNamespace() const
Returns true if the node type is Namespace.
Definition node.h:143
ComparisonCategory comparisonCategory() const
Definition node.h:217
bool hasFileNameBase() const
Returns true if the node's file name base has been set.
Definition node.h:200
bool isFunction(Genus g=DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
Definition node.h:135
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:155
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
Definition node.h:158
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:849
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:140
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
Definition node.h:182
virtual bool isMacro() const
returns true if either FunctionNode::isMacroWithParams() or FunctionNode::isMacroWithoutParams() retu...
Definition node.h:181
bool isEnumType() const
Returns true if the node type is Enum.
Definition node.h:132
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:187
virtual bool isAttached() const
Returns true if the QML property or QML method node is marked as attached.
Definition node.h:176
Aggregate * parent() const
Returns the node's parent pointer.
Definition node.h:244
virtual bool isDeprecated() const
Returns true if this node's status is Deprecated.
Definition node.h:168
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
Definition node.h:170
NodeType nodeType() const
Returns this node's type.
Definition node.h:121
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:57
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
Definition node.h:267
bool isProxyNode() const
Returns true if the node type is Proxy.
Definition node.h:148
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
Definition node.h:264
ThreadSafeness threadSafeness() const
Returns the thread safeness value for whatever this node represents.
Definition node.cpp:826
virtual bool isMarkedReimp() const
Returns true if the FunctionNode is marked as a reimplemented function.
Definition node.h:184
bool isProperty() const
Returns true if the node type is Property.
Definition node.h:147
bool isModule() const
Returns true if the node type is Module.
Definition node.h:142
virtual bool isPropertyGroup() const
Returns true if the node is a SharedCommentNode for documenting multiple C++ properties or multiple Q...
Definition node.h:185
Genus genus() const
Returns this node's Genus.
Definition node.h:124
ThreadSafeness
An unsigned char that specifies the degree of thread-safeness of the element.
Definition node.h:97
@ ThreadSafe
Definition node.h:101
@ UnspecifiedSafeness
Definition node.h:98
@ Reentrant
Definition node.h:100
bool isSharingComment() const
This function returns true if the node is sharing a comment with other nodes.
Definition node.h:285
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
Definition node.cpp:906
LinkType
An unsigned char value that probably should be moved out of the Node base class.
Definition node.h:112
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
Definition node.h:177
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
Definition node.h:178
@ Internal
Definition node.h:93
@ Active
Definition node.h:92
@ Deprecated
Definition node.h:90
@ Preliminary
Definition node.h:91
bool isQmlModule() const
Returns true if the node type is QmlModule.
Definition node.h:152
@ SignaturePlain
Definition node.h:105
bool isExample() const
Returns true if the node type is Example.
Definition node.h:133
bool isIndexNode() const
Returns true if this node was created from something in an index file.
Definition node.h:141
Status status() const
Returns the node's status value.
Definition node.h:278
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
Definition node.h:154
OpenedList(ListStyle style)
A PageNode is a Node that generates a documentation page.
Definition pagenode.h:18
bool noAutoList() const
Returns the value of the no auto-list flag.
Definition pagenode.h:41
This class describes one instance of using the Q_PROPERTY macro.
PropertyType propertyType() const
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
const CollectionNode * getModuleNode(const Node *relative)
Returns the collection node representing the module that relative node belongs to,...
void mergeCollections(CollectionNode *c)
Finds all the collection nodes with the same name and type as c and merges their members into the mem...
const EnumNode * enumNode() const
Returns the node representing the C++ enumeration associated with this property, or \nullptr.
Definition text.h:12
const Atom * firstAtom() const
Definition text.h:34
bool isEmpty() const
Definition text.h:31
void clear()
Definition text.cpp:269
#define SKIP_CHAR()
#define CONFIG_REDIRECTDOCUMENTATIONTODEVNULL
Definition config.h:374
#define CONFIG_AUTOLINKERRORS
Definition config.h:323
#define CONFIG_EXTRAIMAGES
Definition config.h:340
#define CONFIG_EXAMPLES
Definition config.h:336
#define CONFIG_URL
Definition config.h:391
#define CONFIG_OUTPUTSUFFIXES
Definition config.h:371
#define CONFIG_OUTPUTPREFIXES
Definition config.h:370
#define CONFIG_NOLINKERRORS
Definition config.h:367
#define CONFIG_PROJECT
Definition config.h:373
#define CONFIG_EXAMPLESINSTALLPATH
Definition config.h:337
#define CONFIG_PRODUCTNAME
Definition config.h:372
#define CONFIG_QUOTINGINFORMATION
Definition config.h:376
#define CONFIG_STYLESHEETS
Definition config.h:384
#define CONFIG_FORMATTING
Definition config.h:342
#define CONFIG_SCRIPTS
Definition config.h:377
QMultiMap< QString, QString > QStringMultiMap
Definition doc.h:28
Combined button and popup list for selecting options.
QList< Node * > NodeList
Definition node.h:41
static QLatin1String gt("&gt;")
#define SKIP_SPACE
static void startNote(Text &text)
static QLatin1String amp("&amp;")
static QLatin1String quot("&quot;")
static QLatin1String lt("&lt;")
static QRegularExpression tag("</?@[^>]*>")
std::optional< QString > formatStatus(const Node *node, QDocDatabase *qdb)
Represents a file that is reachable by QDoc based on its current configuration.