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
collectionnode.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
5
6#include <QtCore/qstringlist.h>
7
9
10/*!
11 \class CollectionNode
12 \brief A class for holding the members of a collection of doc pages.
13 */
14
15/*!
16 Appends \a node to the collection node's member list, if
17 and only if it isn't already in the member list.
18 */
20{
21 if (!m_members.contains(node))
22 m_members.append(node);
23}
24
25/*!
26 Returns \c true if this collection node contains at least
27 one namespace node.
28 */
30{
31 return std::any_of(m_members.cbegin(), m_members.cend(), [](const Node *member) {
32 return member->isClassNode() && member->isInAPI();
33 });
34}
35
36/*!
37 Returns \c true if this collection node contains at least
38 one class node.
39 */
41{
42 return std::any_of(m_members.cbegin(), m_members.cend(), [](const Node *member) {
43 return member->isClassNode() && member->isInAPI();
44 });
45}
46
47/*!
48 \fn template <typename F> NodeMap CollectionNode::getMembers(const F &&predicate) const
49
50 Returns a map containing this collection node's member nodes for which \c
51 predicate(node) returns \c true. The \a predicate is a function or a
52 lambda that takes a const Node pointer as an argument and returns a bool.
53*/
54
55/*!
56 \fn NodeMap CollectionNode::getMembers(Node::NodeType type) const
57
58 Returns a map containing this collection node's member nodes with
59 a specified node \a type.
60*/
61
62/*!
63 Returns the logical module version.
64*/
66{
67 QStringList version;
68 version << m_logicalModuleVersionMajor << m_logicalModuleVersionMinor;
69 version.removeAll(QString());
70 return version.join(".");
71}
72
73/*!
74 This function accepts the logical module \a info as a string
75 list. If the logical module info contains the version number,
76 it splits the version number on the '.' character to get the
77 major and minor version numbers. Both major and minor version
78 numbers should be provided, but the minor version number is
79 not strictly necessary.
80 */
81void CollectionNode::setLogicalModuleInfo(const QStringList &info)
82{
83 m_logicalModuleName = info[0];
84 if (info.size() > 1) {
85 QStringList dotSplit = info[1].split(QLatin1Char('.'));
86 m_logicalModuleVersionMajor = dotSplit[0];
87 if (dotSplit.size() > 1)
88 m_logicalModuleVersionMinor = dotSplit[1];
89 else
90 m_logicalModuleVersionMinor = "0";
91 }
92}
93
94/*!
95 \fn void CollectionNode::setState(const QString &state)
96 \fn QString CollectionNode::state()
97
98 Sets or gets a description of this module's state. For example,
99 \e {"Technical Preview"}. This string is used when generating the
100 module's documentation page and reference pages of the module's
101 members.
102*/
103
104QT_END_NAMESPACE
A class for holding the members of a collection of doc pages.
QString logicalModuleVersion() const override
Returns the logical module version.
bool hasClasses() const override
Returns true if this collection node contains at least one class node.
bool hasNamespaces() const override
Returns true if this collection node contains at least one namespace node.
void setLogicalModuleInfo(const QStringList &info) override
This function accepts the logical module info as a string list.
void addMember(Node *node) override
Appends node to the collection node's member list, if and only if it isn't already in the member list...
bool isInAPI() const
Definition node.h:272
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
Combined button and popup list for selecting options.