KJS-API
KJSPrototype Class Reference
#include <kjsprototype.h>
Detailed Description
A class representing a JavaScript prototype object.Prototype object.
Definition at line 38 of file 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 | |
KJSGlobalObject | constructGlobalObject (void *internalValue=0) |
KJSObject | constructObject (KJSContext *ctx, void *internalValue=0) |
void | defineConstant (const QString &name, const KJSObject &value) |
void | defineConstant (const QString &name, const QString &value) |
void | defineConstant (const QString &name, double value) |
void | defineFunction (KJSContext *ctx, const QString &name, FunctionCall callback) |
void | defineProperty (KJSContext *ctx, const QString &name, PropertyGetter getter, PropertySetter setter=0) |
KJSPrototype () | |
~KJSPrototype () |
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.
typedef KJSObject(* KJSPrototype::PropertyGetter)(KJSContext *context, void *object) |
Function signature for a property getter function.
Describes one of the defineProperty() argument types.
typedef void(* KJSPrototype::PropertySetter)(KJSContext *context, void *object, KJSObject value) |
Function signature for a property setter function.
Describes one of the defineProperty() argument types.
Constructor & Destructor Documentation
KJSPrototype::KJSPrototype | ( | ) |
Constructs a prototype object with its own prototype property set to the Object prototype.
Definition at line 203 of file kjsprototype.cpp.
KJSPrototype::~KJSPrototype | ( | ) |
Member Function Documentation
KJSGlobalObject KJSPrototype::constructGlobalObject | ( | void * | internalValue = 0 |
) |
Similar to constructObject() but specialized on the construction of global objects.
Definition at line 255 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 240 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 232 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 224 of file kjsprototype.cpp.
void KJSPrototype::defineConstant | ( | const QString & | name, | |
double | value | |||
) |
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 275 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 263 of file kjsprototype.cpp.
The documentation for this class was generated from the following files: