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