hash.h

00001 /*
00002 
00003  * Summary: Chained hash tables
00004 
00005  * Description: This module implements the hash table support used in 
00006 
00007  *              various places in the library.
00008 
00009  *
00010 
00011  * Copy: See Copyright for the status of this software.
00012 
00013  *
00014 
00015  * Author: Bjorn Reese <bjorn.reese@systematic.dk>
00016 
00017  */
00018 
00019 
00020 
00021 #ifndef __XML_HASH_H__
00022 
00023 #define __XML_HASH_H__
00024 
00025 
00026 
00027 #ifdef __cplusplus
00028 
00029 extern "C" {
00030 
00031 #endif
00032 
00033 
00034 
00035 /*
00036 
00037  * The hash table.
00038 
00039  */
00040 
00041 typedef struct _xmlHashTable xmlHashTable;
00042 
00043 typedef xmlHashTable *xmlHashTablePtr;
00044 
00045 
00046 
00047 #ifdef __cplusplus
00048 
00049 }
00050 
00051 #endif
00052 
00053 
00054 
00055 #include <libxml/xmlversion.h>
00056 
00057 #include <libxml/parser.h>
00058 
00059 
00060 
00061 #ifdef __cplusplus
00062 
00063 extern "C" {
00064 
00065 #endif
00066 
00067 
00068 
00069 /*
00070 
00071  * Recent version of gcc produce a warning when a function pointer is assigned
00072 
00073  * to an object pointer, or vice versa.  The following macro is a dirty hack
00074 
00075  * to allow suppression of the warning.  If your architecture has function
00076 
00077  * pointers which are a different size than a void pointer, there may be some
00078 
00079  * serious trouble within the library.
00080 
00081  */
00082 
00101 #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
00102 
00103 
00104 
00105 /*
00106 
00107  * function types:
00108 
00109  */
00110 
00125 typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
00126 
00145 typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
00146 
00163 typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
00164 
00185 typedef void (*xmlHashScannerFull)(void *payload, void *data,
00186 
00187                                    const xmlChar *name, const xmlChar *name2,
00188 
00189                                    const xmlChar *name3);
00190 
00191 
00192 
00193 /*
00194 
00195  * Constructor and destructor.
00196 
00197  */
00198 
00199 XMLPUBFUN xmlHashTablePtr XMLCALL
00200 
00201                         xmlHashCreate   (int size);
00202 
00203 XMLPUBFUN void XMLCALL                  
00204 
00205                         xmlHashFree     (xmlHashTablePtr table,
00206 
00207                                          xmlHashDeallocator f);
00208 
00209 
00210 
00211 /*
00212 
00213  * Add a new entry to the hash table.
00214 
00215  */
00216 
00217 XMLPUBFUN int XMLCALL                   
00218 
00219                         xmlHashAddEntry (xmlHashTablePtr table,
00220 
00221                                          const xmlChar *name,
00222 
00223                                          void *userdata);
00224 
00225 XMLPUBFUN int XMLCALL                   
00226 
00227                         xmlHashUpdateEntry(xmlHashTablePtr table,
00228 
00229                                          const xmlChar *name,
00230 
00231                                          void *userdata,
00232 
00233                                          xmlHashDeallocator f);
00234 
00235 XMLPUBFUN int XMLCALL               
00236 
00237                         xmlHashAddEntry2(xmlHashTablePtr table,
00238 
00239                                          const xmlChar *name,
00240 
00241                                          const xmlChar *name2,
00242 
00243                                          void *userdata);
00244 
00245 XMLPUBFUN int XMLCALL                   
00246 
00247                         xmlHashUpdateEntry2(xmlHashTablePtr table,
00248 
00249                                          const xmlChar *name,
00250 
00251                                          const xmlChar *name2,
00252 
00253                                          void *userdata,
00254 
00255                                          xmlHashDeallocator f);
00256 
00257 XMLPUBFUN int XMLCALL                   
00258 
00259                         xmlHashAddEntry3(xmlHashTablePtr table,
00260 
00261                                          const xmlChar *name,
00262 
00263                                          const xmlChar *name2,
00264 
00265                                          const xmlChar *name3,
00266 
00267                                          void *userdata);
00268 
00269 XMLPUBFUN int XMLCALL                   
00270 
00271                         xmlHashUpdateEntry3(xmlHashTablePtr table,
00272 
00273                                          const xmlChar *name,
00274 
00275                                          const xmlChar *name2,
00276 
00277                                          const xmlChar *name3,
00278 
00279                                          void *userdata,
00280 
00281                                          xmlHashDeallocator f);
00282 
00283 
00284 
00285 /*
00286 
00287  * Remove an entry from the hash table.
00288 
00289  */
00290 
00291 XMLPUBFUN int XMLCALL     
00292 
00293                         xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
00294 
00295                            xmlHashDeallocator f);
00296 
00297 XMLPUBFUN int XMLCALL     
00298 
00299                         xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
00300 
00301                             const xmlChar *name2, xmlHashDeallocator f);
00302 
00303 XMLPUBFUN int  XMLCALL    
00304 
00305                         xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
00306 
00307                             const xmlChar *name2, const xmlChar *name3,
00308 
00309                             xmlHashDeallocator f);
00310 
00311 
00312 
00313 /*
00314 
00315  * Retrieve the userdata.
00316 
00317  */
00318 
00319 XMLPUBFUN void * XMLCALL                        
00320 
00321                         xmlHashLookup   (xmlHashTablePtr table,
00322 
00323                                          const xmlChar *name);
00324 
00325 XMLPUBFUN void * XMLCALL                        
00326 
00327                         xmlHashLookup2  (xmlHashTablePtr table,
00328 
00329                                          const xmlChar *name,
00330 
00331                                          const xmlChar *name2);
00332 
00333 XMLPUBFUN void * XMLCALL                        
00334 
00335                         xmlHashLookup3  (xmlHashTablePtr table,
00336 
00337                                          const xmlChar *name,
00338 
00339                                          const xmlChar *name2,
00340 
00341                                          const xmlChar *name3);
00342 
00343 XMLPUBFUN void * XMLCALL                        
00344 
00345                         xmlHashQLookup  (xmlHashTablePtr table,
00346 
00347                                          const xmlChar *name,
00348 
00349                                          const xmlChar *prefix);
00350 
00351 XMLPUBFUN void * XMLCALL                        
00352 
00353                         xmlHashQLookup2 (xmlHashTablePtr table,
00354 
00355                                          const xmlChar *name,
00356 
00357                                          const xmlChar *prefix,
00358 
00359                                          const xmlChar *name2,
00360 
00361                                          const xmlChar *prefix2);
00362 
00363 XMLPUBFUN void * XMLCALL                        
00364 
00365                         xmlHashQLookup3 (xmlHashTablePtr table,
00366 
00367                                          const xmlChar *name,
00368 
00369                                          const xmlChar *prefix,
00370 
00371                                          const xmlChar *name2,
00372 
00373                                          const xmlChar *prefix2,
00374 
00375                                          const xmlChar *name3,
00376 
00377                                          const xmlChar *prefix3);
00378 
00379 
00380 
00381 /*
00382 
00383  * Helpers.
00384 
00385  */
00386 
00387 XMLPUBFUN xmlHashTablePtr XMLCALL               
00388 
00389                         xmlHashCopy     (xmlHashTablePtr table,
00390 
00391                                          xmlHashCopier f);
00392 
00393 XMLPUBFUN int XMLCALL                   
00394 
00395                         xmlHashSize     (xmlHashTablePtr table);
00396 
00397 XMLPUBFUN void XMLCALL                  
00398 
00399                         xmlHashScan     (xmlHashTablePtr table,
00400 
00401                                          xmlHashScanner f,
00402 
00403                                          void *data);
00404 
00405 XMLPUBFUN void XMLCALL                  
00406 
00407                         xmlHashScan3    (xmlHashTablePtr table,
00408 
00409                                          const xmlChar *name,
00410 
00411                                          const xmlChar *name2,
00412 
00413                                          const xmlChar *name3,
00414 
00415                                          xmlHashScanner f,
00416 
00417                                          void *data);
00418 
00419 XMLPUBFUN void XMLCALL                  
00420 
00421                         xmlHashScanFull (xmlHashTablePtr table,
00422 
00423                                          xmlHashScannerFull f,
00424 
00425                                          void *data);
00426 
00427 XMLPUBFUN void XMLCALL                  
00428 
00429                         xmlHashScanFull3(xmlHashTablePtr table,
00430 
00431                                          const xmlChar *name,
00432 
00433                                          const xmlChar *name2,
00434 
00435                                          const xmlChar *name3,
00436 
00437                                          xmlHashScannerFull f,
00438 
00439                                          void *data);
00440 
00441 #ifdef __cplusplus
00442 
00443 }
00444 
00445 #endif
00446 
00447 #endif /* ! __XML_HASH_H__ */
00448 

Generated on Wed Jul 26 13:30:46 2006 for XSB by  doxygen 1.4.5