Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

hash.h

Go to the documentation of this file.
00001 /*
00002  * hash.h: chained hash tables
00003  *
00004  * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
00011  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00012  * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
00013  * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
00014  *
00015  * Author: bjorn.reese@systematic.dk
00016  */
00017 
00018 #ifndef __XML_HASH_H__
00019 #define __XML_HASH_H__
00020 
00021 #include <libxml/xmlversion.h>
00022 #include <libxml/parser.h>
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /*
00029  * The hash table.
00030  */
00031 typedef struct _xmlHashTable xmlHashTable;
00032 typedef xmlHashTable *xmlHashTablePtr;
00033 
00034 /*
00035  * function types:
00036  */
00044 typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
00054 typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
00063 typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
00074 typedef void (*xmlHashScannerFull)(void *payload, void *data,
00075                                    const xmlChar *name, const xmlChar *name2,
00076                                    const xmlChar *name3);
00077 
00078 /*
00079  * Constructor and destructor.
00080  */
00081 XMLPUBFUN xmlHashTablePtr XMLCALL
00082                         xmlHashCreate   (int size);
00083 XMLPUBFUN void XMLCALL                  
00084                         xmlHashFree     (xmlHashTablePtr table,
00085                                          xmlHashDeallocator f);
00086 
00087 /*
00088  * Add a new entry to the hash table.
00089  */
00090 XMLPUBFUN int XMLCALL                   
00091                         xmlHashAddEntry (xmlHashTablePtr table,
00092                                          const xmlChar *name,
00093                                          void *userdata);
00094 XMLPUBFUN int XMLCALL                   
00095                         xmlHashUpdateEntry(xmlHashTablePtr table,
00096                                          const xmlChar *name,
00097                                          void *userdata,
00098                                          xmlHashDeallocator f);
00099 XMLPUBFUN int XMLCALL               
00100                         xmlHashAddEntry2(xmlHashTablePtr table,
00101                                          const xmlChar *name,
00102                                          const xmlChar *name2,
00103                                          void *userdata);
00104 XMLPUBFUN int XMLCALL                   
00105                         xmlHashUpdateEntry2(xmlHashTablePtr table,
00106                                          const xmlChar *name,
00107                                          const xmlChar *name2,
00108                                          void *userdata,
00109                                          xmlHashDeallocator f);
00110 XMLPUBFUN int XMLCALL                   
00111                         xmlHashAddEntry3(xmlHashTablePtr table,
00112                                          const xmlChar *name,
00113                                          const xmlChar *name2,
00114                                          const xmlChar *name3,
00115                                          void *userdata);
00116 XMLPUBFUN int XMLCALL                   
00117                         xmlHashUpdateEntry3(xmlHashTablePtr table,
00118                                          const xmlChar *name,
00119                                          const xmlChar *name2,
00120                                          const xmlChar *name3,
00121                                          void *userdata,
00122                                          xmlHashDeallocator f);
00123 
00124 /*
00125  * Remove an entry from the hash table.
00126  */
00127 XMLPUBFUN int XMLCALL     
00128                         xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
00129                            xmlHashDeallocator f);
00130 XMLPUBFUN int XMLCALL     
00131                         xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
00132                             const xmlChar *name2, xmlHashDeallocator f);
00133 XMLPUBFUN int  XMLCALL    
00134                         xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
00135                             const xmlChar *name2, const xmlChar *name3,
00136                             xmlHashDeallocator f);
00137 
00138 /*
00139  * Retrieve the userdata.
00140  */
00141 XMLPUBFUN void * XMLCALL                        
00142                         xmlHashLookup   (xmlHashTablePtr table,
00143                                          const xmlChar *name);
00144 XMLPUBFUN void * XMLCALL                        
00145                         xmlHashLookup2  (xmlHashTablePtr table,
00146                                          const xmlChar *name,
00147                                          const xmlChar *name2);
00148 XMLPUBFUN void * XMLCALL                        
00149                         xmlHashLookup3  (xmlHashTablePtr table,
00150                                          const xmlChar *name,
00151                                          const xmlChar *name2,
00152                                          const xmlChar *name3);
00153 XMLPUBFUN void * XMLCALL                        
00154                         xmlHashQLookup  (xmlHashTablePtr table,
00155                                          const xmlChar *name,
00156                                          const xmlChar *prefix);
00157 XMLPUBFUN void * XMLCALL                        
00158                         xmlHashQLookup2 (xmlHashTablePtr table,
00159                                          const xmlChar *name,
00160                                          const xmlChar *prefix,
00161                                          const xmlChar *name2,
00162                                          const xmlChar *prefix2);
00163 XMLPUBFUN void * XMLCALL                        
00164                         xmlHashQLookup3 (xmlHashTablePtr table,
00165                                          const xmlChar *name,
00166                                          const xmlChar *prefix,
00167                                          const xmlChar *name2,
00168                                          const xmlChar *prefix2,
00169                                          const xmlChar *name3,
00170                                          const xmlChar *prefix3);
00171 
00172 /*
00173  * Helpers.
00174  */
00175 XMLPUBFUN xmlHashTablePtr XMLCALL               
00176                         xmlHashCopy     (xmlHashTablePtr table,
00177                                          xmlHashCopier f);
00178 XMLPUBFUN int XMLCALL                   
00179                         xmlHashSize     (xmlHashTablePtr table);
00180 XMLPUBFUN void XMLCALL                  
00181                         xmlHashScan     (xmlHashTablePtr table,
00182                                          xmlHashScanner f,
00183                                          void *data);
00184 XMLPUBFUN void XMLCALL                  
00185                         xmlHashScan3    (xmlHashTablePtr table,
00186                                          const xmlChar *name,
00187                                          const xmlChar *name2,
00188                                          const xmlChar *name3,
00189                                          xmlHashScanner f,
00190                                          void *data);
00191 XMLPUBFUN void XMLCALL                  
00192                         xmlHashScanFull (xmlHashTablePtr table,
00193                                          xmlHashScannerFull f,
00194                                          void *data);
00195 XMLPUBFUN void XMLCALL                  
00196                         xmlHashScanFull3(xmlHashTablePtr table,
00197                                          const xmlChar *name,
00198                                          const xmlChar *name2,
00199                                          const xmlChar *name3,
00200                                          xmlHashScannerFull f,
00201                                          void *data);
00202 #ifdef __cplusplus
00203 }
00204 #endif
00205 #endif /* ! __XML_HASH_H__ */
00206 

Generated on Wed Mar 16 00:10:27 2005 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1