1 {{+bindTo:partials.standard_nacl_article}}
2 <h1>PPB_Var Struct Reference</h1>
4 <!-- Generated by Doxygen 1.7.6.1 -->
10 <!-- doxytag: class="PPB_Var" --><h2>
11 Data Fields</h2><table class="memberdecls">
13 <tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var__1__1.html#a8fc2c3ab17026665e7f0eeb0ac7a2105">AddRef</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var)</td></tr>
14 <tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var__1__1.html#a11121fad397ca41981ccc48ee67aad3a">Release</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var)</td></tr>
15 <tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var__1__1.html#a33b06493ec6ecf650d706346b28398e2">VarFromUtf8</a> )(const char *data, uint32_t len)</td></tr>
16 <tr><td class="memItemLeft" align="right" valign="top">const char *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var__1__1.html#a308c42ffebc291fc2fab3200ea5f1845">VarToUtf8</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var, uint32_t *len)</td></tr>
18 <hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
19 <div class="textblock"><p>PPB_Var API. </p>
20 </div><hr /><h2>Field Documentation</h2>
21 <a class="anchor" id="a8fc2c3ab17026665e7f0eeb0ac7a2105"></a><!-- doxytag: member="PPB_Var::AddRef" ref="a8fc2c3ab17026665e7f0eeb0ac7a2105" args=")(struct PP_Var var)" -->
23 <div class="memproto">
24 <table class="memname">
26 <td class="memname">void(* <a class="el" href="struct_p_p_b___var__1__1.html#a8fc2c3ab17026665e7f0eeb0ac7a2105">PPB_Var::AddRef</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var)</td>
31 <p><a class="el" href="struct_p_p_b___var__1__1.html#a8fc2c3ab17026665e7f0eeb0ac7a2105" title="AddRef() adds a reference to the given var.">AddRef()</a> adds a reference to the given var. </p>
32 <p>If this is not a refcounted object, this function will do nothing so you can always call it no matter what the type.</p>
33 <dl class="params"><dt><b>Parameters:</b></dt><dd>
34 <table class="params">
35 <tr><td class="paramdir">[in]</td><td class="paramname">var</td><td>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> that will have a reference added. </td></tr>
41 <a class="anchor" id="a11121fad397ca41981ccc48ee67aad3a"></a><!-- doxytag: member="PPB_Var::Release" ref="a11121fad397ca41981ccc48ee67aad3a" args=")(struct PP_Var var)" -->
43 <div class="memproto">
44 <table class="memname">
46 <td class="memname">void(* <a class="el" href="struct_p_p_b___var__1__1.html#a11121fad397ca41981ccc48ee67aad3a">PPB_Var::Release</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var)</td>
51 <p><a class="el" href="struct_p_p_b___var__1__1.html#a11121fad397ca41981ccc48ee67aad3a" title="Release() removes a reference to given var, deleting it if the internal reference count becomes 0...">Release()</a> removes a reference to given var, deleting it if the internal reference count becomes 0. </p>
52 <p>If the given var is not a refcounted object, this function will do nothing so you can always call it no matter what the type.</p>
53 <dl class="params"><dt><b>Parameters:</b></dt><dd>
54 <table class="params">
55 <tr><td class="paramdir">[in]</td><td class="paramname">var</td><td>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> that will have a reference removed. </td></tr>
61 <a class="anchor" id="a33b06493ec6ecf650d706346b28398e2"></a><!-- doxytag: member="PPB_Var::VarFromUtf8" ref="a33b06493ec6ecf650d706346b28398e2" args=")(const char *data, uint32_t len)" -->
63 <div class="memproto">
64 <table class="memname">
66 <td class="memname">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(* <a class="el" href="struct_p_p_b___var__1__1.html#a33b06493ec6ecf650d706346b28398e2">PPB_Var::VarFromUtf8</a>)(const char *data, uint32_t len)<code> [read]</code></td>
71 <p><a class="el" href="struct_p_p_b___var__1__1.html#a33b06493ec6ecf650d706346b28398e2" title="VarFromUtf8() creates a string var from a string.">VarFromUtf8()</a> creates a string var from a string. </p>
72 <p>The string must be encoded in valid UTF-8 and is NOT NULL-terminated, the length must be specified in <code>len</code>. It is an error if the string is not valid UTF-8.</p>
73 <p>If the length is 0, the <code>*data</code> pointer will not be dereferenced and may be <code>NULL</code>. Note, however if length is 0, the "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never return <code>NULL</code> on success, even for empty strings.</p>
74 <p>The resulting object will be a refcounted string object. It will be AddRef'ed for the caller. When the caller is done with it, it should be Released.</p>
75 <p>On error (basically out of memory to allocate the string, or input that is not valid UTF-8), this function will return a Null var.</p>
76 <dl class="params"><dt><b>Parameters:</b></dt><dd>
77 <table class="params">
78 <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>A string </td></tr>
79 <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>The length of the string.</td></tr>
83 <dl class="return"><dt><b>Returns:</b></dt><dd>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> structure containing a reference counted string object. </dd></dl>
86 <a class="anchor" id="a308c42ffebc291fc2fab3200ea5f1845"></a><!-- doxytag: member="PPB_Var::VarToUtf8" ref="a308c42ffebc291fc2fab3200ea5f1845" args=")(struct PP_Var var, uint32_t *len)" -->
88 <div class="memproto">
89 <table class="memname">
91 <td class="memname">const char*(* <a class="el" href="struct_p_p_b___var__1__1.html#a308c42ffebc291fc2fab3200ea5f1845">PPB_Var::VarToUtf8</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> var, uint32_t *len)</td>
96 <p><a class="el" href="struct_p_p_b___var__1__1.html#a308c42ffebc291fc2fab3200ea5f1845" title="VarToUtf8() converts a string-type var to a char* encoded in UTF-8.">VarToUtf8()</a> converts a string-type var to a char* encoded in UTF-8. </p>
97 <p>This string is NOT NULL-terminated. The length will be placed in <code>*len</code>. If the string is valid but empty the return value will be non-NULL, but <code>*len</code> will still be 0.</p>
98 <p>If the var is not a string, this function will return NULL and <code>*len</code> will be 0.</p>
99 <p>The returned buffer will be valid as long as the underlying var is alive. If the instance frees its reference, the string will be freed and the pointer will be to arbitrary memory.</p>
100 <dl class="params"><dt><b>Parameters:</b></dt><dd>
101 <table class="params">
102 <tr><td class="paramdir">[in]</td><td class="paramname">var</td><td>A <a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a> struct containing a string-type var. </td></tr>
103 <tr><td class="paramdir">[in,out]</td><td class="paramname">len</td><td>A pointer to the length of the string-type var.</td></tr>
107 <dl class="return"><dt><b>Returns:</b></dt><dd>A char* encoded in UTF-8. </dd></dl>
110 <hr />The documentation for this struct was generated from the following file:<ul>
111 <li><a class="el" href="ppb__var_8h.html">ppb_var.h</a></li>
113 </div><!-- contents -->
114 {{/partials.standard_nacl_article}}