KJSPrototype

KJSPrototype Class Reference

#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=nullptr)
 
KJSObject constructObject (KJSContext *ctx, void *internalValue=nullptr)
 
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=nullptr)
 

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 242 of file kjsprototype.cpp.

KJSPrototype::~KJSPrototype ( )

Destructs this prototype object.

Definition at line 250 of file kjsprototype.cpp.

Member Function Documentation

KJSGlobalObject KJSPrototype::constructGlobalObject ( void *  internalValue = nullptr)

Similar to constructObject() but specialized on the construction of global objects.

Definition at line 294 of file kjsprototype.cpp.

KJSObject KJSPrototype::constructObject ( KJSContext ctx,
void *  internalValue = nullptr 
)

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 279 of file kjsprototype.cpp.

void KJSPrototype::defineConstant ( const QString name,
double  value 
)

Add a read-only numerical property to this object.

Definition at line 255 of file kjsprototype.cpp.

void KJSPrototype::defineConstant ( const QString name,
const QString value 
)

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 263 of file kjsprototype.cpp.

void KJSPrototype::defineConstant ( const QString name,
const KJSObject value 
)

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 271 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 315 of file kjsprototype.cpp.

void KJSPrototype::defineProperty ( KJSContext ctx,
const QString name,
PropertyGetter  getter,
PropertySetter  setter = nullptr 
)

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 302 of file kjsprototype.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 23:04:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.