struct_p_p_b___var_dictionary__1__0.html revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
1{{+bindTo:partials.standard_nacl_article}} 2<h1>PPB_VarDictionary Struct Reference</h1> 3<div id="doxygen-ref"> 4{{- dummy div to appease doxygen -}} 5 <div> 6<!-- Generated by Doxygen 1.7.6.1 --> 7 8 9</div> 10<!--header--> 11<div class="contents"> 12<!-- doxytag: class="PPB_VarDictionary" --><h2> 13Data Fields</h2><table class="memberdecls"> 14 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_dictionary__1__0.html#a1fad06939f6d2c711a319d6b984f45f5">Create</a> )(void)</td></tr> 16<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_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> 17<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </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> 18<tr><td class="memItemLeft" align="right" valign="top">void(* </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> 19<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </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> 20<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_dictionary__1__0.html#ab481ddec5b69bf964b63e859decc1e97">GetKeys</a> )(struct <a class="el" href="struct_p_p___var.html">PP_Var</a> dict)</td></tr> 21</table> 22<hr /><a name="details" id="details"></a><h2>Detailed Description</h2> 23<div class="textblock"><p>A dictionary var contains key-value pairs with unique keys. </p> 24<p>The keys are strings while the values can be arbitrary vars. Key comparison is always done by value instead of by reference. </p> 25</div><hr /><h2>Field Documentation</h2> 26<a class="anchor" id="a1fad06939f6d2c711a319d6b984f45f5"></a><!-- doxytag: member="PPB_VarDictionary::Create" ref="a1fad06939f6d2c711a319d6b984f45f5" args=")(void)" --> 27<div class="memitem"> 28<div class="memproto"> 29<table class="memname"> 30<tr> 31<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> 32</tr> 33</table> 34</div> 35<div class="memdoc"> 36<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> 37<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> 38</div> 39</div> 40<a class="anchor" id="a2df16916e3bd3ecc2de6e27100bb71db"></a><!-- doxytag: member="PPB_VarDictionary::Delete" ref="a2df16916e3bd3ecc2de6e27100bb71db" args=")(struct PP_Var dict, struct PP_Var key)" --> 41<div class="memitem"> 42<div class="memproto"> 43<table class="memname"> 44<tr> 45<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> 46</tr> 47</table> 48</div> 49<div class="memdoc"> 50<p>Deletes the specified key and its associated value, if the key exists. </p> 51<p>The reference to the element will be released.</p> 52<dl class="params"><dt><b>Parameters:</b></dt><dd> 53<table class="params"> 54<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr> 55<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var. </td></tr> 56</table> 57</dd> 58</dl> 59</div> 60</div> 61<a class="anchor" id="ac078e850f04e097ee67cefc3a475ec77"></a><!-- doxytag: member="PPB_VarDictionary::Get" ref="ac078e850f04e097ee67cefc3a475ec77" args=")(struct PP_Var dict, struct PP_Var key)" --> 62<div class="memitem"> 63<div class="memproto"> 64<table class="memname"> 65<tr> 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_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> 67</tr> 68</table> 69</div> 70<div class="memdoc"> 71<p>Gets the value associated with the specified key. </p> 72<dl class="params"><dt><b>Parameters:</b></dt><dd> 73<table class="params"> 74<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr> 75<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var.</td></tr> 76</table> 77</dd> 78</dl> 79<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> 80</div> 81</div> 82<a class="anchor" id="ab481ddec5b69bf964b63e859decc1e97"></a><!-- doxytag: member="PPB_VarDictionary::GetKeys" ref="ab481ddec5b69bf964b63e859decc1e97" args=")(struct PP_Var dict)" --> 83<div class="memitem"> 84<div class="memproto"> 85<table class="memname"> 86<tr> 87<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> 88</tr> 89</table> 90</div> 91<div class="memdoc"> 92<p>Gets all the keys in a dictionary. </p> 93<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> 94<dl class="params"><dt><b>Parameters:</b></dt><dd> 95<table class="params"> 96<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var.</td></tr> 97</table> 98</dd> 99</dl> 100<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> 101</div> 102</div> 103<a class="anchor" id="a2b7c0b449352d77b0c36c2bdb270eb9a"></a><!-- doxytag: member="PPB_VarDictionary::HasKey" ref="a2b7c0b449352d77b0c36c2bdb270eb9a" args=")(struct PP_Var dict, struct PP_Var key)" --> 104<div class="memitem"> 105<div class="memproto"> 106<table class="memname"> 107<tr> 108<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> 109</tr> 110</table> 111</div> 112<div class="memdoc"> 113<p>Checks whether a key exists. </p> 114<dl class="params"><dt><b>Parameters:</b></dt><dd> 115<table class="params"> 116<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr> 117<tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>A string var.</td></tr> 118</table> 119</dd> 120</dl> 121<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> indicating whether the key exists. </dd></dl> 122</div> 123</div> 124<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)" --> 125<div class="memitem"> 126<div class="memproto"> 127<table class="memname"> 128<tr> 129<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> 130</tr> 131</table> 132</div> 133<div class="memdoc"> 134<p>Sets the value associated with the specified key. </p> 135<dl class="params"><dt><b>Parameters:</b></dt><dd> 136<table class="params"> 137<tr><td class="paramdir">[in]</td><td class="paramname">dict</td><td>A dictionary var. </td></tr> 138<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> 139<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> 140</table> 141</dd> 142</dl> 143<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> indicating whether the operation succeeds. </dd></dl> 144</div> 145</div> 146<hr />The documentation for this struct was generated from the following file:<ul> 147<li><a class="el" href="ppb__var__dictionary_8h.html">ppb_var_dictionary.h</a></li> 148</ul> 149</div><!-- contents --> 150</div> 151{{/partials.standard_nacl_article}} 152