kjsembed
variant_binding.h File Reference
#include <QtCore/QVariant>
#include <kdemacros.h>
#include <kjs/object.h>
#include <kjs/interpreter.h>
#include "static_binding.h"
Go to the source code of this file.
Classes | |
class | KJSEmbed::VariantBinding |
class | KJSEmbed::VariantFactory |
Namespaces | |
KJSEmbed | |
Macros | |
#define | END_VARIANT_METHOD |
#define | KJSO_VARIANT_SIMPLE_BINDING_CTOR(NAME, JSNAME, TYPE, BASENAME) |
#define | START_VARIANT_METHOD(METHODNAME, TYPE) |
Functions | |
QList< QVariant > KJSEMBED_EXPORT | KJSEmbed::convertArrayToList (KJS::ExecState *exec, KJS::JSValue *value) |
QMap< QString, QVariant > KJSEMBED_EXPORT | KJSEmbed::convertArrayToMap (KJS::ExecState *exec, KJS::JSValue *value) |
QStringList KJSEMBED_EXPORT | KJSEmbed::convertArrayToStringList (KJS::ExecState *exec, KJS::JSValue *value) |
KJSEMBED_EXPORT KJS::JSValue * | KJSEmbed::convertToValue (KJS::ExecState *exec, const QVariant &value) |
QVariant KJSEMBED_EXPORT | KJSEmbed::convertToVariant (KJS::ExecState *exec, KJS::JSValue *value) |
template<typename T > | |
KJS::JSValue * | KJSEmbed::createVariant (KJS::ExecState *exec, const KJS::UString &className, const T &value) |
QVariant KJSEMBED_EXPORT | KJSEmbed::extractVariant (KJS::ExecState *exec, KJS::JSValue *value) |
template<typename T > | |
T | KJSEmbed::extractVariant (KJS::ExecState *exec, KJS::JSValue *arg, const T &defaultValue) |
template<typename T > | |
T | KJSEmbed::extractVariant (KJS::ExecState *exec, const KJS::List &args, int idx, const T &defaultValue=T()) |
Macro Definition Documentation
#define END_VARIANT_METHOD |
Value:
imp->setValue(qVariantFromValue(value)); \
} \
else \
{\
KJS::throwError(exec, KJS::GeneralError, "We have a problem baby");\
}\
}
JSObject * throwError(ExecState *e, ErrorType t, const QString &m)
Definition: binding_support.h:241
End a variant method started by START_VARIANT_METHOD.
Definition at line 56 of file variant_binding.h.
#define KJSO_VARIANT_SIMPLE_BINDING_CTOR | ( | NAME, | |
JSNAME, | |||
TYPE, | |||
BASENAME | |||
) |
Value:
NAME::NAME(KJS::ExecState *exec, const char* typeName ) \
: BASENAME( exec, typeName ) \
{ \
StaticBinding::publish( exec, this, NAME::methods() ); \
} \
NAME::NAME(KJS::ExecState *exec, const TYPE & value) \
: BASENAME( exec, QVariant::fromValue(value)) \
{ \
StaticBinding::publish( exec, this, NAME::methods() ); \
}
Definition at line 66 of file variant_binding.h.
#define START_VARIANT_METHOD | ( | METHODNAME, | |
TYPE | |||
) |
Value:
{ \
Q_UNUSED(exec);\
Q_UNUSED(self);\
Q_UNUSED(args);\
KJS::JSValue *result = KJS::jsNull(); \
KJSEmbed::VariantBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::VariantBinding>(exec, self ); \
if( imp ) \
{ \
TYPE value = imp->value<TYPE>();
Definition: variant_binding.cpp:130
A simple variant syle method.
This will extract the QVariant, cast it to the native type and place it in "value". Any data that should be returned from this method should be placed into "result";
Definition at line 42 of file variant_binding.h.
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Sun Nov 22 2015 10:42:08 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2015 The KDE developers.
Generated on Sun Nov 22 2015 10:42:08 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.