20#include <QtCore/QString>
22#include <private/qv4heap_p.h>
23#include <private/qv4internalclass_p.h>
24#include <private/qv4staticvalue_p.h>
26#include <private/qnumeric_p.h>
27#include <private/qv4calldata_p.h>
46 return {staticValue.
_val};
49 inline bool isString()
const;
50 inline bool isStringOrSymbol()
const;
51 inline bool isSymbol()
const;
52 inline bool isObject()
const;
53 inline bool isFunctionObject()
const;
58 return reinterpret_cast<String *
>(
const_cast<Value *
>(
this));
61 if (!isStringOrSymbol())
68 return reinterpret_cast<Symbol *
>(
const_cast<Value *
>(
this));
73 return reinterpret_cast<Object*
>(
const_cast<Value *
>(
this));
78 return reinterpret_cast<Managed*
>(
const_cast<Value *
>(
this));
81 return isManagedOrUndefined() ?
m() :
nullptr;
93 inline unsigned int toUInt32()
const;
98 if (integerCompatible())
99 return static_cast<bool>(int_32());
101 return toBooleanImpl(*
this);
103 static bool toBooleanImpl(
Value val);
104 double toInteger()
const;
106 inline double toNumber()
const;
107 static double toNumberImpl(
Value v);
110 QString toQStringNoThrow()
const;
124 return reinterpret_cast<Heap::Object *
>(
m());
125 return toObject(
e, *
this);
129 inline bool isPrimitive()
const;
131 template <
typename T>
132 const T *
as()
const {
137#if !defined(QT_NO_QOBJECT_CHECK)
138 static_cast<const T *
>(
this)->qt_check_for_QMANAGED_macro(
static_cast<const T *
>(
this));
140 const VTable *vt =
m()->internalClass->vtable;
142 if (vt == T::staticVTable())
143 return static_cast<const T *
>(
this);
148 template <
typename T>
151 return const_cast<T *
>(
const_cast<const Value *
>(
this)->as<T>());
156 template<
typename T>
inline T *
cast() {
157 return static_cast<T *
>(
managed());
159 template<
typename T>
inline const T *
cast()
const {
160 return static_cast<const T *
>(
managed());
163 uint asArrayLength(
bool *
ok)
const;
167 return fromStaticValue(StaticValue::fromReturnedValue(
val));
176 static double toInteger(
double d) {
return StaticValue::toInteger(
d); }
177 static int toInt32(
double d) {
return StaticValue::toInt32(
d); }
178 static unsigned int toUInt32(
double d) {
return StaticValue::toUInt32(
d); }
181 return fromStaticValue(StaticValue::emptyValue());
185 return fromStaticValue(StaticValue::fromBoolean(
b));
189 return fromStaticValue(StaticValue::fromInt32(
i));
193 return fromStaticValue(StaticValue::undefinedValue());
197 return fromStaticValue(StaticValue::nullValue());
201 return fromStaticValue(StaticValue::fromDouble(
d));
205 return fromStaticValue(StaticValue::fromUInt32(
i));
211 StaticValue::operator=(
v);
218 _val =
reinterpret_cast<Value *
>(
m)->_val;
240template<
typename Managed>
243 *
static_cast<Value *
>(
this) =
m;
248inline Value &StaticValue::asValue<Value>()
250 return *
static_cast<Value *
>(
this);
254inline const Value &StaticValue::asValue<Value>()
const
256 return *
static_cast<const Value *
>(
this);
260inline Value *CallData::argValues<Value>()
266inline const Value *CallData::argValues<Value>()
const
271template<
typename HeapBase>
287 return b &&
b->internalClass->vtable->isString;
293 return b &&
b->internalClass->vtable->isStringOrSymbol;
299 return b &&
b->internalClass->vtable->isStringOrSymbol && !
b->internalClass->vtable->isString;
306 return b &&
b->internalClass->vtable->isObject;
312 return b &&
b->internalClass->vtable->isFunctionObject;
335 return v.asReturnedValue();
356 return QJSNumberCoercion::toInteger(doubleValue());
358 return QJSNumberCoercion::toInteger(toNumberImpl());
363 return static_cast<unsigned int>(
toInt32());
369 return int_32() < 0 ? 0 : int_32();
373 if (
i > (
static_cast<qint64>(1) << 53) - 1)
374 return (
static_cast<qint64>(1) << 53) - 1;
381 if (
Q_LIKELY(integerCompatible())) {
386 if (idx > (
static_cast<qint64>(1) << 53) - 1)
393 if (integerCompatible())
477 Q_ASSERT(!Value::fromReturnedValue(
v).isEmpty());
482 explicit operator bool()
const {
return !Value::fromReturnedValue(
value).isEmpty(); }
\macro QT_RESTRICTED_CAST_FROM_ASCII
ReturnedValue operator*() const
OptionalReturnedValue(ReturnedValue v)
ReturnedValue operator->() const
QJSManagedValue managed(std::move(val), &engine)
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
ReturnedValue value_convert(ExecutionEngine *e, const Value &v)
#define Q_STATIC_ASSERT(Condition)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
const void * data_ptr(const QTransform &t)
#define QML_NEARLY_ALWAYS_INLINE
unsigned long long quint64
static uint toIndex(ExecutionEngine *e, const Value &v)
static int toInt32(Value v)
QFuture< QSet< QChar > > set
[10]
char * toString(const MyType &t)
[31]
void set(EngineBase *e, HeapBasePtr b)
void set(EngineBase *e, const Value &newVal)
ReturnedValue asReturnedValue() const
StaticValue & operator=(ReturnedValue v)
constexpr ReturnedValue asReturnedValue() const
QV4_NEARLY_ALWAYS_INLINE double doubleValue() const
QV4_NEARLY_ALWAYS_INLINE constexpr int int_32() const
const VTable *const parent
const Value * data() const
void set(EngineBase *e, uint index, Value v)
void set(EngineBase *e, uint index, Value::HeapBasePtr b)
void mark(MarkStack *markStack)
Value::HeapBasePtr base()
void removeData(EngineBase *e, uint index, int n=1)
void insertData(EngineBase *e, uint index, Value v)
bool isStringOrSymbol() const
void mark(MarkStack *markStack)
static constexpr Value fromInt32(int i)
Value & operator=(ReturnedValue v)
bool isFunctionObject() const
Heap::String * toString(ExecutionEngine *e) const
constexpr Value(quint64 val)
static constexpr Value fromStaticValue(StaticValue staticValue)
static unsigned int toUInt32(double d)
Value & operator=(ManagedPtr m)
unsigned int toUInt32() const
QML_NEARLY_ALWAYS_INLINE String * stringValue() const
QML_NEARLY_ALWAYS_INLINE ManagedPtr managed() const
static constexpr Value fromBoolean(bool b)
static constexpr Value undefinedValue()
static Value fromDouble(double d)
static double toInteger(double d)
QML_NEARLY_ALWAYS_INLINE Object * objectValue() const
QML_NEARLY_ALWAYS_INLINE StringOrSymbol * stringOrSymbolValue() const
static Value fromHeapObject(HeapBasePtr m)
static constexpr Value fromReturnedValue(ReturnedValue val)
Value & operator=(HeapBasePtr o)
double toNumberImpl() const
ReturnedValue convertedToNumber() const
QML_NEARLY_ALWAYS_INLINE Symbol * symbolValue() const
QML_NEARLY_ALWAYS_INLINE Value::HeapBasePtr heapObject() const
static constexpr Value emptyValue()
static constexpr Value nullValue()
static int toInt32(double d)
Heap::Object * toObject(ExecutionEngine *e) const
static Value fromUInt32(uint i)