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
qqmljsengine_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 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
QQMLJSENGINE_P_H
6
#
define
QQMLJSENGINE_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
"qqmljsglobal_p.h"
20
#
include
<
private
/
qqmljssourcelocation_p
.
h
>
21
22
#
include
<
private
/
qqmljsmemorypool_p
.
h
>
23
24
#
include
<
QtCore
/
qstring
.
h
>
25
#
include
<
QtCore
/
qset
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
namespace
QQmlJS
{
30
31
class
Lexer;
32
class
MemoryPool
;
33
34
class
QML_PARSER_EXPORT
Directives
{
35
public
:
36
virtual
~
Directives
() {}
37
38
virtual
void
pragmaLibrary
()
39
{
40
}
41
42
virtual
void
importFile
(
const
QString
&
jsfile
,
const
QString
&
module
,
int
line
,
int
column
)
43
{
44
Q_UNUSED
(
jsfile
);
45
Q_UNUSED
(
module
);
46
Q_UNUSED
(
line
);
47
Q_UNUSED
(
column
);
48
}
49
50
virtual
void
importModule
(
const
QString
&
uri
,
const
QString
&
version
,
const
QString
&
module
,
int
line
,
int
column
)
51
{
52
Q_UNUSED
(
uri
);
53
Q_UNUSED
(
version
);
54
Q_UNUSED
(
module
);
55
Q_UNUSED
(
line
);
56
Q_UNUSED
(
column
);
57
}
58
};
59
60
class
Engine
61
{
62
Lexer *_lexer =
nullptr
;
63
Directives *_directives =
nullptr
;
64
MemoryPool
_pool;
65
QList<SourceLocation> _comments;
66
QStringList _extraCode;
67
QString _code;
68
69
public
:
70
void
setCode
(
const
QString &code) { _code = code; }
71
const
QString
&
code
()
const
{
return
_code; }
72
73
void
addComment
(
int
pos,
int
len,
int
line,
int
col)
74
{
75
Q_ASSERT(len >= 0);
76
_comments.append(QQmlJS::SourceLocation(pos, len, line, col));
77
}
78
79
QList
<
SourceLocation
>
comments
()
const
{
return
_comments; }
80
81
Lexer *
lexer
()
const
{
return
_lexer; }
82
void
setLexer
(Lexer *lexer) { _lexer = lexer; }
83
84
Directives *
directives
()
const
{
return
_directives; }
85
void
setDirectives
(Directives *directives) { _directives = directives; }
86
87
MemoryPool
*
pool
() {
return
&_pool; }
88
const
MemoryPool
*
pool
()
const
{
return
&_pool; }
89
90
QStringView
midRef
(
int
position,
int
size)
91
{
92
return
QStringView{_code}.mid(position, size);
93
}
94
95
QStringView
newStringRef
(
const
QString &text)
96
{
97
_extraCode.append(text);
98
return
QStringView{_extraCode.last()};
99
}
100
101
QStringView
newStringRef
(
const
QChar *chars,
int
size)
102
{
103
return
newStringRef(QString(chars, size));
104
}
105
};
106
107
}
// end of namespace QQmlJS
108
109
QT_END_NAMESPACE
110
111
#
endif
// QQMLJSENGINE_P_H
QQmlJS::Directives
Definition
qqmljsengine_p.h:34
QQmlJS::Engine
Definition
qqmljsengine_p.h:61
QQmlJS::Engine::newStringRef
QStringView newStringRef(const QChar *chars, int size)
Definition
qqmljsengine_p.h:101
QQmlJS::Engine::pool
const MemoryPool * pool() const
Definition
qqmljsengine_p.h:88
QQmlJS::Engine::addComment
void addComment(int pos, int len, int line, int col)
Definition
qqmljsengine_p.h:73
QQmlJS::Engine::pool
MemoryPool * pool()
Definition
qqmljsengine_p.h:87
QQmlJS::Engine::code
const QString & code() const
Definition
qqmljsengine_p.h:71
QQmlJS::Engine::midRef
QStringView midRef(int position, int size)
Definition
qqmljsengine_p.h:90
QQmlJS::Engine::newStringRef
QStringView newStringRef(const QString &text)
Definition
qqmljsengine_p.h:95
QQmlJS::Engine::comments
QList< SourceLocation > comments() const
Definition
qqmljsengine_p.h:79
QQmlJS::Engine::setCode
void setCode(const QString &code)
Definition
qqmljsengine_p.h:70
QQmlJS::Engine::setLexer
void setLexer(Lexer *lexer)
Definition
qqmljsengine_p.h:82
QQmlJS::Engine::setDirectives
void setDirectives(Directives *directives)
Definition
qqmljsengine_p.h:85
QQmlJS::Engine::directives
Directives * directives() const
Definition
qqmljsengine_p.h:84
QQmlJS::Engine::lexer
Lexer * lexer() const
Definition
qqmljsengine_p.h:81
QQmlJS::Lexer
Definition
qqmljslexer_p.h:36
QQmlJS::MemoryPool
Definition
qqmljsmemorypool_p.h:32
QQmlJS
Definition
qv4bytecodegenerator_p.h:27
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QML_PARSER_EXPORT
#define QML_PARSER_EXPORT
Definition
qqmljsglobal_p.h:24
regExpFlagFromChar
static int regExpFlagFromChar(const QChar &ch)
Definition
qqmljslexer.cpp:25
isIdentifierPart
static bool isIdentifierPart(uint ch)
Definition
qqmljslexer.cpp:518
convertHex
static QChar convertHex(QChar c1, QChar c2)
Definition
qqmljslexer.cpp:47
uriTokens
static const int uriTokens[]
Definition
qqmljslexer.cpp:1607
isUriToken
static bool isUriToken(int token)
Definition
qqmljslexer.cpp:1661
convertHex
static unsigned char convertHex(ushort c)
Definition
qqmljslexer.cpp:37
isIdentifierStart
static bool isIdentifierStart(uint ch)
Definition
qqmljslexer.cpp:496
QQmlJS::DiagnosticMessage
Definition
qqmljsdiagnosticmessage_p.h:71
qtdeclarative
src
qml
parser
qqmljsengine_p.h
Generated on
for Qt by
1.18.0