williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Summary: chained hash tables
|
williamr@4
|
3 |
* description: this module implement the hash table support used in
|
williamr@4
|
4 |
* various place in the library.
|
williamr@4
|
5 |
*
|
williamr@4
|
6 |
* Copy: See Copyright for the status of this software.
|
williamr@4
|
7 |
*
|
williamr@4
|
8 |
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
|
williamr@4
|
9 |
* Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
williamr@4
|
10 |
*/
|
williamr@4
|
11 |
|
williamr@4
|
12 |
/** @file
|
williamr@4
|
13 |
@publishedAll
|
williamr@4
|
14 |
@released
|
williamr@4
|
15 |
*/
|
williamr@4
|
16 |
|
williamr@4
|
17 |
#ifndef XML_HASH_H
|
williamr@4
|
18 |
#define XML_HASH_H
|
williamr@4
|
19 |
|
williamr@4
|
20 |
#include <stdapis/libxml2/libxml2_xmlstring.h>
|
williamr@4
|
21 |
|
williamr@4
|
22 |
#ifdef __cplusplus
|
williamr@4
|
23 |
extern "C" {
|
williamr@4
|
24 |
#endif
|
williamr@4
|
25 |
|
williamr@4
|
26 |
/*
|
williamr@4
|
27 |
* The hash table.
|
williamr@4
|
28 |
*/
|
williamr@4
|
29 |
typedef struct _xmlHashTable xmlHashTable;
|
williamr@4
|
30 |
typedef xmlHashTable* xmlHashTablePtr;
|
williamr@4
|
31 |
|
williamr@4
|
32 |
#ifdef __cplusplus
|
williamr@4
|
33 |
}
|
williamr@4
|
34 |
#endif
|
williamr@4
|
35 |
#ifdef __cplusplus
|
williamr@4
|
36 |
extern "C" {
|
williamr@4
|
37 |
#endif
|
williamr@4
|
38 |
|
williamr@4
|
39 |
/*
|
williamr@4
|
40 |
* function types:
|
williamr@4
|
41 |
*/
|
williamr@4
|
42 |
/**
|
williamr@4
|
43 |
* xmlHashDeallocator:
|
williamr@4
|
44 |
* @param payload the data in the hash
|
williamr@4
|
45 |
* @param name the name associated
|
williamr@4
|
46 |
*
|
williamr@4
|
47 |
* Callback to free data from a hash.
|
williamr@4
|
48 |
*/
|
williamr@4
|
49 |
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
|
williamr@4
|
50 |
/**
|
williamr@4
|
51 |
* xmlHashCopier:
|
williamr@4
|
52 |
* @param payload the data in the hash
|
williamr@4
|
53 |
* @param name the name associated
|
williamr@4
|
54 |
*
|
williamr@4
|
55 |
* Callback to copy data from a hash.
|
williamr@4
|
56 |
*
|
williamr@4
|
57 |
* Returns a copy of the data or NULL in case of error.
|
williamr@4
|
58 |
*/
|
williamr@4
|
59 |
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
|
williamr@4
|
60 |
/**
|
williamr@4
|
61 |
* xmlHashScanner:
|
williamr@4
|
62 |
* @param payload the data in the hash
|
williamr@4
|
63 |
* @param data extra scannner data
|
williamr@4
|
64 |
* @param name the name associated
|
williamr@4
|
65 |
*
|
williamr@4
|
66 |
* Callback when scanning data in a hash with the simple scanner.
|
williamr@4
|
67 |
*/
|
williamr@4
|
68 |
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
|
williamr@4
|
69 |
/**
|
williamr@4
|
70 |
* xmlHashScannerFull:
|
williamr@4
|
71 |
* @param payload the data in the hash
|
williamr@4
|
72 |
* @param data extra scannner data
|
williamr@4
|
73 |
* @param name the name associated
|
williamr@4
|
74 |
* @param name2 the second name associated
|
williamr@4
|
75 |
* @param name3 the third name associated
|
williamr@4
|
76 |
*
|
williamr@4
|
77 |
* Callback when scanning data in a hash with the full scanner.
|
williamr@4
|
78 |
*/
|
williamr@4
|
79 |
typedef void (*xmlHashScannerFull)(void *payload, void *data,
|
williamr@4
|
80 |
const xmlChar *name, const xmlChar *name2,
|
williamr@4
|
81 |
const xmlChar *name3);
|
williamr@4
|
82 |
|
williamr@4
|
83 |
/*
|
williamr@4
|
84 |
* Constructor and destructor.
|
williamr@4
|
85 |
*/
|
williamr@4
|
86 |
XMLPUBFUN xmlHashTablePtr XMLCALL
|
williamr@4
|
87 |
xmlHashCreate (int size);
|
williamr@4
|
88 |
XMLPUBFUN void XMLCALL
|
williamr@4
|
89 |
xmlHashFree (xmlHashTablePtr table,
|
williamr@4
|
90 |
xmlHashDeallocator f);
|
williamr@4
|
91 |
|
williamr@4
|
92 |
|
williamr@4
|
93 |
/*
|
williamr@4
|
94 |
* Add a new entry to the hash table.
|
williamr@4
|
95 |
*/
|
williamr@4
|
96 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
97 |
xmlHashAddEntry (xmlHashTablePtr table,
|
williamr@4
|
98 |
const xmlChar *name,
|
williamr@4
|
99 |
void *userdata);
|
williamr@4
|
100 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
101 |
xmlHashUpdateEntry(xmlHashTablePtr table,
|
williamr@4
|
102 |
const xmlChar *name,
|
williamr@4
|
103 |
void *userdata,
|
williamr@4
|
104 |
xmlHashDeallocator f);
|
williamr@4
|
105 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
106 |
xmlHashAddEntry2(xmlHashTablePtr table,
|
williamr@4
|
107 |
const xmlChar *name,
|
williamr@4
|
108 |
const xmlChar *name2,
|
williamr@4
|
109 |
void *userdata);
|
williamr@4
|
110 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
111 |
xmlHashUpdateEntry2(xmlHashTablePtr table,
|
williamr@4
|
112 |
const xmlChar *name,
|
williamr@4
|
113 |
const xmlChar *name2,
|
williamr@4
|
114 |
void *userdata,
|
williamr@4
|
115 |
xmlHashDeallocator f);
|
williamr@4
|
116 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
117 |
xmlHashAddEntry3(xmlHashTablePtr table,
|
williamr@4
|
118 |
const xmlChar *name,
|
williamr@4
|
119 |
const xmlChar *name2,
|
williamr@4
|
120 |
const xmlChar *name3,
|
williamr@4
|
121 |
void *userdata);
|
williamr@4
|
122 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
123 |
xmlHashUpdateEntry3(xmlHashTablePtr table,
|
williamr@4
|
124 |
const xmlChar *name,
|
williamr@4
|
125 |
const xmlChar *name2,
|
williamr@4
|
126 |
const xmlChar *name3,
|
williamr@4
|
127 |
void *userdata,
|
williamr@4
|
128 |
xmlHashDeallocator f);
|
williamr@4
|
129 |
|
williamr@4
|
130 |
/*
|
williamr@4
|
131 |
* Remove an entry from the hash table.
|
williamr@4
|
132 |
*/
|
williamr@4
|
133 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
134 |
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
|
williamr@4
|
135 |
xmlHashDeallocator f);
|
williamr@4
|
136 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
137 |
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
|
williamr@4
|
138 |
const xmlChar *name2, xmlHashDeallocator f);
|
williamr@4
|
139 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
140 |
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
|
williamr@4
|
141 |
const xmlChar *name2, const xmlChar *name3,
|
williamr@4
|
142 |
xmlHashDeallocator f);
|
williamr@4
|
143 |
|
williamr@4
|
144 |
/*
|
williamr@4
|
145 |
* Retrieve the userdata.
|
williamr@4
|
146 |
*/
|
williamr@4
|
147 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
148 |
xmlHashLookup (xmlHashTablePtr table,
|
williamr@4
|
149 |
const xmlChar *name);
|
williamr@4
|
150 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
151 |
xmlHashLookup2 (xmlHashTablePtr table,
|
williamr@4
|
152 |
const xmlChar *name,
|
williamr@4
|
153 |
const xmlChar *name2);
|
williamr@4
|
154 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
155 |
xmlHashLookup3 (xmlHashTablePtr table,
|
williamr@4
|
156 |
const xmlChar *name,
|
williamr@4
|
157 |
const xmlChar *name2,
|
williamr@4
|
158 |
const xmlChar *name3);
|
williamr@4
|
159 |
|
williamr@4
|
160 |
#ifndef XMLENGINE_EXCLUDE_UNUSED
|
williamr@4
|
161 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
162 |
xmlHashQLookup (xmlHashTablePtr table,
|
williamr@4
|
163 |
const xmlChar *name,
|
williamr@4
|
164 |
const xmlChar *prefix);
|
williamr@4
|
165 |
#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */
|
williamr@4
|
166 |
|
williamr@4
|
167 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
168 |
xmlHashQLookup2 (xmlHashTablePtr table,
|
williamr@4
|
169 |
const xmlChar *name,
|
williamr@4
|
170 |
const xmlChar *prefix,
|
williamr@4
|
171 |
const xmlChar *name2,
|
williamr@4
|
172 |
const xmlChar *prefix2);
|
williamr@4
|
173 |
XMLPUBFUN void * XMLCALL
|
williamr@4
|
174 |
xmlHashQLookup3 (xmlHashTablePtr table,
|
williamr@4
|
175 |
const xmlChar *name,
|
williamr@4
|
176 |
const xmlChar *prefix,
|
williamr@4
|
177 |
const xmlChar *name2,
|
williamr@4
|
178 |
const xmlChar *prefix2,
|
williamr@4
|
179 |
const xmlChar *name3,
|
williamr@4
|
180 |
const xmlChar *prefix3);
|
williamr@4
|
181 |
|
williamr@4
|
182 |
/*
|
williamr@4
|
183 |
* Helpers.
|
williamr@4
|
184 |
*/
|
williamr@4
|
185 |
XMLPUBFUN xmlHashTablePtr XMLCALL
|
williamr@4
|
186 |
xmlHashCopy (xmlHashTablePtr table,
|
williamr@4
|
187 |
xmlHashCopier f);
|
williamr@4
|
188 |
|
williamr@4
|
189 |
#ifndef XMLENGINE_EXCLUDE_UNUSED
|
williamr@4
|
190 |
XMLPUBFUN int XMLCALL
|
williamr@4
|
191 |
xmlHashSize (xmlHashTablePtr table);
|
williamr@4
|
192 |
#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */
|
williamr@4
|
193 |
|
williamr@4
|
194 |
XMLPUBFUN void XMLCALL
|
williamr@4
|
195 |
xmlHashScan (xmlHashTablePtr table,
|
williamr@4
|
196 |
xmlHashScanner f,
|
williamr@4
|
197 |
void *data);
|
williamr@4
|
198 |
XMLPUBFUN void XMLCALL
|
williamr@4
|
199 |
xmlHashScan3 (xmlHashTablePtr table,
|
williamr@4
|
200 |
const xmlChar *name,
|
williamr@4
|
201 |
const xmlChar *name2,
|
williamr@4
|
202 |
const xmlChar *name3,
|
williamr@4
|
203 |
xmlHashScanner f,
|
williamr@4
|
204 |
void *data);
|
williamr@4
|
205 |
XMLPUBFUN void XMLCALL
|
williamr@4
|
206 |
xmlHashScanFull (xmlHashTablePtr table,
|
williamr@4
|
207 |
xmlHashScannerFull f,
|
williamr@4
|
208 |
void *data);
|
williamr@4
|
209 |
XMLPUBFUN void XMLCALL
|
williamr@4
|
210 |
xmlHashScanFull3(xmlHashTablePtr table,
|
williamr@4
|
211 |
const xmlChar *name,
|
williamr@4
|
212 |
const xmlChar *name2,
|
williamr@4
|
213 |
const xmlChar *name3,
|
williamr@4
|
214 |
xmlHashScannerFull f,
|
williamr@4
|
215 |
void *data);
|
williamr@4
|
216 |
#ifdef __cplusplus
|
williamr@4
|
217 |
}
|
williamr@4
|
218 |
#endif
|
williamr@4
|
219 |
#endif /* XML_HASH_H */
|
williamr@4
|
220 |
|