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
qqmldomconstants_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QQMLDOMCONSTANTS_P_H
6#define QQMLDOMCONSTANTS_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qqmldom_global.h"
20
21#include <QtCore/QObject>
22#include <QtCore/QMetaObject>
23#include <QtCore/private/qglobal_p.h>
24
26
27namespace QQmlJS{
28namespace Dom {
29
30Q_NAMESPACE_EXPORT(QMLDOM_EXPORT)
31
41Q_ENUM_NS(PathRoot)
42
56Q_ENUM_NS(PathCurrent)
57
59Q_ENUM_NS(Language)
60
61enum class ResolveOption{
63 TraceVisit=0x1 // call the function along all elements of the path, not just for the target (the function might be called even if the target is never reached)
64};
65Q_ENUM_NS(ResolveOption)
68
69enum class VisitOption {
70 None = 0,
71 VisitSelf = 0x1, // Visit the start item
72 VisitAdopted = 0x2, // Visit adopted types (but never recurses them)
73 Recurse = 0x4, // recurse non adopted types
74 NoPath = 0x8, // does not generate path consistent with visit
76};
77Q_ENUM_NS(VisitOption)
80
81enum class LookupOption {
82 Normal = 0,
83 Strict = 0x1,
84 VisitTopClassType = 0x2, // static lookup of class (singleton) or attached type, the default is
85 // visiting instance methods
87};
88Q_ENUM_NS(LookupOption)
91
93Q_ENUM_NS(LookupType)
94
101Q_ENUM_NS(VisitPrototypesOption)
104
106Q_ENUM_NS(DomKind)
107
108enum class DomType {
109 Empty, // only for default ctor
110
111 ExternalItemInfo, // base class for anything represented by an actual file
112 ExternalItemPair, // pair of newest version of item, and latest valid update ### REVISIT
113 // ExternalOwningItems refer to an external path and can be shared between environments
114 QmlDirectory, // dir e.g. used for implicit import
115 QmldirFile, // qmldir
116 JsFile, // file
117 QmlFile, // file
118 QmltypesFile, // qmltypes
119 GlobalScope, // language dependent (currently no difference)
120 /* enum A { B, C }
121 * *
122 EnumItem is marked with * */
124
125 // types
126 EnumDecl, // A in above example
127 JsResource, // QML file contains QML object, JSFile contains JsResource
128 QmltypesComponent, // Component inside a qmltypes fles; compared to component it has exported
129 // meta-object revisions; singleton flag; can export multiple names
130 QmlComponent, // "normal" QML file based Component; also can represent inline components
131 GlobalComponent, // component of global object ### REVISIT, try to replace with one of the above
132
133 ModuleAutoExport, // dependent imports to automatically load when a module is imported
134 ModuleIndex, // index for all the imports of a major version
135 ModuleScope, // a specific import with full version
136 ImportScope, // the scope including the types coming from one or more imports
137 Export, // An exported type
138
139 // header stuff
140 Import, // wrapped
142
143 // qml elements
145 QmlObject, // the Item in Item {}; also used to represent types in qmltype files
146 ConstantData, // the 2 in "property int i: 2"; can be any generic data in a QML document
147 SimpleObjectWrap, // internal wrapping to give uniform DOMItem access; ### research more
148 ScriptExpression, // wraps an AST script expression as a DOMItem
149 Reference, // reference to another DOMItem; e.g. asking for a type of an object returns a
150 // Reference
151 PropertyDefinition, // _just_ the property definition; without the binding, even if it's one
152 // line
153 Binding, // the part after the ":"
155 MethodInfo, // container of MethodParameter
156 Version, // wrapped
158 CommentedElement, // attached to AST if they have pre-/post-comments?
159 RegionComments, // DomItems have attached RegionComments; can attach comments to fine grained
160 // "regions" in a DomItem; like the default keyword of a property definition
161 AstComments, // hash-table from AST node to commented element
162 FileLocationsInfo, // mapping from DomItem to file location ### REVISIT: try to move out of
163 // hierarchy?
164
165 // convenience collecting types
166 PropertyInfo, // not a DOM Item, just a convenience class
167
168 // Moc objects, mainly for testing ### Try to remove them; replace their usage in tests with
169 // "real" instances
172
173 // containers
177
178 // supporting objects
179 LoadInfo, // owning, used inside DomEnvironment ### REVISIT: move out of hierarchy
180 ErrorMessage, // wrapped
182
183 // Dom top level
184 DomEnvironment, // a consistent view of modules, types, files, etc.
185 DomUniverse, // a cache of what can be found in the DomEnvironment, contains the latest valid
186 // version for every file/type, etc. + latest overall
187
188 // Dom Script elements
189 // TODO
190 ScriptElementWrap, // internal wrapping to give uniform access of script elements (e.g. for
191 // statement lists)
192 ScriptElementStart, // marker to check if a DomType is a scriptelement or not
241
242 ScriptElementStop, // marker to check if a DomType is a scriptelement or not
243};
244Q_ENUM_NS(DomType)
245
246enum class SimpleWrapOption { None = 0, ValueType = 1 };
247Q_ENUM_NS(SimpleWrapOption)
250
252Q_ENUM_NS(BindingValueKind)
253
255Q_ENUM_NS(BindingType)
256
261Q_ENUM_NS(ListOptions)
262
267Q_ENUM_NS(EscapeOptions)
268
276Q_ENUM_NS(ErrorLevel)
277
285Q_ENUM_NS(AstDumperOption)
288
289enum class GoTo {
290 Strict, // never go to an non uniquely defined result
291 MostLikely // if needed go up to the most likely location between multiple options
292};
293Q_ENUM_NS(GoTo)
294
296Q_ENUM_NS(AddOption)
297
298/*!
299\internal
300FilterUpOptions decide in which direction the filtering is done.
301ReturnInner starts the search at top(), and work its way down to the current
302element.
303ReturnOuter and ReturnOuterNoSelf starts the search at the current element and
304works their way up to to top().
305*/
307Q_ENUM_NS(FilterUpOptions)
308
316Q_ENUM_NS(WriteOutCheck)
319
321 None = 0x0,
324 Signal = 0x4,
325 Method = 0x8,
326 Attribute = 0x10,
327 Id = 0x20,
328 Namespace = 0x40,
329 Global = 0x80,
331 Singleton = 0x200,
333};
334Q_ENUM_NS(LocalSymbolsType)
337
338/*!
339\internal
340The FileLocationRegion allows to map the different FileLocation subregions to their position in
341the actual code. For example, \c{ColonTokenRegion} denotes the position of the ':' token in a
342binding like `myProperty: something()`, or the ':' token in a pragma like `pragma Hello: World`.
343
344These are used for formatting in qmlformat and autocompletion in qmlls.
345
346MainRegion denotes the entire FileLocation region.
347
348\sa{OutWriter::regionToString}, {FileLocations::regionName}
349*/
414};
416
417enum DomCreationOption : char {
418 Default, // required by qmlformat for example
419 Extended, // required by qmlls for example
420 Minimal, // required by QmlDocumentParser in Qt Design Studio, for example
421};
422
423} // end namespace Dom
424} // end namespace QQmlJS
425
426QT_END_NAMESPACE
427
428#endif // QQMLDOMCONSTANTS_P_H
std::pair< AST::Node *, CommentAnchor > CommentKey
Represents a comment.
Keeps the comment associated with an element.
A value type that references any element of the Dom.
Represents a Node of FileLocations tree.
std::function< index_type(const DomItem &)> Length
std::function< QSet< QString >(const DomItem &)> Keys
QMap< QString, QMap< QString, MockObject > > subMaps
A DomItem that owns other DomItems and is managed through a shared pointer.
static constexpr DomType kindValue
static constexpr DomType kindValue
Keeps the comments associated with a DomItem.
\inmodule QtSql
Provides entities to maintain mappings between elements and their location in a file.
Q_ENUM_NS(FileLocationRegion)
QString fileLocationRegionName(FileLocationRegion region)
FileLocationRegion fileLocationRegionValue(QStringView region)
static QMetaEnum regionEnum
QCborValue sourceLocationToQCborValue(QQmlJS::SourceLocation loc)
#define QMLDOM_EXPORT
qOverloadedVisitor(Ts...) -> qOverloadedVisitor< Ts... >