JSVAL_TO_OBJECT

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSVAL_TO_OBJECT
  • Revision title: JSVAL_TO_OBJECT
  • Revision id: 112033
  • Created:
  • Creator: Rappo
  • Is current revision? No
  • Comment

Revision Content

{{template.Jsapiref()}}

Summary

Macro

Casts the type tag for a specified JS value and returns a pointer to the value cast as a JS object.

Syntax

JSVAL_TO_OBJECT(v)

Description

JSVAL_TO_OBJECT clears a specified JS value, v, to a JS object. It does so by casting the value's type tag and casting the result to an object pointer.

Casting v to an object pointer manipulates its underlying type tag. v must be an object jsval. Casting does not convert the value stored in v to a different data type. To perform actual data type conversion, use the JS_ValueToObject function.

Notes

This macro assumes that the JS type tag for v is already JSVAL_OBJECT. Because JS values are represented as bit-shifted C integers, comparisons of JSVAL_TO_OBJECT(v) to v itself are not equal unless you ignore the C pointer type mismatch and v is an object reference.

See Also

Groups Macros
Documents {{template.LXRSearch("ident", "i", "JSVAL_TO_OBJECT", "LXR ID Search")}}
Entries DOUBLE_TO_JSVAL, JSVAL_TO_DOUBLE, JSVAL_TO_GCTHING, JSVAL_TO_STRING, JS_ValueToObject, OBJECT_TO_JSVAL, STRING_TO_JSVAL

Revision Source

<p> 
{{template.Jsapiref()}}
</p>
<h3 name="Summary"> Summary </h3>
<p><b>Macro</b>
</p><p>Casts the type tag for a specified JS value and returns a pointer to the value cast as a JS object.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre>JSVAL_TO_OBJECT(v)
</pre>
<h3 name="Description"> Description </h3>
<p><code>JSVAL_TO_OBJECT</code> clears a specified JS value, <code>v</code>, to a JS object. It does so by casting the value's type tag and casting the result to an object pointer.
</p><p>Casting <code>v</code> to an object pointer manipulates its underlying type tag. <code>v</code> must be an object jsval. Casting does not convert the value stored in <code>v</code> to a different data type. To perform actual data type conversion, use the <a href="en/JS_ValueToObject">JS_ValueToObject</a> function.
</p>
<h3 name="Notes"> Notes </h3>
<p>This macro assumes that the JS type tag for <code>v</code> is already <code>JSVAL_OBJECT</code>. Because JS values are represented as bit-shifted C integers, comparisons of <code>JSVAL_TO_OBJECT(v)</code> to <code>v</code> itself are not equal unless you ignore the C pointer type mismatch and <code>v</code> is an object reference.
</p>
<h3 name="See_Also"> See Also </h3>
<table class="fullwidth-table">
<tbody><tr>
<td>Groups</td>
<td><a href="en/JSAPI_Reference#Macros">Macros</a></td>
</tr>
<tr>
<td>Documents</td>
<td>{{template.LXRSearch("ident", "i", "JSVAL_TO_OBJECT", "LXR ID Search")}}</td>
</tr>
<tr>
<td>Entries</td>
<td><a href="en/DOUBLE_TO_JSVAL">DOUBLE_TO_JSVAL</a>, <a href="en/JSVAL_TO_DOUBLE">JSVAL_TO_DOUBLE</a>, <a href="en/JSVAL_TO_GCTHING">JSVAL_TO_GCTHING</a>, <a href="en/JSVAL_TO_STRING">JSVAL_TO_STRING</a>, <a href="en/JS_ValueToObject">JS_ValueToObject</a>, <a href="en/OBJECT_TO_JSVAL">OBJECT_TO_JSVAL</a>, <a href="en/STRING_TO_JSVAL">STRING_TO_JSVAL</a></td>
</tr>
</tbody></table>
Revert to this revision