diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-10-04 10:28:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-05 21:00:34 +0200 |
commit | d108aeacac4835758e3e5f605b4845958ac82825 (patch) | |
tree | faa730d89a85d88d9424fda213ce5363b175671d /src/qml/jsruntime/qv4value_def_p.h | |
parent | 717c65e199ed456e5d637d9802422fdefdedeb28 (diff) |
Reshuffle inlined functions to fix MinGW-warnings.
When compiling QtQuick:
qv4value_p.h:80:17: warning: 'QV4::Managed* QV4::Value::asManaged() const'
redeclared without dllimport attribute after being referenced with dll
linkage
^
qv4value_p.h:180:14: warning:
'static QV4::Value QV4::Value::fromManaged(QV4::Managed*)' redeclared
without dllimport attribute after being referenced with dll linkage
^
qv4value_p.h:285:16: warning:
'QV4::String* QV4::Value::asString() const' redeclared without dllimport
attribute after being referenced with dll linkage
Change-Id: I548a2f8049b8eca06ab1061f56416a332820dc01
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4value_def_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_def_p.h | 76 |
1 files changed, 58 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4value_def_p.h b/src/qml/jsruntime/qv4value_def_p.h index c0b59f6711..24d62cf54f 100644 --- a/src/qml/jsruntime/qv4value_def_p.h +++ b/src/qml/jsruntime/qv4value_def_p.h @@ -338,6 +338,64 @@ struct Q_QML_EXPORT Value inline void mark() const; }; +inline Managed *Value::asManaged() const +{ + if (isManaged()) + return managed(); + return 0; +} + +inline String *Value::asString() const +{ + if (isString()) + return stringValue(); + return 0; +} + +struct Q_QML_EXPORT Primitive : public Value +{ + static Primitive emptyValue(); + static Primitive fromBoolean(bool b); + static Primitive fromInt32(int i); + static Primitive undefinedValue(); + static Primitive nullValue(); + static Primitive fromDouble(double d); + static Primitive fromUInt32(uint i); + + static double toInteger(double fromNumber); + static int toInt32(double value); + static unsigned int toUInt32(double value); + + inline operator ValueRef(); + Value asValue() const { return *this; } +}; + +inline Primitive Primitive::undefinedValue() +{ + Primitive v; +#if QT_POINTER_SIZE == 8 + v.val = quint64(Undefined_Type) << Tag_Shift; +#else + v.tag = Undefined_Type; + v.int_32 = 0; +#endif + return v; +} + +inline Value Value::fromManaged(Managed *m) +{ + if (!m) + return QV4::Primitive::undefinedValue(); + Value v; +#if QT_POINTER_SIZE == 8 + v.m = m; +#else + v.tag = Managed_Type; + v.m = m; +#endif + return v; +} + struct SafeValue : public Value { SafeValue &operator =(const ScopedValue &v); @@ -366,24 +424,6 @@ struct SafeValue : public Value inline Referenced<T> asRef(); }; -struct Q_QML_EXPORT Primitive : public Value -{ - static Primitive emptyValue(); - static Primitive fromBoolean(bool b); - static Primitive fromInt32(int i); - static Primitive undefinedValue(); - static Primitive nullValue(); - static Primitive fromDouble(double d); - static Primitive fromUInt32(uint i); - - static double toInteger(double fromNumber); - static int toInt32(double value); - static unsigned int toUInt32(double value); - - inline operator ValueRef(); - Value asValue() const { return *this; } -}; - template <typename T> struct Safe : public SafeValue { |