summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlparser_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlparser_p.h')
-rw-r--r--src/declarative/qml/qmlparser_p.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index 31f8702..d67690b 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -152,6 +152,45 @@ namespace QmlParser
void dump(int = 0) const;
};
+ class Variant
+ {
+ public:
+ enum Type {
+ Invalid,
+ Boolean,
+ Number,
+ String,
+ Script
+ };
+
+ Variant();
+ Variant(const Variant &);
+ Variant(bool);
+ Variant(double);
+ Variant(const QString &, Type = String);
+ Variant &operator=(const Variant &);
+
+ Type type() const;
+
+ bool isBoolean() const { return type() == Boolean; }
+ bool isNumber() const { return type() == Number; }
+ bool isString() const { return type() == String; }
+ bool isScript() const { return type() == Script; }
+
+ bool asBoolean() const;
+ QString asString() const;
+ double asNumber() const;
+ QString asScript() const;
+
+ private:
+ Type t;
+ union {
+ bool b;
+ double d;
+ };
+ QString s;
+ };
+
class Value : public QmlRefCount
{
public:
@@ -180,8 +219,11 @@ namespace QmlParser
};
Type type;
+ // ### Temporary
+ QString primitive() const { return value.asScript(); }
+
// Primitive value
- QString primitive;
+ Variant value;
// Object value
Object *object;