Entry: 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];
};
Argument Type Description
newObjectMap JSNewObjectMapOp Pointer 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.
destroyObjectMap JSObjectMapOp Pointer to the function that destroys the object map when it is no longer needed. This pointer cannnot be NULL.
lookupProperty JSLookupPropOp Pointer to a custom property lookup method for the object. This pointer cannnot be NULL.
defineProperty JSDefinePropOp Pointer to a custom property creation method for the object. This pointer cannnot be NULL.
getProperty JSPropertyIdOp Pointer to a custom property value retrieval method for the object. This pointer cannnot be NULL.
setProperty JSPropertyIdOp Pointer to a custom property value assignment method for the object. This pointer cannnot be NULL.
getAttributes JSAttributesOp Pointer to a custom property attributes retrieval method for the object. This pointer cannot be NULL.
setAttributes JSAttributesOp Pointer to a custom property attributes assignment method for this object. This property cannot be NULL.
deleteProperty JSPropertyIdOp Pointer to a custom method for deleting a property belonging to this object. This pointer cannot be NULL.
defaultValue JSConvertOp Pointer to a method for converting a property value. This pointer cannot be NULL.
enumerate JSNewEnumerateOp Pointer to a custom method for enumerating over class properties. This pointer cannot be NULL.
checkAccess JSCheckAccessIdOp Pointer to an optional custom access control method for a this object. This pointer cannot be NULL.
thisObject JSObjectOp Pointer to an optional custom method that retrieves this object. If you do not use this method, set thisObject to NULL.
dropProperty JSPropertyRefOp Pointer 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.
call JSNative Pointer to the method for calling into the object that represents this class.
construct JSNative Pointer to the constructor for the object that represents this class
xdrObject JSXDRObjectOp Pointer to an optional XDR object and its methods. If you do not use XDR, set this value to NULL.
hasInstance JSHasInstanceOp Pointer to an optional hasInstance method for this object. If you do not provide an override method for hasInstance, set this pointer to NULL.
spare prword Reserved 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:
|
|
|