PageRenderTime 21ms CodeModel.GetById 10ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

HTML | 80 lines | 73 code | 6 blank | 1 comment | 0 complexity | 9dbccdc77da523fd99dbff34d5fdcd83 MD5 | raw file
 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 3<title>AngelScript: dictionary object</title>
 4<link href="tabs.css" rel="stylesheet" type="text/css">
 5<link href="doxygen.css" rel="stylesheet" type="text/css">
 7<!-- Generated by Doxygen 1.5.9 -->
 8<div class="contents">
 9<h1><a class="anchor" name="doc_addon_dict">dictionary object </a></h1><b>Path:</b> /sdk/add_on/scriptdictionary/<p>
10The dictionary object maps string values to values or objects of other types.<p>
11Register with <code>RegisterScriptDictionary(asIScriptEngine*)</code>.<h2><a class="anchor" name="doc_addon_dict_1">
12Public C++ interface</a></h2>
13<div class="fragment"><pre class="fragment"><span class="keyword">class </span>CScriptDictionary
15<span class="keyword">public</span>:
16  <span class="comment">// Memory management</span>
17  CScriptDictionary(<a class="code" href="classas_i_script_engine.html" title="The engine interface.">asIScriptEngine</a> *engine);
18  <span class="keywordtype">void</span> AddRef();
19  <span class="keywordtype">void</span> Release();
21  <span class="comment">// Sets/Gets a variable type value for a key</span>
22  <span class="keywordtype">void</span> Set(<span class="keyword">const</span> std::string &amp;key, <span class="keywordtype">void</span> *value, <span class="keywordtype">int</span> typeId);
23  <span class="keywordtype">bool</span> Get(<span class="keyword">const</span> std::string &amp;key, <span class="keywordtype">void</span> *value, <span class="keywordtype">int</span> typeId) <span class="keyword">const</span>;
25  <span class="comment">// Sets/Gets an integer number value for a key</span>
26  <span class="keywordtype">void</span> Set(<span class="keyword">const</span> std::string &amp;key, <a class="code" href="angelscript_8h.html#a8044b56ee56e2350b06f1e7207b43df" title="64 bit integer">asINT64</a> &amp;value);
27  <span class="keywordtype">bool</span> Get(<span class="keyword">const</span> std::string &amp;key, <a class="code" href="angelscript_8h.html#a8044b56ee56e2350b06f1e7207b43df" title="64 bit integer">asINT64</a> &amp;value) <span class="keyword">const</span>;
29  <span class="comment">// Sets/Gets a real number value for a key</span>
30  <span class="keywordtype">void</span> Set(<span class="keyword">const</span> std::string &amp;key, <span class="keywordtype">double</span> &amp;value);
31  <span class="keywordtype">bool</span> Get(<span class="keyword">const</span> std::string &amp;key, <span class="keywordtype">double</span> &amp;value) <span class="keyword">const</span>;
33  <span class="comment">// Returns true if the key is set</span>
34  <span class="keywordtype">bool</span> Exists(<span class="keyword">const</span> std::string &amp;key) <span class="keyword">const</span>;
36  <span class="comment">// Deletes the key</span>
37  <span class="keywordtype">void</span> Delete(<span class="keyword">const</span> std::string &amp;key);
39  <span class="comment">// Deletes all keys</span>
40  <span class="keywordtype">void</span> DeleteAll();
42</pre></div><h2><a class="anchor" name="doc_addon_dict_2">
43Public script interface</a></h2>
45  class dictionary
46  {
47    void set(const string &amp;in key, ? &amp;in value);
48    bool get(const string &amp;in value, ? &amp;out value) const;</pre><p>
49<pre>    void set(const string &amp;in key, int64 &amp;in value);
50    bool get(const string &amp;in key, int64 &amp;out value) const;</pre><p>
51<pre>    void set(const string &amp;in key, double &amp;in value);
52    bool get(const string &amp;in key, double &amp;out value) const;</pre><p>
53<pre>    bool exists(const string &amp;in key) const;
54    void delete(const string &amp;in key);
55    void deleteAll();
56  }
57</pre><h2><a class="anchor" name="doc_addon_dict_3">
58Script example</a></h2>
60  dictionary dict;
61  obj object;
62  obj @handle;</pre><p>
63<pre>  dict.set("one", 1);
64  dict.set("object", object);
65  dict.set("handle", @handle);</pre><p>
66<pre>  if( dict.exists("one") )
67  {
68    bool found = dict.get("handle", @handle);
69    if( found )
70    {
71      dict.delete("object");
72    }
73  }</pre><p>
74<pre>  dict.deleteAll();
75</pre> </div>
76<hr size="1"><address style="text-align: right;"><small>Generated on Wed Dec 16 19:34:50 2009 for AngelScript by&nbsp;
77<a href="">
78<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>