forked from qt-creator/qt-creator
Add check for correct color string in Qml.
This commit is contained in:
@@ -61,6 +61,7 @@ class ObjectValue;
|
||||
class FunctionValue;
|
||||
class Reference;
|
||||
class EasingCurveNameValue;
|
||||
class ColorValue;
|
||||
|
||||
typedef QList<const Value *> ValueList;
|
||||
|
||||
@@ -82,6 +83,7 @@ public:
|
||||
virtual void visit(const FunctionValue *);
|
||||
virtual void visit(const Reference *);
|
||||
virtual void visit(const EasingCurveNameValue *);
|
||||
virtual void visit(const ColorValue *);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -105,6 +107,7 @@ public:
|
||||
virtual const FunctionValue *asFunctionValue() const;
|
||||
virtual const Reference *asReference() const;
|
||||
virtual const EasingCurveNameValue *asEasingCurveNameValue() const;
|
||||
virtual const ColorValue *asColorValue() const;
|
||||
|
||||
virtual void accept(ValueVisitor *) const = 0;
|
||||
|
||||
@@ -167,6 +170,12 @@ template <> Q_INLINE_TEMPLATE const EasingCurveNameValue *value_cast(const Value
|
||||
else return 0;
|
||||
}
|
||||
|
||||
template <> Q_INLINE_TEMPLATE const ColorValue *value_cast(const Value *v)
|
||||
{
|
||||
if (v) return v->asColorValue();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Value nodes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -326,6 +335,14 @@ public:
|
||||
virtual void accept(ValueVisitor *) const;
|
||||
};
|
||||
|
||||
class QMLJS_EXPORT ColorValue: public Value
|
||||
{
|
||||
public:
|
||||
// Value interface
|
||||
virtual const ColorValue *asColorValue() const;
|
||||
virtual void accept(ValueVisitor *) const;
|
||||
};
|
||||
|
||||
class QMLJS_EXPORT ObjectValue: public Value
|
||||
{
|
||||
public:
|
||||
@@ -585,6 +602,7 @@ public:
|
||||
const BooleanValue *booleanValue() const;
|
||||
const StringValue *stringValue() const;
|
||||
const EasingCurveNameValue *easingCurveNameValue() const;
|
||||
const ColorValue *colorValue() const;
|
||||
|
||||
ObjectValue *newObject(const ObjectValue *prototype);
|
||||
ObjectValue *newObject();
|
||||
@@ -674,6 +692,7 @@ private:
|
||||
BooleanValue _booleanValue;
|
||||
StringValue _stringValue;
|
||||
EasingCurveNameValue _easingCurveNameValue;
|
||||
ColorValue _colorValue;
|
||||
QList<Value *> _registeredValues;
|
||||
|
||||
ConvertToNumber _convertToNumber;
|
||||
|
||||
Reference in New Issue
Block a user