VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/include/libxml/hash.h@ 107935

Last change on this file since 107935 was 105420, checked in by vboxsync, 7 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

  • Property svn:eol-style set to native
File size: 6.9 KB
Line 
1/*
2 * Summary: Chained hash tables
3 * Description: This module implements the hash table support used in
4 * various places in the library.
5 *
6 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Bjorn Reese <[email protected]>
9 */
10
11#ifndef __XML_HASH_H__
12#define __XML_HASH_H__
13
14#include <libxml/xmlversion.h>
15#include <libxml/dict.h>
16#include <libxml/xmlstring.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/*
23 * The hash table.
24 */
25typedef struct _xmlHashTable xmlHashTable;
26typedef xmlHashTable *xmlHashTablePtr;
27
28/*
29 * Recent version of gcc produce a warning when a function pointer is assigned
30 * to an object pointer, or vice versa. The following macro is a dirty hack
31 * to allow suppression of the warning. If your architecture has function
32 * pointers which are a different size than a void pointer, there may be some
33 * serious trouble within the library.
34 */
35/**
36 * XML_CAST_FPTR:
37 * @fptr: pointer to a function
38 *
39 * Macro to do a casting from an object pointer to a
40 * function pointer without encountering a warning from
41 * gcc
42 *
43 * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
44 * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
45 * so it is disabled now
46 */
47
48#define XML_CAST_FPTR(fptr) fptr
49
50/*
51 * function types:
52 */
53/**
54 * xmlHashDeallocator:
55 * @payload: the data in the hash
56 * @name: the name associated
57 *
58 * Callback to free data from a hash.
59 */
60typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
61/**
62 * xmlHashCopier:
63 * @payload: the data in the hash
64 * @name: the name associated
65 *
66 * Callback to copy data from a hash.
67 *
68 * Returns a copy of the data or NULL in case of error.
69 */
70typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
71/**
72 * xmlHashScanner:
73 * @payload: the data in the hash
74 * @data: extra scanner data
75 * @name: the name associated
76 *
77 * Callback when scanning data in a hash with the simple scanner.
78 */
79typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
80/**
81 * xmlHashScannerFull:
82 * @payload: the data in the hash
83 * @data: extra scanner data
84 * @name: the name associated
85 * @name2: the second name associated
86 * @name3: the third name associated
87 *
88 * Callback when scanning data in a hash with the full scanner.
89 */
90typedef void (*xmlHashScannerFull)(void *payload, void *data,
91 const xmlChar *name, const xmlChar *name2,
92 const xmlChar *name3);
93
94/*
95 * Constructor and destructor.
96 */
97XMLPUBFUN xmlHashTablePtr
98 xmlHashCreate (int size);
99XMLPUBFUN xmlHashTablePtr
100 xmlHashCreateDict (int size,
101 xmlDictPtr dict);
102XMLPUBFUN void
103 xmlHashFree (xmlHashTablePtr hash,
104 xmlHashDeallocator dealloc);
105XMLPUBFUN void
106 xmlHashDefaultDeallocator(void *entry,
107 const xmlChar *name);
108
109/*
110 * Add a new entry to the hash table.
111 */
112XMLPUBFUN int
113 xmlHashAdd (xmlHashTablePtr hash,
114 const xmlChar *name,
115 void *userdata);
116XMLPUBFUN int
117 xmlHashAddEntry (xmlHashTablePtr hash,
118 const xmlChar *name,
119 void *userdata);
120XMLPUBFUN int
121 xmlHashUpdateEntry (xmlHashTablePtr hash,
122 const xmlChar *name,
123 void *userdata,
124 xmlHashDeallocator dealloc);
125XMLPUBFUN int
126 xmlHashAdd2 (xmlHashTablePtr hash,
127 const xmlChar *name,
128 const xmlChar *name2,
129 void *userdata);
130XMLPUBFUN int
131 xmlHashAddEntry2 (xmlHashTablePtr hash,
132 const xmlChar *name,
133 const xmlChar *name2,
134 void *userdata);
135XMLPUBFUN int
136 xmlHashUpdateEntry2 (xmlHashTablePtr hash,
137 const xmlChar *name,
138 const xmlChar *name2,
139 void *userdata,
140 xmlHashDeallocator dealloc);
141XMLPUBFUN int
142 xmlHashAdd3 (xmlHashTablePtr hash,
143 const xmlChar *name,
144 const xmlChar *name2,
145 const xmlChar *name3,
146 void *userdata);
147XMLPUBFUN int
148 xmlHashAddEntry3 (xmlHashTablePtr hash,
149 const xmlChar *name,
150 const xmlChar *name2,
151 const xmlChar *name3,
152 void *userdata);
153XMLPUBFUN int
154 xmlHashUpdateEntry3 (xmlHashTablePtr hash,
155 const xmlChar *name,
156 const xmlChar *name2,
157 const xmlChar *name3,
158 void *userdata,
159 xmlHashDeallocator dealloc);
160
161/*
162 * Remove an entry from the hash table.
163 */
164XMLPUBFUN int
165 xmlHashRemoveEntry (xmlHashTablePtr hash,
166 const xmlChar *name,
167 xmlHashDeallocator dealloc);
168XMLPUBFUN int
169 xmlHashRemoveEntry2 (xmlHashTablePtr hash,
170 const xmlChar *name,
171 const xmlChar *name2,
172 xmlHashDeallocator dealloc);
173XMLPUBFUN int
174 xmlHashRemoveEntry3 (xmlHashTablePtr hash,
175 const xmlChar *name,
176 const xmlChar *name2,
177 const xmlChar *name3,
178 xmlHashDeallocator dealloc);
179
180/*
181 * Retrieve the payload.
182 */
183XMLPUBFUN void *
184 xmlHashLookup (xmlHashTablePtr hash,
185 const xmlChar *name);
186XMLPUBFUN void *
187 xmlHashLookup2 (xmlHashTablePtr hash,
188 const xmlChar *name,
189 const xmlChar *name2);
190XMLPUBFUN void *
191 xmlHashLookup3 (xmlHashTablePtr hash,
192 const xmlChar *name,
193 const xmlChar *name2,
194 const xmlChar *name3);
195XMLPUBFUN void *
196 xmlHashQLookup (xmlHashTablePtr hash,
197 const xmlChar *prefix,
198 const xmlChar *name);
199XMLPUBFUN void *
200 xmlHashQLookup2 (xmlHashTablePtr hash,
201 const xmlChar *prefix,
202 const xmlChar *name,
203 const xmlChar *prefix2,
204 const xmlChar *name2);
205XMLPUBFUN void *
206 xmlHashQLookup3 (xmlHashTablePtr hash,
207 const xmlChar *prefix,
208 const xmlChar *name,
209 const xmlChar *prefix2,
210 const xmlChar *name2,
211 const xmlChar *prefix3,
212 const xmlChar *name3);
213
214/*
215 * Helpers.
216 */
217XMLPUBFUN xmlHashTablePtr
218 xmlHashCopySafe (xmlHashTablePtr hash,
219 xmlHashCopier copy,
220 xmlHashDeallocator dealloc);
221XMLPUBFUN xmlHashTablePtr
222 xmlHashCopy (xmlHashTablePtr hash,
223 xmlHashCopier copy);
224XMLPUBFUN int
225 xmlHashSize (xmlHashTablePtr hash);
226XMLPUBFUN void
227 xmlHashScan (xmlHashTablePtr hash,
228 xmlHashScanner scan,
229 void *data);
230XMLPUBFUN void
231 xmlHashScan3 (xmlHashTablePtr hash,
232 const xmlChar *name,
233 const xmlChar *name2,
234 const xmlChar *name3,
235 xmlHashScanner scan,
236 void *data);
237XMLPUBFUN void
238 xmlHashScanFull (xmlHashTablePtr hash,
239 xmlHashScannerFull scan,
240 void *data);
241XMLPUBFUN void
242 xmlHashScanFull3 (xmlHashTablePtr hash,
243 const xmlChar *name,
244 const xmlChar *name2,
245 const xmlChar *name3,
246 xmlHashScannerFull scan,
247 void *data);
248#ifdef __cplusplus
249}
250#endif
251#endif /* ! __XML_HASH_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette