2
* Summary: Chained hash tables
3
* Description: This module implements the hash table support used in
4
* various places in the library.
6
* Copy: See Copyright for the status of this software.
8
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
11
#ifndef __XML_HASH_H__
12
#define __XML_HASH_H__
21
typedef struct _xmlHashTable xmlHashTable;
22
typedef xmlHashTable *xmlHashTablePtr;
28
#include <libxml/xmlversion.h>
29
#include <libxml/parser.h>
36
* Recent version of gcc produce a warning when a function pointer is assigned
37
* to an object pointer, or vice versa. The following macro is a dirty hack
38
* to allow suppression of the warning. If your architecture has function
39
* pointers which are a different size than a void pointer, there may be some
40
* serious trouble within the library.
44
* @fptr: pointer to a function
46
* Macro to do a casting from an object pointer to a
47
* function pointer without encountering a warning from
51
#define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
58
* @payload: the data in the hash
59
* @name: the name associated
61
* Callback to free data from a hash.
63
typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
66
* @payload: the data in the hash
67
* @name: the name associated
69
* Callback to copy data from a hash.
71
* Returns a copy of the data or NULL in case of error.
73
typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
76
* @payload: the data in the hash
77
* @data: extra scannner data
78
* @name: the name associated
80
* Callback when scanning data in a hash with the simple scanner.
82
typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
85
* @payload: the data in the hash
86
* @data: extra scannner data
87
* @name: the name associated
88
* @name2: the second name associated
89
* @name3: the third name associated
91
* Callback when scanning data in a hash with the full scanner.
93
typedef void (*xmlHashScannerFull)(void *payload, void *data,
94
const xmlChar *name, const xmlChar *name2,
95
const xmlChar *name3);
98
* Constructor and destructor.
100
XMLPUBFUN xmlHashTablePtr XMLCALL
101
xmlHashCreate (int size);
102
XMLPUBFUN void XMLCALL
103
xmlHashFree (xmlHashTablePtr table,
104
xmlHashDeallocator f);
107
* Add a new entry to the hash table.
109
XMLPUBFUN int XMLCALL
110
xmlHashAddEntry (xmlHashTablePtr table,
113
XMLPUBFUN int XMLCALL
114
xmlHashUpdateEntry(xmlHashTablePtr table,
117
xmlHashDeallocator f);
118
XMLPUBFUN int XMLCALL
119
xmlHashAddEntry2(xmlHashTablePtr table,
121
const xmlChar *name2,
123
XMLPUBFUN int XMLCALL
124
xmlHashUpdateEntry2(xmlHashTablePtr table,
126
const xmlChar *name2,
128
xmlHashDeallocator f);
129
XMLPUBFUN int XMLCALL
130
xmlHashAddEntry3(xmlHashTablePtr table,
132
const xmlChar *name2,
133
const xmlChar *name3,
135
XMLPUBFUN int XMLCALL
136
xmlHashUpdateEntry3(xmlHashTablePtr table,
138
const xmlChar *name2,
139
const xmlChar *name3,
141
xmlHashDeallocator f);
144
* Remove an entry from the hash table.
146
XMLPUBFUN int XMLCALL
147
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
148
xmlHashDeallocator f);
149
XMLPUBFUN int XMLCALL
150
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
151
const xmlChar *name2, xmlHashDeallocator f);
152
XMLPUBFUN int XMLCALL
153
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
154
const xmlChar *name2, const xmlChar *name3,
155
xmlHashDeallocator f);
158
* Retrieve the userdata.
160
XMLPUBFUN void * XMLCALL
161
xmlHashLookup (xmlHashTablePtr table,
162
const xmlChar *name);
163
XMLPUBFUN void * XMLCALL
164
xmlHashLookup2 (xmlHashTablePtr table,
166
const xmlChar *name2);
167
XMLPUBFUN void * XMLCALL
168
xmlHashLookup3 (xmlHashTablePtr table,
170
const xmlChar *name2,
171
const xmlChar *name3);
172
XMLPUBFUN void * XMLCALL
173
xmlHashQLookup (xmlHashTablePtr table,
175
const xmlChar *prefix);
176
XMLPUBFUN void * XMLCALL
177
xmlHashQLookup2 (xmlHashTablePtr table,
179
const xmlChar *prefix,
180
const xmlChar *name2,
181
const xmlChar *prefix2);
182
XMLPUBFUN void * XMLCALL
183
xmlHashQLookup3 (xmlHashTablePtr table,
185
const xmlChar *prefix,
186
const xmlChar *name2,
187
const xmlChar *prefix2,
188
const xmlChar *name3,
189
const xmlChar *prefix3);
194
XMLPUBFUN xmlHashTablePtr XMLCALL
195
xmlHashCopy (xmlHashTablePtr table,
197
XMLPUBFUN int XMLCALL
198
xmlHashSize (xmlHashTablePtr table);
199
XMLPUBFUN void XMLCALL
200
xmlHashScan (xmlHashTablePtr table,
203
XMLPUBFUN void XMLCALL
204
xmlHashScan3 (xmlHashTablePtr table,
206
const xmlChar *name2,
207
const xmlChar *name3,
210
XMLPUBFUN void XMLCALL
211
xmlHashScanFull (xmlHashTablePtr table,
212
xmlHashScannerFull f,
214
XMLPUBFUN void XMLCALL
215
xmlHashScanFull3(xmlHashTablePtr table,
217
const xmlChar *name2,
218
const xmlChar *name3,
219
xmlHashScannerFull f,
224
#endif /* ! __XML_HASH_H__ */