libxml2-dict.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  5. <title>dict: string dictionnary</title>
  6. <meta name="generator" content="Libxml2 devhelp stylesheet"/>
  7. <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
  8. <link rel="up" href="general.html" title="API"/>
  9. <link rel="stylesheet" href="style.css" type="text/css"/>
  10. <link rel="chapter" href="general.html" title="API"/>
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
  14. <tr valign="middle">
  15. <td>
  16. <a accesskey="p" href="libxml2-debugXML.html">
  17. <img src="left.png" width="24" height="24" border="0" alt="Prev"/>
  18. </a>
  19. </td>
  20. <td>
  21. <a accesskey="u" href="general.html">
  22. <img src="up.png" width="24" height="24" border="0" alt="Up"/>
  23. </a>
  24. </td>
  25. <td>
  26. <a accesskey="h" href="index.html">
  27. <img src="home.png" width="24" height="24" border="0" alt="Home"/>
  28. </a>
  29. </td>
  30. <td>
  31. <a accesskey="n" href="libxml2-encoding.html">
  32. <img src="right.png" width="24" height="24" border="0" alt="Next"/>
  33. </a>
  34. </td>
  35. <th width="100%" align="center">libxml2 Reference Manual</th>
  36. </tr>
  37. </table>
  38. <h2>
  39. <span class="refentrytitle">dict</span>
  40. </h2>
  41. <p>dict - string dictionnary</p>
  42. <p>dictionary of reusable strings, just used to avoid allocation and freeing operations. </p>
  43. <p>Author(s): Daniel Veillard </p>
  44. <div class="refsynopsisdiv">
  45. <h2>Synopsis</h2>
  46. <pre class="synopsis">typedef struct _xmlDict <a href="#xmlDict">xmlDict</a>;
  47. typedef <a href="libxml2-dict.html#xmlDict">xmlDict</a> * <a href="#xmlDictPtr">xmlDictPtr</a>;
  48. int <a href="#xmlDictReference">xmlDictReference</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict);
  49. void <a href="#xmlDictCleanup">xmlDictCleanup</a> (void);
  50. int <a href="#xmlDictSize">xmlDictSize</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict);
  51. const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlDictExists">xmlDictExists</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int len);
  52. int <a href="#xmlDictOwns">xmlDictOwns</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str);
  53. const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlDictQLookup">xmlDictQLookup</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
  54. <a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> <a href="#xmlDictCreateSub">xmlDictCreateSub</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> sub);
  55. void <a href="#xmlDictFree">xmlDictFree</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict);
  56. const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlDictLookup">xmlDictLookup</a> (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int len);
  57. <a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> <a href="#xmlDictCreate">xmlDictCreate</a> (void);
  58. </pre>
  59. </div>
  60. <div class="refsect1" lang="en">
  61. <h2>Description</h2>
  62. </div>
  63. <div class="refsect1" lang="en">
  64. <h2>Details</h2>
  65. <div class="refsect2" lang="en">
  66. <div class="refsect2" lang="en"><h3><a name="xmlDict">Structure </a>xmlDict</h3><pre class="programlisting">struct _xmlDict {
  67. The content of this structure is not made public by the API.
  68. } xmlDict;
  69. </pre><p/>
  70. </div>
  71. <hr/>
  72. <div class="refsect2" lang="en"><h3><a name="xmlDictPtr">Typedef </a>xmlDictPtr</h3><pre class="programlisting"><a href="libxml2-dict.html#xmlDict">xmlDict</a> * xmlDictPtr;
  73. </pre><p/>
  74. </div>
  75. <hr/>
  76. <div class="refsect2" lang="en"><h3><a name="xmlDictCleanup"/>xmlDictCleanup ()</h3><pre class="programlisting">void xmlDictCleanup (void)<br/>
  77. </pre><p>Free the dictionary mutex.</p>
  78. </div>
  79. <hr/>
  80. <div class="refsect2" lang="en"><h3><a name="xmlDictCreate"/>xmlDictCreate ()</h3><pre class="programlisting"><a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> xmlDictCreate (void)<br/>
  81. </pre><p>Create a new dictionary</p>
  82. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created dictionnary, or NULL if an error occured.</td></tr></tbody></table></div></div>
  83. <hr/>
  84. <div class="refsect2" lang="en"><h3><a name="xmlDictCreateSub"/>xmlDictCreateSub ()</h3><pre class="programlisting"><a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> xmlDictCreateSub (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> sub)<br/>
  85. </pre><p>Create a new dictionary, inheriting strings from the read-only dictionnary @sub. On lookup, strings are first searched in the new dictionnary, then in @sub, and if not found are created in the new dictionnary.</p>
  86. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>sub</tt></i>:</span></td><td>an existing dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created dictionnary, or NULL if an error occured.</td></tr></tbody></table></div></div>
  87. <hr/>
  88. <div class="refsect2" lang="en"><h3><a name="xmlDictExists"/>xmlDictExists ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlDictExists (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int len)<br/>
  89. </pre><p>Check if the @name exists in the dictionnary @dict.</p>
  90. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the name of the userdata</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the name, if -1 it is recomputed</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the internal copy of the name or NULL if not found.</td></tr></tbody></table></div></div>
  91. <hr/>
  92. <div class="refsect2" lang="en"><h3><a name="xmlDictFree"/>xmlDictFree ()</h3><pre class="programlisting">void xmlDictFree (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br/>
  93. </pre><p>Free the hash @dict and its contents. The userdata is deallocated with @f if provided.</p>
  94. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr></tbody></table></div></div>
  95. <hr/>
  96. <div class="refsect2" lang="en"><h3><a name="xmlDictLookup"/>xmlDictLookup ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlDictLookup (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int len)<br/>
  97. </pre><p>Add the @name to the dictionnary @dict if not present.</p>
  98. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the name of the userdata</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the name, if -1 it is recomputed</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the internal copy of the name or NULL in case of internal error</td></tr></tbody></table></div></div>
  99. <hr/>
  100. <div class="refsect2" lang="en"><h3><a name="xmlDictOwns"/>xmlDictOwns ()</h3><pre class="programlisting">int xmlDictOwns (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str)<br/>
  101. </pre><p>check if a string is owned by the disctionary</p>
  102. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the string</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if true, 0 if false and -1 in case of error -1 in case of error</td></tr></tbody></table></div></div>
  103. <hr/>
  104. <div class="refsect2" lang="en"><h3><a name="xmlDictQLookup"/>xmlDictQLookup ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlDictQLookup (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br/>
  105. </pre><p>Add the QName @prefix:@name to the hash @dict if not present.</p>
  106. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>the prefix</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the name</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the internal copy of the QName or NULL in case of internal error</td></tr></tbody></table></div></div>
  107. <hr/>
  108. <div class="refsect2" lang="en"><h3><a name="xmlDictReference"/>xmlDictReference ()</h3><pre class="programlisting">int xmlDictReference (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br/>
  109. </pre><p>Increment the <a href="libxml2-SAX.html#reference">reference</a> counter of a dictionary</p>
  110. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of error</td></tr></tbody></table></div></div>
  111. <hr/>
  112. <div class="refsect2" lang="en"><h3><a name="xmlDictSize"/>xmlDictSize ()</h3><pre class="programlisting">int xmlDictSize (<a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br/>
  113. </pre><p>Query the number of elements installed in the hash @dict.</p>
  114. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements in the dictionnary or -1 in case of error</td></tr></tbody></table></div></div>
  115. <hr/>
  116. </div>
  117. </div>
  118. </body>
  119. </html>