2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2012-03-02 16:26:22 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-10-07 14:04:06 +02:00
|
|
|
|
|
|
|
|
#include "parser/qmljsastfwd_p.h"
|
2020-02-28 17:51:32 +01:00
|
|
|
#include "parser/qmljsdiagnosticmessage_p.h"
|
2022-06-20 12:35:13 +02:00
|
|
|
#include "parser/qmljsengine_p.h"
|
|
|
|
|
#include "qmljs_global.h"
|
|
|
|
|
#include "qmljsconstants.h"
|
|
|
|
|
#include <utils/filepath.h>
|
2011-10-07 14:04:06 +02:00
|
|
|
|
2015-03-04 16:46:23 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QColor)
|
2011-10-07 14:04:06 +02:00
|
|
|
|
|
|
|
|
namespace QmlJS {
|
|
|
|
|
|
|
|
|
|
QMLJS_EXPORT QColor toQColor(const QString &qmlColorString);
|
|
|
|
|
QMLJS_EXPORT QString toString(AST::UiQualifiedId *qualifiedId,
|
|
|
|
|
const QChar delimiter = QLatin1Char('.'));
|
|
|
|
|
|
2020-02-28 17:51:32 +01:00
|
|
|
QMLJS_EXPORT SourceLocation locationFromRange(const SourceLocation &start,
|
|
|
|
|
const SourceLocation &end);
|
2011-10-07 14:04:06 +02:00
|
|
|
|
2020-02-28 17:51:32 +01:00
|
|
|
QMLJS_EXPORT SourceLocation fullLocationForQualifiedId(AST::UiQualifiedId *);
|
2011-10-07 14:04:06 +02:00
|
|
|
|
2019-07-31 17:21:41 +02:00
|
|
|
QMLJS_EXPORT QString idOfObject(AST::Node *object, AST::UiScriptBinding **idBinding = nullptr);
|
2011-10-24 09:28:02 +02:00
|
|
|
|
|
|
|
|
QMLJS_EXPORT AST::UiObjectInitializer *initializerOfObject(AST::Node *object);
|
2011-10-07 14:04:06 +02:00
|
|
|
|
|
|
|
|
QMLJS_EXPORT AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node);
|
|
|
|
|
|
|
|
|
|
QMLJS_EXPORT bool isValidBuiltinPropertyType(const QString &name);
|
|
|
|
|
|
2020-02-28 17:51:32 +01:00
|
|
|
QMLJS_EXPORT DiagnosticMessage errorMessage(const SourceLocation &loc,
|
2011-10-07 14:04:06 +02:00
|
|
|
const QString &message);
|
|
|
|
|
|
2016-04-29 16:25:17 +02:00
|
|
|
QMLJS_EXPORT bool maybeModuleVersion(const QString &version);
|
|
|
|
|
|
2021-06-23 10:27:08 +02:00
|
|
|
QMLJS_EXPORT const QStringList splitVersion(const QString &version);
|
2022-06-20 12:35:13 +02:00
|
|
|
QMLJS_EXPORT QList<Utils::FilePath> modulePaths(const QString &moduleImportName,
|
|
|
|
|
const QString &version,
|
|
|
|
|
const QList<Utils::FilePath> &importPaths);
|
2016-04-29 16:25:17 +02:00
|
|
|
|
2011-11-04 13:59:23 +01:00
|
|
|
template <class T>
|
2020-02-28 17:51:32 +01:00
|
|
|
SourceLocation locationFromRange(const T *node)
|
2011-11-04 13:59:23 +01:00
|
|
|
{
|
|
|
|
|
return locationFromRange(node->firstSourceLocation(), node->lastSourceLocation());
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-07 14:04:06 +02:00
|
|
|
template <class T>
|
|
|
|
|
DiagnosticMessage errorMessage(const T *node, const QString &message)
|
|
|
|
|
{
|
2013-11-06 14:17:23 +01:00
|
|
|
return DiagnosticMessage(QmlJS::Severity::Error,
|
2011-11-04 13:59:23 +01:00
|
|
|
locationFromRange(node),
|
2011-10-07 14:04:06 +02:00
|
|
|
message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace QmlJS
|