Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
sharedcommentnode.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
"sharedcommentnode.h"
5
6
#
include
"aggregate.h"
7
#
include
"functionnode.h"
8
#
include
"qmltypenode.h"
9
10
QT_BEGIN_NAMESPACE
11
12
using
namespace
Qt::StringLiterals;
13
14
SharedCommentNode
::
SharedCommentNode
(
QmlTypeNode
*parent,
int
count, QString &group)
15
:
Node
(
NodeType
::
SharedComment
, parent, group)
16
{
17
m_collective.reserve(count);
18
}
19
20
/*!
21
Returns the logical module name of the parent, as for the
22
QML methods and properties that the shared comment documents.
23
*/
24
QString
SharedCommentNode
::
logicalModuleName
()
const
25
{
26
return
parent
()->logicalModuleName();
27
}
28
29
/*!
30
Searches the shared comment node's member nodes for function
31
nodes. Each function node's overload flag is set.
32
33
If the shared comment is marked with \\overload primary, only the
34
first function in the collective is marked as the primary overload.
35
*/
36
void
SharedCommentNode
::
setOverloadFlags
()
37
{
38
// Check if this is \overload primary
39
const
auto
&overloadArgs =
doc
().overloadList();
40
bool
isPrimaryOverload = !overloadArgs.isEmpty()
41
&& overloadArgs.first().first ==
"__qdoc_primary_overload__"_L1
;
42
43
size_t functionIndex = 0;
44
for
(
auto
*node : m_collective) {
45
if
(node->isFunction()) {
46
auto
*fn =
static_cast
<FunctionNode *>(node);
47
48
// Only the FIRST function in a shared comment gets the primary flag
49
if
(isPrimaryOverload && functionIndex == 0)
50
fn->setPrimaryOverloadFlag();
51
52
fn->setOverloadFlag();
53
++functionIndex;
54
}
55
}
56
}
57
58
/*!
59
Clone this node on the heap and make the clone a child of
60
\a parent.
61
62
Returns the pointer to the clone.
63
*/
64
Node
*
SharedCommentNode
::
clone
(
Aggregate
*parent)
65
{
66
auto
*scn =
new
SharedCommentNode
(*
this
);
// shallow copy
67
scn
->
setParent
(
nullptr
);
68
parent
->
addChild
(scn);
69
70
return
scn;
71
}
72
73
/*!
74
Sets the related nonmember flag in this node and in each
75
node in the shared comment's collective to \a value.
76
*/
77
void
SharedCommentNode
::
setRelatedNonmember
(
bool
value)
78
{
79
Node
::
setRelatedNonmember
(value);
80
for
(
auto
*node : m_collective)
81
node->setRelatedNonmember(value);
82
}
83
84
QT_END_NAMESPACE
Aggregate
Definition
aggregate.h:23
Aggregate::addChild
void addChild(Node *child)
Adds the child to this node's child list and sets the child's parent pointer to this Aggregate.
Definition
aggregate.cpp:529
QmlTypeNode
Definition
qmltypenode.h:23
SharedCommentNode
Definition
sharedcommentnode.h:19
SharedCommentNode::setOverloadFlags
void setOverloadFlags()
Searches the shared comment node's member nodes for function nodes.
Definition
sharedcommentnode.cpp:36
SharedCommentNode::clone
Node * clone(Aggregate *parent) override
Clone this node on the heap and make the clone a child of parent.
Definition
sharedcommentnode.cpp:64
SharedCommentNode::setRelatedNonmember
void setRelatedNonmember(bool value) override
Sets the related nonmember flag in this node and in each node in the shared comment's collective to v...
Definition
sharedcommentnode.cpp:77
SharedCommentNode::SharedCommentNode
SharedCommentNode(QmlTypeNode *parent, int count, QString &group)
Definition
sharedcommentnode.cpp:14
SharedCommentNode::logicalModuleName
QString logicalModuleName() const override
Returns the logical module name of the parent, as for the QML methods and properties that the shared ...
Definition
sharedcommentnode.cpp:24
NodeType
NodeType
Definition
genustypes.h:165
NodeType::SharedComment
@ SharedComment
Definition
genustypes.h:188
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
Node
The Node class is the base class for all the nodes in QDoc's parse tree.
Definition
src_corelib_text_qstring.cpp:10
Node::doc
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition
node.h:239
Node::parent
Aggregate * parent() const
Returns the node's parent pointer, that is, the aggregate under which the node is documented.
Definition
node.h:211
Node::setRelatedNonmember
virtual void setRelatedNonmember(bool b)
Sets a flag in the node indicating whether this node is a related nonmember of something.
Definition
node.h:188
Node::setParent
void setParent(Aggregate *n)
Sets the node's parent pointer to n.
Definition
node.h:182
qttools
src
qdoc
qdoc
src
qdoc
sharedcommentnode.cpp
Generated on
for Qt by
1.18.0