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
nativeenum.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 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
"nativeenum.h"
5
6
#
include
"enumnode.h"
7
#
include
"node.h"
8
#
include
"qdocdatabase.h"
9
10
using
namespace
Qt::Literals::StringLiterals;
11
12
QT_BEGIN_NAMESPACE
13
14
/*!
15
\class NativeEnum
16
\brief Encapsulates information about native (C++) enum values.
17
18
The NativeEnum resolves a qualified path to a C++ enum into a
19
EnumNode pointer. This information is used for replicating the
20
enumerator documentation in QML API reference.
21
*/
22
23
/*!
24
\class NativeEnumInterface
25
\brief Interface implemented by Node subclasses that can refer
26
to a C++ enum.
27
28
Nodes implementing this interface provide a const and a non-const
29
getter returning a NativeEnum pointer.
30
*/
31
32
/*!
33
Locates the node specified by \a path and sets it as the C++ enumeration
34
associated with this property.
35
36
\a registeredQmlName is a prefix to use in the generated enum value
37
documentation; each enumerator is prefixed with \c {<registeredQmlName>.}
38
39
\note The target EnumNode is searched under the primary tree only.
40
41
Returns \c true on success.
42
*/
43
bool
NativeEnum
::
resolve
(
const
QString &path,
const
QString ®isteredQmlName)
44
{
45
m_enumNode =
static_cast
<
EnumNode
*>(
46
QDocDatabase
::
qdocDB
(
)
->
primaryTree
(
)
->findNodeByNameAndType(path.split(u"::"_s), &
Node
::isEnumType)
47
);
48
if
(m_enumNode && !registeredQmlName.isEmpty())
49
m_prefix = registeredQmlName;
50
return
m_enumNode !=
nullptr
;
51
}
52
53
QT_END_NAMESPACE
EnumNode
Definition
enumnode.h:22
NativeEnum
Encapsulates information about native (C++) enum values.
Definition
nativeenum.h:14
NativeEnum::resolve
bool resolve(const QString &path, const QString ®isteredQmlName)
Locates the node specified by path and sets it as the C++ enumeration associated with this property.
Definition
nativeenum.cpp:43
QDocDatabase
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
Definition
qdocdatabase.h:214
QDocDatabase::qdocDB
static QDocDatabase * qdocDB()
Creates the singleton.
Definition
qdocdatabase.cpp:373
QDocDatabase::primaryTree
Tree * primaryTree()
Definition
qdocdatabase.h:436
Node
The Node class is the base class for all the nodes in QDoc's parse tree.
Definition
src_corelib_text_qstring.cpp:10
qttools
src
qdoc
qdoc
src
qdoc
nativeenum.cpp
Generated on
for Qt by
1.18.0