AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JS_DefineUCPropertyWithTinyID (Function)
Summary:     Creates a single, Unicode-encoded property for a specified object and assigns it an ID number.
Syntax:
JSBool JS_DefinePropertyWithTinyId( JSContext *cx,
JSObject *obj, const jschar *name, size_t namelen,
int8 tinyid, jsval value, JSPropertyOp getter,
JSPropertyOp setter, uintN attrs);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     obj     JSObject *     Object for which to create the new property.
                 
     name     const jschar *     Name for the property to create.
                 
     namelen     size_t     Length, in bytes, of name.
                 
     tinyid     int8     8-bit ID to aid in sharing getProperty/setProperty methods among properties.
                 
     value     jsval     Initial value to assign to the property.
                 
     getter     JSPropertyOp     getProperty method for retrieving the current property value.
                 
     setter     JSPropertyOp     setProperty method for specifying a new property value.
                 
     attrs     uintN     Property flags.
                 
Description:
JS_DefineUCPropertyWithTinyId defines a single, Unicode-encoded property for a specified object, obj.

name is the Unicode-encoded name to assign to the property in the object. namelen is the length, in bytes, of namevalue is a jsval that defines the property's data type and initial value.

tinyid is an 8-bit value that simplifies determining which property to access, and is especially useful in getProperty and setProperty methods that are shared by a number of different properties.

getter and setter identify the getProperty and setProperty methods for the property, respectively. If you pass null values for these entries, JS_DefineUCPropertyWithTinyId assigns the default getProperty and setProperty methods to this property. attrs contains the property flags to set for the newly created property. The following table lists possible values you can pass in sttrs, either singly, or OR'd together: TABLE BORDER="0" TRTD VALIGN='baseline' ALIGN='left' BFlag /B/TDTD VALIGN='baseline' ALIGN='left' BPurpose /B /TD/TRTR TD VALIGN='baseline' ALIGN='left'P CODEJSPROP_ENUMERATE/CODE/TDTD VALIGN='baseline' ALIGN='left'P Property is visible in Bfor/B and Bin/B loops./P /TD/TRTR TD VALIGN='baseline' ALIGN='left'P CODEJSPROP_READONLY/CODE/TDTD VALIGN='baseline' ALIGN='left'P Property is read only./P /TD/TRTR TD VALIGN='baseline' ALIGN='left'P CODEJSPROP_PERMANENT/CODE/TDTD VALIGN='baseline' ALIGN='left'P Property cannot be deleted./P /TD/TRTR TD VALIGN='baseline' ALIGN='left'P CODEJSPROP_EXPORTED/CODE/TDTD VALIGN='baseline' ALIGN='left'P Property can be imported by other objects./P /TD/TRTR TD VALIGN='baseline' ALIGN='left'P CODEJSPROP_INDEX/CODE/TDTD VALIGN='baseline' ALIGN='left'P Property is actually an index into an array of properties, and is cast to a CODEconst char */CODE./P /TD/TR/TABLE  

If it successfully creates the property, JS_DefineUCPropertyWithTinyId returns JS_TRUE. If the property already exists, or cannot be created, it returns JS_FALSE.


See also:
JS_DefineConstDoubles
JS_DefineElement
JS_DefineFunction
JS_DefineFunctions
JS_DefineObject
JS_DefineProperties
JS_DefineProperty
JS_DefinePropertyWithTinyId
JS_DefineUCProperty

[sh-index] Back to list of manuals