Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickv4particledata.cpp File Reference
#include <math.h>
#include "qquickv4particledata_p.h"
#include "qquickparticlesystem_p.h"
#include <QDebug>
#include <private/qv4engine_p.h>
#include <private/qv4functionobject_p.h>
#include <QtCore/private/qnumeric_p.h>
+ Include dependency graph for qquickv4particledata.cpp:

Go to the source code of this file.

Classes

struct  QV4::Heap::QV4ParticleData
 
struct  QV4ParticleData
 
class  QV4ParticleDataDeletable
 

Namespaces

namespace  QV4
 \qmltype Particle \inqmlmodule QtQuick.Particles
 
namespace  QV4::Heap
 

Macros

#define COLOR_GETTER_AND_SETTER(VAR, NAME)
 
#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE)
 
#define FLOAT_GETTER_AND_SETTER(VARIABLE)
 
#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER)
 
#define REGISTER_ACCESSOR(PROTO, ENGINE, VARIABLE, NAME)    PROTO ->defineAccessorProperty( QStringLiteral( #NAME ), particleData_get_ ## VARIABLE , particleData_set_ ## VARIABLE )
 

Functions

 DEFINE_OBJECT_VTABLE (QV4ParticleData)
 
static QV4::ReturnedValue particleData_discard (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
 
static QV4::ReturnedValue particleData_lifeLeft (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
 
static QV4::ReturnedValue particleData_curSize (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int)
 
 V4_DEFINE_EXTENSION (QV4ParticleDataDeletable, particleV4Data)
 

Macro Definition Documentation

◆ COLOR_GETTER_AND_SETTER

#define COLOR_GETTER_AND_SETTER (   VAR,
  NAME 
)
Value:
static QV4::ReturnedValue particleData_get_ ## NAME (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
{ \
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum) \
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
\
RETURN_RESULT(QV4::Encode((r->d()->datum->color. VAR )/255.0));\
}\
\
static QV4::ReturnedValue particleData_set_ ## NAME (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
{\
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum)\
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
\
double d = argc ? argv[0].toNumber() : 0; \
r->d()->datum->color. VAR = qMin(255, qMax(0, (int)::floor(d * 255.0)));\
RETURN_UNDEFINED(); \
}
quint64 ReturnedValue
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLboolean GLboolean GLboolean b
GLboolean r
[2]
#define QStringLiteral(str)

Definition at line 299 of file qquickv4particledata.cpp.

◆ FAKE_FLOAT_GETTER_AND_SETTER

#define FAKE_FLOAT_GETTER_AND_SETTER (   VARIABLE,
  GETTER,
  SETTER 
)
Value:
static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
{ \
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum) \
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
\
RETURN_RESULT(QV4::Encode(r->d()->datum-> GETTER (r->d()->particleSystem)));\
}\
\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
{\
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum)\
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
\
r->d()->datum-> SETTER (argc ? argv[0].toNumber() : qt_qnan(), r->d()->particleSystem);\
RETURN_UNDEFINED(); \
}
constexpr static Q_DECL_CONST_FUNCTION double qt_qnan() noexcept
Definition qnumeric_p.h:94

Definition at line 364 of file qquickv4particledata.cpp.

◆ FLOAT_GETTER_AND_SETTER

#define FLOAT_GETTER_AND_SETTER (   VARIABLE)
Value:
static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
{ \
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum) \
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
\
RETURN_RESULT(QV4::Encode(r->d()->datum-> VARIABLE));\
}\
\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
{\
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum)\
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
\
r->d()->datum-> VARIABLE = argc ? argv[0].toNumber() : qt_qnan();\
RETURN_UNDEFINED(); \
}

Definition at line 343 of file qquickv4particledata.cpp.

◆ REGISTER_ACCESSOR

#define REGISTER_ACCESSOR (   PROTO,
  ENGINE,
  VARIABLE,
  NAME 
)     PROTO ->defineAccessorProperty( QStringLiteral( #NAME ), particleData_get_ ## VARIABLE , particleData_set_ ## VARIABLE )

Definition at line 385 of file qquickv4particledata.cpp.

◆ SEMIBOOL_GETTER_AND_SETTER

#define SEMIBOOL_GETTER_AND_SETTER (   VARIABLE)
Value:
static QV4::ReturnedValue particleData_get_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) \
{ \
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum) \
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object"))); \
\
RETURN_RESULT(QV4::Encode(r->d()->datum-> VARIABLE));\
}\
\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)\
{\
QV4::Scope scope(b); \
QV4::Scoped<QV4ParticleData> r(scope, *thisObject); \
if (!r || !r->d()->datum)\
RETURN_RESULT(scope.engine->throwError(QStringLiteral("Not a valid ParticleData object")));\
\
r->d()->datum-> VARIABLE = (argc && argv[0].toBoolean()) ? 1.0 : 0.0;\
RETURN_UNDEFINED(); \
}

Definition at line 322 of file qquickv4particledata.cpp.

Function Documentation

◆ DEFINE_OBJECT_VTABLE()

DEFINE_OBJECT_VTABLE ( QV4ParticleData  )

◆ particleData_curSize()

static QV4::ReturnedValue particleData_curSize ( const QV4::FunctionObject b,
const QV4::Value thisObject,
const QV4::Value ,
int   
)
static

Definition at line 289 of file qquickv4particledata.cpp.

References QV4::Scope::engine, QStringLiteral, RETURN_RESULT, and QV4::ExecutionEngine::throwError().

Referenced by QV4ParticleDataDeletable::QV4ParticleDataDeletable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ particleData_discard()

static QV4::ReturnedValue particleData_discard ( const QV4::FunctionObject b,
const QV4::Value thisObject,
const QV4::Value ,
int   
)
static

Definition at line 266 of file qquickv4particledata.cpp.

References QV4::Scope::engine, QStringLiteral, RETURN_RESULT, QV4::ExecutionEngine::throwError(), and QV4::Encode::undefined().

Referenced by QV4ParticleDataDeletable::QV4ParticleDataDeletable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ particleData_lifeLeft()

static QV4::ReturnedValue particleData_lifeLeft ( const QV4::FunctionObject b,
const QV4::Value thisObject,
const QV4::Value ,
int   
)
static

Definition at line 278 of file qquickv4particledata.cpp.

References QV4::Scope::engine, QStringLiteral, RETURN_RESULT, and QV4::ExecutionEngine::throwError().

Referenced by QV4ParticleDataDeletable::QV4ParticleDataDeletable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ V4_DEFINE_EXTENSION()

V4_DEFINE_EXTENSION ( QV4ParticleDataDeletable  ,
particleV4Data   
)