aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_inl_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4value_inl_p.h')
-rw-r--r--src/qml/jsruntime/qv4value_inl_p.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4value_inl_p.h b/src/qml/jsruntime/qv4value_inl_p.h
index 7a6cdb40d2..2600148417 100644
--- a/src/qml/jsruntime/qv4value_inl_p.h
+++ b/src/qml/jsruntime/qv4value_inl_p.h
@@ -35,18 +35,11 @@
#include <cmath> // this HAS to come
-#include <QtCore/QString>
-#include <QtCore/qnumeric.h>
-#include "qv4global_p.h"
+#include "qv4value_p.h"
+
#include "qv4string_p.h"
-#include <QtCore/QDebug>
#include "qv4managed_p.h"
#include "qv4engine_p.h"
-#include <private/qtqmlglobal_p.h>
-
-//#include <wtf/MathExtras.h>
-
-#include "qv4value_p.h"
QT_BEGIN_NAMESPACE
@@ -70,6 +63,13 @@ inline bool Value::isPrimitive() const
return !isObject();
}
+inline String *Value::asString() const
+{
+ if (isString())
+ return stringValue();
+ return 0;
+}
+
inline ExecutionEngine *Value::engine() const
{
Managed *m = asManaged();
@@ -275,6 +275,21 @@ inline ErrorObject *Value::asErrorObject() const
template<typename T>
inline T *Value::as() const { Managed *m = isObject() ? managed() : 0; return m ? m->as<T>() : 0; }
+#ifndef V4_BOOTSTRAP
+
+template<>
+inline String *value_cast(const Value &v) {
+ return v.asString();
+}
+
+template<>
+inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v)
+{
+ return v.toString(e)->asReturnedValue();
+}
+
+#endif
+
#endif
} // namespace QV4