diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-07-25 17:44:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-04 20:17:23 +0100 |
commit | 6f6b350976ccfe959223b1fbe8c21fe71efc45bd (patch) | |
tree | 5a15e3140d3d63e6ce415c3f09636402b22b878c /src/qml/jsruntime/qv4value_inl_p.h | |
parent | 43296bb5fb578cc64b14fb4480e6daa87bb6491d (diff) |
Cleanup header file dependencies
Change-Id: Ibb4658576a98b53de2eac2474ce4d5b9eb83b6ae
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4value_inl_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_inl_p.h | 33 |
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 |