JavaScript-1.5 Reference

JSClass Data Structure

Summary

Defines a base class for use in building and maintaining JS objects.

Syntax

struct JSClass {
    char *name;
    uint32 flags;
    /* Mandatory non-null function pointer members. */
    JSPropertyOp addProperty;
    JSPropertyOp delProperty;
    JSPropertyOp getProperty;
    JSPropertyOp setProperty;
    JSEnumerateOp enumerate;
    JSResolveOp resolve;
    JSConvertOp convert;
    JSFinalizeOp finalize;
    /* Optionally non-null members start here. */
    JSGetObjectOps getObjectOps;
    JSCheckAccessOp checkAccess;
    JSNative call;
    JSNative construct;
    JSXDRObjectOp xdrObject;
    JSHasInstanceOp hasInstance;
    prword spare[2];
};
NameTypeDescription
*namecharClass name
flagsuint32Class attributes. 0 indicates no attributes are set. Attributes can be one or both of the following values OR'd together:
JSCLASS_HAS_PRIVATE: class can use private data.
JSCLASS_NEW_ENUMERATE: class defines getObjectOps to point to a new method for enumerating properties.
JSCLASS_NEW_RESOLVE: class defines getObjectOps to point to a new method for property resolution.
addPropertyJSPropertyOpMethod for adding a property to the class.
delPropertyJSPropertyOpMethod for deleting a property from the class.
getPropertyJSPropertyOpMethod for getting a property value.
setPropertyJSPropertyOpMethod for setting a property value.
enumerateJSEnumerateOpMethod for enumerating over class properties.
resolveJSResolveOpMethod for resolving property ambiguities.
convertJSConvertOpMethod for converting property values.
finalizeJSFinalizeOpMethod for finalizing the class.
getObjectOpsJSGetObjectOpsPointer to an optional structure that defines method overrides for a class. If you do not intend to override the default methods for a class, set getObjectOps to NULL.
checkAccessJSCheckAccessOpPointer to an optional custom access control method for a class or object operations structure. If you do not intend to provide custom access control, set this value to NULL.
callJSNativePointer to the method for calling into the object that represents this class.
constructJSNativePointer to the constructor for the object that represents this class
xdrObjectJSXDRObjectOpPointer to an optional XDR object and its methods. If you do not use XDR, set this value to NULL.
hasInstanceJSHasInstanceOpPointer to an optional hasInstance method for this object. If you do not provide a method for hasInstance, set this pointer to NULL.
spareprwordReserved for future use.

Description

Use JSClass to define a base class used in object creation and manipulation. In your applications, you may use JSClass to declare a constructor function, base properties, methods, and attributes common to a series of objects you create.

By default, JSClass defines a set of default property access methods that can be used by all objects derived in whole or in part from the class. You can define getObjectOps to point to an optional JSObjectOps struct that contains pointers to an array of methods that override the default access methods. For more information about creating method overrides, see JSObjectOps.

See Also

Groups [ Data Structure ]
Documents [ LXR ID Search ]
Entries [ JSCLASS_HAS_PRIVATE | JSCLASS_NEW_ENUMERATE | JSCLASS_NEW_RESOLVE | JSObjectOps | JS_ConvertStub | JS_EnumerateStub | JS_FinalizeStub | JS_GetClass | JS_InitClass | JS_InstanceOf | JS_PropertyStub | JS_ResolveStub ]

This page was generated by APIDOC