7#include <private/qv4compileddata_p.h>
8#include <private/qqmlsourcecoordinate_p.h>
10#include <QtCore/qdebug.h>
70 error.setLine(qmlConvertSourceCoordinate<quint32, int>(
location.line()));
71 error.setColumn(qmlConvertSourceCoordinate<quint32, int>(
location.column()));
72 error.setDescription(description);
87 Q_ASSERT_X(
ok,
"QQmlCustomParser::evaluateEnum",
"ok must not be a null pointer");
94 auto nextDot = [&](
int dot) {
95 const int nextDot = script.
indexOf(u
'.',
dot + 1);
96 return (nextDot == script.
size() - 1) ? -1 : nextDot;
99 int dot = nextDot(-1);
106 if (!engine || imports.
isNull())
113 if (imports.
isT1()) {
118 bool recursionDetected =
false;
121 typeLoader, scope, &
type,
nullptr, &
ns,
nullptr,
126 if (!
type.isValid() &&
ns !=
nullptr) {
129 typeLoader, script.
left(
dot), &
type,
nullptr,
nullptr,
nullptr,
140 }
else if (
result.importNamespace) {
152 const int dot2 = nextDot(
dot);
153 const bool dot2Valid = (dot2 != -1);
154 const QString enumValue = script.
mid(dot2Valid ? dot2 + 1 :
dot + 1);
161 if (documentUrl.isValid() && documentUrl ==
type.sourceUrl()) {
164 const int count = rootCache->qmlEnumCount();
165 for (
int ii = 0; ii <
count; ++ii) {
167 if (!scopedEnumName.isEmpty() && scopedEnumName != enumData->name)
170 for (
int jj = 0; jj < enumData->values.size(); ++jj) {
172 if (
value.namedValue == enumValue) {
181 if (!scopedEnumName.isEmpty())
182 return type.scopedEnumValue(engine, scopedEnumName, enumValue,
ok);
184 return type.enumValue(engine, enumValue,
ok);
189 int i =
mo->enumeratorCount();
204 if (!engine || !imports.
isT1())
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
const QMetaObject * resolveType(const QString &) const
Resolves name to a type, or 0 if it is not a type.
void error(const QV4::CompiledData::Binding *binding, const QString &description)
int evaluateEnum(const QString &, bool *ok) const
If script is a simple enumeration expression (eg.
The QQmlError class encapsulates a QML error.
bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type, QQmlType *type_return, QTypeRevision *version_return, QQmlImportNamespace **ns_return, QList< QQmlError > *errors=nullptr, QQmlType::RegistrationType registrationType=QQmlType::AnyRegistrationType, bool *typeRecursionDetected=nullptr) const
QQmlPropertyCache::ConstPtr rootPropertyCache() const
QUrl documentSourceUrl() const
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
static QQmlTypeLoader * get(Engine *engine)
Result query(const QHashedStringRef &key, QQmlTypeLoader *typeLoader) const
const QMetaObject * metaObject() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString mid(qsizetype position, qsizetype n=-1) const &
qsizetype size() const noexcept
Returns the number of characters in this string.
QByteArray toUtf8() const &
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
static qreal dot(const QPointF &a, const QPointF &b)
#define Q_ASSERT_X(cond, x, msg)
QLatin1StringView QLatin1String