KJS-API
#include <kjsprototype.h>
Public Types | |
typedef KJSObject(* | FunctionCall )(KJSContext *context, void *object, const KJSArguments &arguments) |
typedef KJSObject(* | PropertyGetter )(KJSContext *context, void *object) |
typedef void(* | PropertySetter )(KJSContext *context, void *object, KJSObject value) |
Public Member Functions | |
KJSPrototype () | |
~KJSPrototype () | |
KJSGlobalObject | constructGlobalObject (void *internalValue=0) |
KJSObject | constructObject (KJSContext *ctx, void *internalValue=0) |
void | defineConstant (const QString &name, double value) |
void | defineConstant (const QString &name, const QString &value) |
void | defineConstant (const QString &name, const KJSObject &value) |
void | defineFunction (KJSContext *ctx, const QString &name, FunctionCall callback) |
void | defineProperty (KJSContext *ctx, const QString &name, PropertyGetter getter, PropertySetter setter=0) |
Detailed Description
A class representing a JavaScript prototype object.
Prototype object.
Definition at line 38 of file kjsprototype.h.
Member Typedef Documentation
typedef KJSObject(* KJSPrototype::FunctionCall)(KJSContext *context, void *object, const KJSArguments &arguments) |
Signature for function call callback function.
The defineFunction() function parameter accepts a reference to a function of this type as a parameter.
Definition at line 92 of file kjsprototype.h.
typedef KJSObject(* KJSPrototype::PropertyGetter)(KJSContext *context, void *object) |
Function signature for a property getter function.
Describes one of the defineProperty() argument types.
Definition at line 70 of file kjsprototype.h.
typedef void(* KJSPrototype::PropertySetter)(KJSContext *context, void *object, KJSObject value) |
Function signature for a property setter function.
Describes one of the defineProperty() argument types.
Definition at line 75 of file kjsprototype.h.
Constructor & Destructor Documentation
KJSPrototype::KJSPrototype | ( | ) |
Constructs a prototype object with its own prototype property set to the Object prototype.
Definition at line 226 of file kjsprototype.cpp.
KJSPrototype::~KJSPrototype | ( | ) |
Destructs this prototype object.
Definition at line 234 of file kjsprototype.cpp.
Member Function Documentation
KJSGlobalObject KJSPrototype::constructGlobalObject | ( | void * | internalValue = 0 | ) |
Similar to constructObject() but specialized on the construction of global objects.
Definition at line 278 of file kjsprototype.cpp.
KJSObject KJSPrototype::constructObject | ( | KJSContext * | ctx, |
void * | internalValue = 0 |
||
) |
Construct an object with this prototype and the specified internal value.
The value pointer will be passed as the object parameter to the callbacks defined via defineProperty() and defineFunction().
- Todo:
- Provide a better type than void*
Definition at line 263 of file kjsprototype.cpp.
void KJSPrototype::defineConstant | ( | const QString & | name, |
double | value | ||
) |
Add a read-only numerical property to this object.
Definition at line 239 of file kjsprototype.cpp.
Add a read-only string property to this object.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 247 of file kjsprototype.cpp.
Add a read-only object property to this object.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 255 of file kjsprototype.cpp.
void KJSPrototype::defineFunction | ( | KJSContext * | ctx, |
const QString & | name, | ||
FunctionCall | callback | ||
) |
Define a function.
The specified C++ callback function will be called upon invocation.
Definition at line 299 of file kjsprototype.cpp.
void KJSPrototype::defineProperty | ( | KJSContext * | ctx, |
const QString & | name, | ||
PropertyGetter | getter, | ||
PropertySetter | setter = 0 |
||
) |
Defines a property of this prototype with C++ callback functions for getting and setting the property value.
If the setter is set to 0 then the property is treated as read-only.
Definition at line 286 of file kjsprototype.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.