| 1 | /** |
|---|---|
| 2 | * @file |
| 3 | * |
| 4 | * @brief string dictionary |
| 5 | * |
| 6 | * dictionary of reusable strings, just used to avoid allocation |
| 7 | * and freeing operations. |
| 8 | * |
| 9 | * @copyright See Copyright for the status of this software. |
| 10 | * |
| 11 | * @author Daniel Veillard |
| 12 | */ |
| 13 | |
| 14 | #ifndef __XML_DICT_H__ |
| 15 | #define __XML_DICT_H__ |
| 16 | |
| 17 | #include <stddef.h> |
| 18 | #include <libxml/xmlversion.h> |
| 19 | #include <libxml/xmlstring.h> |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C"{ |
| 23 | #endif |
| 24 | |
| 25 | /** |
| 26 | * Dictionary (pool for interned strings) |
| 27 | */ |
| 28 | typedef struct _xmlDict xmlDict; |
| 29 | typedef xmlDict *xmlDictPtr; |
| 30 | |
| 31 | /* |
| 32 | * Initializer |
| 33 | */ |
| 34 | XML_DEPRECATED |
| 35 | XMLPUBFUN int xmlInitializeDict(void); |
| 36 | |
| 37 | /* |
| 38 | * Constructor and destructor. |
| 39 | */ |
| 40 | XMLPUBFUN xmlDict * |
| 41 | xmlDictCreate (void); |
| 42 | XMLPUBFUN size_t |
| 43 | xmlDictSetLimit (xmlDict *dict, |
| 44 | size_t limit); |
| 45 | XMLPUBFUN size_t |
| 46 | xmlDictGetUsage (xmlDict *dict); |
| 47 | XMLPUBFUN xmlDict * |
| 48 | xmlDictCreateSub(xmlDict *sub); |
| 49 | XMLPUBFUN int |
| 50 | xmlDictReference(xmlDict *dict); |
| 51 | XMLPUBFUN void |
| 52 | xmlDictFree (xmlDict *dict); |
| 53 | |
| 54 | /* |
| 55 | * Lookup of entry in the dictionary. |
| 56 | */ |
| 57 | XMLPUBFUN const xmlChar * |
| 58 | xmlDictLookup (xmlDict *dict, |
| 59 | const xmlChar *name, |
| 60 | int len); |
| 61 | XMLPUBFUN const xmlChar * |
| 62 | xmlDictExists (xmlDict *dict, |
| 63 | const xmlChar *name, |
| 64 | int len); |
| 65 | XMLPUBFUN const xmlChar * |
| 66 | xmlDictQLookup (xmlDict *dict, |
| 67 | const xmlChar *prefix, |
| 68 | const xmlChar *name); |
| 69 | XMLPUBFUN int |
| 70 | xmlDictOwns (xmlDict *dict, |
| 71 | const xmlChar *str); |
| 72 | XMLPUBFUN int |
| 73 | xmlDictSize (xmlDict *dict); |
| 74 | |
| 75 | /* |
| 76 | * Cleanup function |
| 77 | */ |
| 78 | XML_DEPRECATED |
| 79 | XMLPUBFUN void |
| 80 | xmlDictCleanup (void); |
| 81 | |
| 82 | #ifdef __cplusplus |
| 83 | } |
| 84 | #endif |
| 85 | #endif /* ! __XML_DICT_H__ */ |
| 86 |