forked from qt-creator/qt-creator
QmlJS: Move commonly used functions to qmlutils.h.
Change-Id: I22376d96fe575bc00a55094c06af80e32a5587e6 Reviewed-on: http://codereview.qt-project.org/6238 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
44
src/libs/qmljs/qmljsutils.h
Normal file
44
src/libs/qmljs/qmljsutils.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef QMLJS_QMLJSUTILS_H
|
||||
#define QMLJS_QMLJSUTILS_H
|
||||
|
||||
#include "qmljs_global.h"
|
||||
#include "parser/qmljsastfwd_p.h"
|
||||
#include "parser/qmljsengine_p.h"
|
||||
|
||||
#include <QtGui/QColor>
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
QMLJS_EXPORT QColor toQColor(const QString &qmlColorString);
|
||||
QMLJS_EXPORT QString toString(AST::UiQualifiedId *qualifiedId,
|
||||
const QChar delimiter = QLatin1Char('.'));
|
||||
|
||||
QMLJS_EXPORT AST::SourceLocation locationFromRange(const AST::SourceLocation &start,
|
||||
const AST::SourceLocation &end);
|
||||
|
||||
QMLJS_EXPORT AST::SourceLocation fullLocationForQualifiedId(AST::UiQualifiedId *);
|
||||
|
||||
QMLJS_EXPORT QString idOfObject(AST::UiObjectDefinition *object);
|
||||
QMLJS_EXPORT QString idOfObject(AST::UiObjectBinding *object);
|
||||
QMLJS_EXPORT QString idOfObject(AST::UiObjectInitializer *initializer);
|
||||
|
||||
QMLJS_EXPORT AST::UiObjectInitializer *initializerOfObject(AST::Node *node);
|
||||
QMLJS_EXPORT AST::UiQualifiedId *qualifiedTypeNameId(AST::Node *node);
|
||||
|
||||
QMLJS_EXPORT bool isValidBuiltinPropertyType(const QString &name);
|
||||
|
||||
QMLJS_EXPORT DiagnosticMessage errorMessage(const AST::SourceLocation &loc,
|
||||
const QString &message);
|
||||
|
||||
template <class T>
|
||||
DiagnosticMessage errorMessage(const T *node, const QString &message)
|
||||
{
|
||||
return DiagnosticMessage(DiagnosticMessage::Error,
|
||||
locationFromRange(node->firstSourceLocation(),
|
||||
node->lastSourceLocation()),
|
||||
message);
|
||||
}
|
||||
|
||||
} // namespace QmlJS
|
||||
|
||||
#endif // QMLJS_QMLJSUTILS_H
|
||||
Reference in New Issue
Block a user