Path: blob/master/venv/Lib/site-packages/lxml/includes/libxml/hash.h
811 views
/*1* Summary: Chained hash tables2* Description: This module implements the hash table support used in3* various places in the library.4*5* Copy: See Copyright for the status of this software.6*7* Author: Bjorn Reese <[email protected]>8*/910#ifndef __XML_HASH_H__11#define __XML_HASH_H__1213#ifdef __cplusplus14extern "C" {15#endif1617/*18* The hash table.19*/20typedef struct _xmlHashTable xmlHashTable;21typedef xmlHashTable *xmlHashTablePtr;2223#ifdef __cplusplus24}25#endif2627#include <libxml/xmlversion.h>28#include <libxml/parser.h>29#include <libxml/dict.h>3031#ifdef __cplusplus32extern "C" {33#endif3435/*36* Recent version of gcc produce a warning when a function pointer is assigned37* to an object pointer, or vice versa. The following macro is a dirty hack38* to allow suppression of the warning. If your architecture has function39* pointers which are a different size than a void pointer, there may be some40* serious trouble within the library.41*/42/**43* XML_CAST_FPTR:44* @fptr: pointer to a function45*46* Macro to do a casting from an object pointer to a47* function pointer without encountering a warning from48* gcc49*50* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))51* This macro violated ISO C aliasing rules (gcc4 on s390 broke)52* so it is disabled now53*/5455#define XML_CAST_FPTR(fptr) fptr565758/*59* function types:60*/61/**62* xmlHashDeallocator:63* @payload: the data in the hash64* @name: the name associated65*66* Callback to free data from a hash.67*/68typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);69/**70* xmlHashCopier:71* @payload: the data in the hash72* @name: the name associated73*74* Callback to copy data from a hash.75*76* Returns a copy of the data or NULL in case of error.77*/78typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);79/**80* xmlHashScanner:81* @payload: the data in the hash82* @data: extra scannner data83* @name: the name associated84*85* Callback when scanning data in a hash with the simple scanner.86*/87typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);88/**89* xmlHashScannerFull:90* @payload: the data in the hash91* @data: extra scannner data92* @name: the name associated93* @name2: the second name associated94* @name3: the third name associated95*96* Callback when scanning data in a hash with the full scanner.97*/98typedef void (*xmlHashScannerFull)(void *payload, void *data,99const xmlChar *name, const xmlChar *name2,100const xmlChar *name3);101102/*103* Constructor and destructor.104*/105XMLPUBFUN xmlHashTablePtr XMLCALL106xmlHashCreate (int size);107XMLPUBFUN xmlHashTablePtr XMLCALL108xmlHashCreateDict(int size,109xmlDictPtr dict);110XMLPUBFUN void XMLCALL111xmlHashFree (xmlHashTablePtr table,112xmlHashDeallocator f);113114/*115* Add a new entry to the hash table.116*/117XMLPUBFUN int XMLCALL118xmlHashAddEntry (xmlHashTablePtr table,119const xmlChar *name,120void *userdata);121XMLPUBFUN int XMLCALL122xmlHashUpdateEntry(xmlHashTablePtr table,123const xmlChar *name,124void *userdata,125xmlHashDeallocator f);126XMLPUBFUN int XMLCALL127xmlHashAddEntry2(xmlHashTablePtr table,128const xmlChar *name,129const xmlChar *name2,130void *userdata);131XMLPUBFUN int XMLCALL132xmlHashUpdateEntry2(xmlHashTablePtr table,133const xmlChar *name,134const xmlChar *name2,135void *userdata,136xmlHashDeallocator f);137XMLPUBFUN int XMLCALL138xmlHashAddEntry3(xmlHashTablePtr table,139const xmlChar *name,140const xmlChar *name2,141const xmlChar *name3,142void *userdata);143XMLPUBFUN int XMLCALL144xmlHashUpdateEntry3(xmlHashTablePtr table,145const xmlChar *name,146const xmlChar *name2,147const xmlChar *name3,148void *userdata,149xmlHashDeallocator f);150151/*152* Remove an entry from the hash table.153*/154XMLPUBFUN int XMLCALL155xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,156xmlHashDeallocator f);157XMLPUBFUN int XMLCALL158xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,159const xmlChar *name2, xmlHashDeallocator f);160XMLPUBFUN int XMLCALL161xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,162const xmlChar *name2, const xmlChar *name3,163xmlHashDeallocator f);164165/*166* Retrieve the userdata.167*/168XMLPUBFUN void * XMLCALL169xmlHashLookup (xmlHashTablePtr table,170const xmlChar *name);171XMLPUBFUN void * XMLCALL172xmlHashLookup2 (xmlHashTablePtr table,173const xmlChar *name,174const xmlChar *name2);175XMLPUBFUN void * XMLCALL176xmlHashLookup3 (xmlHashTablePtr table,177const xmlChar *name,178const xmlChar *name2,179const xmlChar *name3);180XMLPUBFUN void * XMLCALL181xmlHashQLookup (xmlHashTablePtr table,182const xmlChar *name,183const xmlChar *prefix);184XMLPUBFUN void * XMLCALL185xmlHashQLookup2 (xmlHashTablePtr table,186const xmlChar *name,187const xmlChar *prefix,188const xmlChar *name2,189const xmlChar *prefix2);190XMLPUBFUN void * XMLCALL191xmlHashQLookup3 (xmlHashTablePtr table,192const xmlChar *name,193const xmlChar *prefix,194const xmlChar *name2,195const xmlChar *prefix2,196const xmlChar *name3,197const xmlChar *prefix3);198199/*200* Helpers.201*/202XMLPUBFUN xmlHashTablePtr XMLCALL203xmlHashCopy (xmlHashTablePtr table,204xmlHashCopier f);205XMLPUBFUN int XMLCALL206xmlHashSize (xmlHashTablePtr table);207XMLPUBFUN void XMLCALL208xmlHashScan (xmlHashTablePtr table,209xmlHashScanner f,210void *data);211XMLPUBFUN void XMLCALL212xmlHashScan3 (xmlHashTablePtr table,213const xmlChar *name,214const xmlChar *name2,215const xmlChar *name3,216xmlHashScanner f,217void *data);218XMLPUBFUN void XMLCALL219xmlHashScanFull (xmlHashTablePtr table,220xmlHashScannerFull f,221void *data);222XMLPUBFUN void XMLCALL223xmlHashScanFull3(xmlHashTablePtr table,224const xmlChar *name,225const xmlChar *name2,226const xmlChar *name3,227xmlHashScannerFull f,228void *data);229#ifdef __cplusplus230}231#endif232#endif /* ! __XML_HASH_H__ */233234235