blob: c30decfd9c5dc1185128d12d4a28e39e58e51cb3 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_VarDictionary Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPB_VarDictionary" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a1fad06939f6d2c711a319d6b984f45f5">Create</a> )(void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#ac078e850f04e097ee67cefc3a475ec77">Get</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a8af80f44eaab36b5c8bc670be405dc21">Set</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> value)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a2df16916e3bd3ecc2de6e27100bb71db">Delete</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a2b7c0b449352d77b0c36c2bdb270eb9a">HasKey</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="struct_p_p___var.html">PP_Var</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___var_dictionary__1__0.html#ab481ddec5b69bf964b63e859decc1e97">GetKeys</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A dictionary var contains key-value pairs with unique keys. </p>
<p>The keys are strings while the values can be arbitrary vars. Key comparison is always done by value instead of by reference. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a1fad06939f6d2c711a319d6b984f45f5"></a><!-- doxytag: member="PPB_VarDictionary::Create" ref="a1fad06939f6d2c711a319d6b984f45f5" args=")(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<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_dictionary__1__0.html#a1fad06939f6d2c711a319d6b984f45f5">PPB_VarDictionary::Create</a>)(void)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a dictionary var, i.e., 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> with type set to <code>PP_VARTYPE_DICTIONARY</code>. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An empty dictionary var, whose reference count is set to 1 on behalf of the caller. </dd></dl>
</div>
</div>
<a class="anchor" id="a2df16916e3bd3ecc2de6e27100bb71db"></a><!-- doxytag: member="PPB_VarDictionary::Delete" ref="a2df16916e3bd3ecc2de6e27100bb71db" args=")(struct PP_Var dict, struct PP_Var key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a2df16916e3bd3ecc2de6e27100bb71db">PPB_VarDictionary::Delete</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Deletes the specified key and its associated value, if the key exists. </p>
<p>The reference to the element will be released.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ac078e850f04e097ee67cefc3a475ec77"></a><!-- doxytag: member="PPB_VarDictionary::Get" ref="ac078e850f04e097ee67cefc3a475ec77" args=")(struct PP_Var dict, struct PP_Var key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<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_dictionary__1__0.html#ac078e850f04e097ee67cefc3a475ec77">PPB_VarDictionary::Get</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets the value associated with the specified key. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The value that is associated with <code>key</code>. The reference count of the element returned is incremented on behalf of the caller. If <code>key</code> is not a string var, or it doesn't exist in <code>dict</code>, an undefined var is returned. </dd></dl>
</div>
</div>
<a class="anchor" id="ab481ddec5b69bf964b63e859decc1e97"></a><!-- doxytag: member="PPB_VarDictionary::GetKeys" ref="ab481ddec5b69bf964b63e859decc1e97" args=")(struct PP_Var dict)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<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_dictionary__1__0.html#ab481ddec5b69bf964b63e859decc1e97">PPB_VarDictionary::GetKeys</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict)<code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets all the keys in a dictionary. </p>
<p>Please note that for each key that you set into the dictionary, a string var with the same contents is returned; but it may not be the same string var (i.e., <code>value.as_id</code> may be different).</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An array var which contains all the keys of <code>dict</code>. Its reference count is incremented on behalf of the caller. The elements are string vars. Returns a null var if failed. </dd></dl>
</div>
</div>
<a class="anchor" id="a2b7c0b449352d77b0c36c2bdb270eb9a"></a><!-- doxytag: member="PPB_VarDictionary::HasKey" ref="a2b7c0b449352d77b0c36c2bdb270eb9a" args=")(struct PP_Var dict, struct PP_Var key)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a2b7c0b449352d77b0c36c2bdb270eb9a">PPB_VarDictionary::HasKey</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Checks whether a key exists. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> indicating whether the key exists. </dd></dl>
</div>
</div>
<a class="anchor" id="a8af80f44eaab36b5c8bc670be405dc21"></a><!-- doxytag: member="PPB_VarDictionary::Set" ref="a8af80f44eaab36b5c8bc670be405dc21" args=")(struct PP_Var dict, struct PP_Var key, struct PP_Var value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___var_dictionary__1__0.html#a8af80f44eaab36b5c8bc670be405dc21">PPB_VarDictionary::Set</a>)(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> key, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> value)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the value associated with the specified key. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var. If this key hasn't existed in <code>dict</code>, it is added and associated with <code>value</code>; otherwise, the previous value is replaced with <code>value</code>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>The value to set. The dictionary holds a reference to it on success.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> indicating whether the operation succeeds. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__var__dictionary_8h.html">ppb_var_dictionary.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}