JavaScript-1.5 Reference

JSObjectOps Data Structure

Summary

Defines pointers to custom override methods for a class.

Syntax

struct JSObjectOps {
    /* mandatory non-null function pointer members. */
    JSNewObjectMapOp newObjectMap;
    JSObjectMapOp destroyObjectMap;
    JSLookupPropOp lookupProperty;
    JSDefinePropOp defineProperty;
    JSPropertyIdOp getProperty;
    JSPropertyIdOp setProperty;
    JSAttributesOp getAttributes;
    JSAttributesOp setAttributes;
    JSPropertyIdOp deleteProperty;
    JSConvertOp defaultValue;
    JSNewEnumerateOp enumerate;
    JSCheckAccessIdOp checkAccess;
    /* Optionally non-null members. */
    JSObjectOp thisObject;
    JSPropertyRefOp dropProperty;
    JSNative call;
    JSNative construct;
    JSXDRObjectOp xdrObject;
    JSHasInstanceOp hasInstance;
    prword spare[2];
};
NameTypeDescription
newObjectMapJSNewObjectMapOpPointer to the function that creates the object map for a class. The object map stores property information for the object, and is created when the object is created. This pointer cannot be NULL.
destroyObjectMapJSObjectMapOpPointer to the function that destroys the object map when it is no longer needed. This pointer cannnot be NULL.
lookupPropertyJSLookupPropOpPointer to a custom property lookup method for the object. This pointer cannnot be NULL.
definePropertyJSDefinePropOpPointer to a custom property creation method for the object. This pointer cannnot be NULL.
getPropertyJSPropertyIdOpPointer to a custom property value retrieval method for the object. This pointer cannnot be NULL.
setPropertyJSPropertyIdOpPointer to a custom property value assignment method for the object. This pointer cannnot be NULL.
getAttributesJSAttributesOpPointer to a custom property attributes retrieval method for the object. This pointer cannot be NULL.
setAttributesJSAttributesOpPointer to a custom property attributes assignment method for this object. This property cannot be NULL.
deletePropertyJSPropertyIdOpPointer to a custom method for deleting a property belonging to this object. This pointer cannot be NULL.
defaultValueJSConvertOpPointer to a method for converting a property value. This pointer cannot be NULL.
enumerateJSNewEnumerateOpPointer to a custom method for enumerating over class properties. This pointer cannot be NULL.
checkAccessJSCheckAccessIdOpPointer to an optional custom access control method for a this object. This pointer cannot be NULL.
thisObjectJSObjectOpPointer to an optional custom method that retrieves this object. If you do not use this method, set thisObject to NULL.
dropPropertyJSPropertyRefOpPointer to an optional, custom reference-counting method that can be used to determine whether or not a property can be deleted safely.If you do not use reference counting, set dropProperty 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 an override method for hasInstance, set this pointer to NULL.
spareprwordReserved for future use.

Description

Use JSObjectOps to define an optional structure of pointers to custom property methods for a class. If you define JSObjectOps, you can create methods to override the default methods used by JSClass.

If you create a JSObjectOps structure for a given class, then you must also supply or create methods for creating and destroying the object map used by this object, and you must create custom methods for looking up, defining, getting, setting, and deleting properties. You must also create methods for getting and setting property attributes, checking object access privileges, converting property values, and enumerating properties. All other fields are optional, and if not used, should be set to NULL.

See Also

Groups [ Data Structure ]
Documents [ LXR ID Search ]
Entries [ JSClass ]

This page was generated by APIDOC