JS LookupUCProperty

  • Revision slug: SpiderMonkey/JSAPI_Reference/JS_LookupUCProperty
  • Revision title: JS LookupUCProperty
  • Revision id: 144997
  • Created:
  • Creator: DBaron
  • Is current revision? No
  • Comment /* Syntax */ namelen is characters, not bytes

Revision Content

{{template.Jsapiref()}}

Summary

Function

Determines if a specified, Unicode-encoded property exists.

Syntax

JSBool JS_LookupUCProperty(JSContext *cx, JSObject *obj,
    const jschar *name, size_t namelen, jsval *vp);

Name Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
obj JSObject * Object to search on for the property.
name const jschar * Name of the property to look up.
namelen size_t Length, in characters, of name.
vp jsval * Pointer to a variable into which to store the last retrieved value of the property if it exists. If not, vp is set to JSVAL_VOID.

Description

JS_LookupUCProperty examines a specified JS object, obj, for a Unicode-encoded property named name. namelen indicates the size, in bytes, of name. vp is set either to the last retrieved value of the property if it exists, or to JSVAL_VOID if it does not, and JS_LookupUCProperty returns JS_TRUE. On error, such as running out of memory during the search, JS_LookupUCProperty returns JS_FALSE, and vp is undefined.

Notes

JS_LookupUCProperty does not distinguish between a property with a value of undefined and a property that does not exist.

See Also

Groups Functions
Documents {{template.LXRSearch("ident", "i", "JS_LookupUCProperty", "LXR ID Search")}}
Entries

JSVAL_VOID, JS_AliasProperty, JS_DefineProperty, JS_DefinePropertyWithTinyId, JS_DefineUCProperty, JS_DefineUCPropertyWithTinyID, JS_DeleteProperty, JS_GetProperty, JS_GetPropertyAttributes, JS_PropertyStub, JS_SetProperty

Revision Source

<p> 
{{template.Jsapiref()}}
</p>
<h2 name="Summary"> Summary </h2>
<p><b>Function</b>
</p><p>Determines if a specified, Unicode-encoded property exists.
</p>
<h2 name="Syntax"> Syntax </h2>
<pre>JSBool JS_LookupUCProperty(JSContext *cx, JSObject *obj,
    const jschar *name, size_t namelen, jsval *vp);

</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>cx</code></td>
<td><code>JSContext *</code></td>
<td>Pointer to a JS context from which to derive runtime information.</td>
</tr>
<tr>
<td><code>obj</code></td>
<td><code>JSObject *</code></td>
<td>Object to search on for the property.</td>
</tr>
<tr>
<td><code>name</code></td>
<td><code>const jschar *</code></td>
<td>Name of the property to look up.</td>
</tr>
<tr>
<td><code>namelen</code></td>
<td><code>size_t</code></td>
<td>Length, in characters, of <code>name</code>.</td>
</tr>
<tr>
<td><code>vp</code></td>
<td><code>jsval *</code></td>
<td>Pointer to a variable into which to store the last retrieved value of the property if it exists. If not, <code>vp</code> is set to <code><a href="en/JSAPI_Reference/JSVAL_VOID">JSVAL_VOID</a></code>.</td>
</tr>
</tbody></table>
<h2 name="Description"> Description </h2>
<p><code>JS_LookupUCProperty</code> examines a specified JS object, <code>obj</code>, for a Unicode-encoded property named <code>name</code>. <code>namelen</code> indicates the size, in bytes, of <code>name</code>. <code>vp</code> is set either to the last retrieved value of the property if it exists, or to <code><a href="en/JSAPI_Reference/JSVAL_VOID">JSVAL_VOID</a></code> if it does not, and <code>JS_LookupUCProperty</code> returns <code>JS_TRUE</code>. On error, such as running out of memory during the search, <code>JS_LookupUCProperty</code> returns <code>JS_FALSE</code>, and <code>vp</code> is undefined.
</p>
<h3 name="Notes"> Notes </h3>
<p><code>JS_LookupUCProperty</code> does not distinguish between a property with a value of <code>undefined</code> and a property that does not exist.
</p>
<h2 name="See_Also"> See Also </h2>
<table class="fullwidth-table">
<tbody><tr>
<td>Groups</td>
<td><a href="en/JSAPI_Reference#Functions">Functions</a></td>
</tr>
<tr>
<td>Documents</td>
<td>{{template.LXRSearch("ident", "i", "JS_LookupUCProperty", "LXR ID Search")}}</td>
</tr>
<tr>
<td>Entries</td>
<td>
<p><a href="en/JSAPI_Reference/JSVAL_VOID">JSVAL_VOID</a>,
<a href="en/JSAPI_Reference/JS_AliasProperty">JS_AliasProperty</a>,
<a href="en/JSAPI_Reference/JS_DefineProperty">JS_DefineProperty</a>,
<a href="en/JSAPI_Reference/JS_DefinePropertyWithTinyId">JS_DefinePropertyWithTinyId</a>,
<a href="en/JSAPI_Reference/JS_DefineUCProperty">JS_DefineUCProperty</a>,
<a href="en/JSAPI_Reference/JS_DefineUCPropertyWithTinyID">JS_DefineUCPropertyWithTinyID</a>,
<a href="en/JSAPI_Reference/JS_DeleteProperty">JS_DeleteProperty</a>,
<a href="en/JSAPI_Reference/JS_GetProperty">JS_GetProperty</a>,
<a href="en/JSAPI_Reference/JS_GetPropertyAttributes">JS_GetPropertyAttributes</a>,
<a href="en/JSAPI_Reference/JS_PropertyStub">JS_PropertyStub</a>,
<a href="en/JSAPI_Reference/JS_SetProperty">JS_SetProperty</a>
</p>
</td>
</tr>
</tbody></table>
Revert to this revision