deps/src/libxml2-2.9.1/doc/devhelp/libxml2-hash.html
| | | | | libxml2 Reference Manual |
hash - Chained hash tables
This module implements the hash table support used in various places in the library.
Author(s): Bjorn Reese <[email protected]>
#define[XML\_CAST\_FPTR](#XML_CAST_FPTR)(fptr);
typedef struct _xmlHashTable[xmlHashTable](#xmlHashTable);
typedef[xmlHashTable](libxml2-hash.html#xmlHashTable)*[xmlHashTablePtr](#xmlHashTablePtr);
void[xmlHashScanFull](#xmlHashScanFull)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashScannerFull](libxml2-hash.html#xmlHashScannerFull)f,
void * data);
void[xmlHashScan](#xmlHashScan)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashScanner](libxml2-hash.html#xmlHashScanner)f,
void * data);
typedef void[xmlHashScannerFull](#xmlHashScannerFull)(void * payload,
void * data,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3);[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)[xmlHashCreateDict](#xmlHashCreateDict)(int size,
[xmlDictPtr](libxml2-dict.html#xmlDictPtr)dict);
int[xmlHashAddEntry](#xmlHashAddEntry)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
void * userdata);
int[xmlHashUpdateEntry](#xmlHashUpdateEntry)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
void *[xmlHashQLookup3](#xmlHashQLookup3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix3,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3);
void *[xmlHashQLookup2](#xmlHashQLookup2)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2);
void[xmlHashScan3](#xmlHashScan3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashScanner](libxml2-hash.html#xmlHashScanner)f,
void * data);
typedef void[xmlHashScanner](#xmlHashScanner)(void * payload,
void * data,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name);
typedef void[xmlHashDeallocator](#xmlHashDeallocator)(void * payload,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name);[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)[xmlHashCreate](#xmlHashCreate)(int size);
void[xmlHashFree](#xmlHashFree)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
void *[xmlHashLookup](#xmlHashLookup)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name);
void *[xmlHashQLookup](#xmlHashQLookup)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name);
int[xmlHashUpdateEntry2](#xmlHashUpdateEntry2)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
int[xmlHashRemoveEntry2](#xmlHashRemoveEntry2)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
int[xmlHashRemoveEntry3](#xmlHashRemoveEntry3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)[xmlHashCopy](#xmlHashCopy)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashCopier](libxml2-hash.html#xmlHashCopier)f);
void[xmlHashScanFull3](#xmlHashScanFull3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashScannerFull](libxml2-hash.html#xmlHashScannerFull)f,
void * data);
int[xmlHashUpdateEntry3](#xmlHashUpdateEntry3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
void *[xmlHashLookup3](#xmlHashLookup3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3);
void *[xmlHashLookup2](#xmlHashLookup2)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2);
int[xmlHashRemoveEntry](#xmlHashRemoveEntry)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f);
typedef void *[xmlHashCopier](#xmlHashCopier)(void * payload,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name);
int[xmlHashAddEntry2](#xmlHashAddEntry2)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
void * userdata);
int[xmlHashAddEntry3](#xmlHashAddEntry3)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
void * userdata);
int[xmlHashSize](#xmlHashSize)([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table);
#define[XML\_CAST\_FPTR](#XML_CAST_FPTR)(fptr);
Macro to do a casting from an object pointer to a function pointer without encountering a warning from gcc #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) This macro violated ISO C aliasing rules (gcc4 on s390 broke) so it is disabled now
| fptr: | pointer to a function |
struct _xmlHashTable {
The content of this structure is not made public by the API.
} xmlHashTable;
[xmlHashTable](libxml2-hash.html#xmlHashTable)* xmlHashTablePtr;
void * xmlHashCopier (void * payload,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name)
Callback to copy data from a hash.
| payload: | the data in the hash | | name: | the name associated | | Returns: | a copy of the data or NULL in case of error. |
void xmlHashDeallocator (void * payload,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name)
Callback to free data from a hash.
| payload: | the data in the hash | | name: | the name associated |
void xmlHashScanner (void * payload,
void * data,
[xmlChar](libxml2-xmlstring.html#xmlChar)* name)
Callback when scanning data in a hash with the simple scanner.
| payload: | the data in the hash | | data: | extra scannner data | | name: | the name associated |
void xmlHashScannerFull (void * payload,
void * data,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3)
Callback when scanning data in a hash with the full scanner.
| payload: | the data in the hash | | data: | extra scannner data | | name: | the name associated | | name2: | the second name associated | | name3: | the third name associated |
int xmlHashAddEntry ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the @name. Duplicate names generate errors.
| table: | the hash table | | name: | the name of the userdata | | userdata: | a pointer to the userdata | | Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashAddEntry2 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the (@name, @name2) tuple. Duplicate tuples generate errors.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | userdata: | a pointer to the userdata | | Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashAddEntry3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
void * userdata)
Add the @userdata to the hash @table. This can later be retrieved by using the tuple (@name, @name2, @name3). Duplicate entries generate errors.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | name3: | a third name of the userdata | | userdata: | a pointer to the userdata | | Returns: | 0 the addition succeeded and -1 in case of error. |
[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)xmlHashCopy ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashCopier](libxml2-hash.html#xmlHashCopier)f)
Scan the hash @table and applied @f to each value.
| table: | the hash table | | f: | the copier function for items in the hash | | Returns: | the new table or NULL in case of error. |
[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)xmlHashCreate (int size)
Create a new xmlHashTablePtr.
| size: | the size of the hash table | | Returns: | the newly created object, or NULL if an error occured. |
[xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)xmlHashCreateDict (int size,
[xmlDictPtr](libxml2-dict.html#xmlDictPtr)dict)
Create a new xmlHashTablePtr which will use @dict as the internal dictionary
| size: | the size of the hash table | | dict: | a dictionary to use for the hash | | Returns: | the newly created object, or NULL if an error occured. |
void xmlHashFree ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Free the hash @table and its contents. The userdata is deallocated with @f if provided.
| table: | the hash table | | f: | the deallocator function for items in the hash |
void * xmlHashLookup ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name)
Find the userdata specified by the @name.
| table: | the hash table | | name: | the name of the userdata | | Returns: | the pointer to the userdata |
void * xmlHashLookup2 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2)
Find the userdata specified by the (@name, @name2) tuple.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | Returns: | the pointer to the userdata |
void * xmlHashLookup3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3)
Find the userdata specified by the (@name, @name2, @name3) tuple.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | name3: | a third name of the userdata | | Returns: | the a pointer to the userdata |
void * xmlHashQLookup ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name)
Find the userdata specified by the QName @prefix:@name/@name.
| table: | the hash table | | prefix: | the prefix of the userdata | | name: | the name of the userdata | | Returns: | the pointer to the userdata |
void * xmlHashQLookup2 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2)
Find the userdata specified by the QNames tuple
| table: | the hash table | | prefix: | the prefix of the userdata | | name: | the name of the userdata | | prefix2: | the second prefix of the userdata | | name2: | a second name of the userdata | | Returns: | the pointer to the userdata |
void * xmlHashQLookup3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* prefix3,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3)
Find the userdata specified by the (@name, @name2, @name3) tuple.
| table: | the hash table | | prefix: | the prefix of the userdata | | name: | the name of the userdata | | prefix2: | the second prefix of the userdata | | name2: | a second name of the userdata | | prefix3: | the third prefix of the userdata | | name3: | a third name of the userdata | | Returns: | the a pointer to the userdata |
int xmlHashRemoveEntry ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Find the userdata specified by the @name and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table | | name: | the name of the userdata | | f: | the deallocator function for removed item (if any) | | Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
int xmlHashRemoveEntry2 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Find the userdata specified by the (@name, @name2) tuple and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | f: | the deallocator function for removed item (if any) | | Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
int xmlHashRemoveEntry3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Find the userdata specified by the (@name, @name2, @name3) tuple and remove it from the hash @table. Existing userdata for this tuple will be removed and freed with @f.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | name3: | a third name of the userdata | | f: | the deallocator function for removed item (if any) | | Returns: | 0 if the removal succeeded and -1 in case of error or not found. |
void xmlHashScan ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashScanner](libxml2-hash.html#xmlHashScanner)f,
void * data)
Scan the hash @table and applied @f to each value.
| table: | the hash table | | f: | the scanner function for items in the hash | | data: | extra data passed to f |
void xmlHashScan3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashScanner](libxml2-hash.html#xmlHashScanner)f,
void * data)
Scan the hash @table and applied @f to each value matching (@name, @name2, @name3) tuple. If one of the names is null, the comparison is considered to match.
| table: | the hash table | | name: | the name of the userdata or NULL | | name2: | a second name of the userdata or NULL | | name3: | a third name of the userdata or NULL | | f: | the scanner function for items in the hash | | data: | extra data passed to f |
void xmlHashScanFull ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
[xmlHashScannerFull](libxml2-hash.html#xmlHashScannerFull)f,
void * data)
Scan the hash @table and applied @f to each value.
| table: | the hash table | | f: | the scanner function for items in the hash | | data: | extra data passed to f |
void xmlHashScanFull3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
[xmlHashScannerFull](libxml2-hash.html#xmlHashScannerFull)f,
void * data)
Scan the hash @table and applied @f to each value matching (@name, @name2, @name3) tuple. If one of the names is null, the comparison is considered to match.
| table: | the hash table | | name: | the name of the userdata or NULL | | name2: | a second name of the userdata or NULL | | name3: | a third name of the userdata or NULL | | f: | the scanner function for items in the hash | | data: | extra data passed to f |
int xmlHashSize ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table)
Query the number of elements installed in the hash @table.
| table: | the hash table | | Returns: | the number of elements in the hash table or -1 in case of error |
int xmlHashUpdateEntry ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Add the @userdata to the hash @table. This can later be retrieved by using the @name. Existing entry for this @name will be removed and freed with @f if found.
| table: | the hash table | | name: | the name of the userdata | | userdata: | a pointer to the userdata | | f: | the deallocator function for replaced item (if any) | | Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashUpdateEntry2 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Add the @userdata to the hash @table. This can later be retrieved by using the (@name, @name2) tuple. Existing entry for this tuple will be removed and freed with @f if found.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | userdata: | a pointer to the userdata | | f: | the deallocator function for replaced item (if any) | | Returns: | 0 the addition succeeded and -1 in case of error. |
int xmlHashUpdateEntry3 ([xmlHashTablePtr](libxml2-hash.html#xmlHashTablePtr)table,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name2,
const[xmlChar](libxml2-xmlstring.html#xmlChar)* name3,
void * userdata,
[xmlHashDeallocator](libxml2-hash.html#xmlHashDeallocator)f)
Add the @userdata to the hash @table. This can later be retrieved by using the tuple (@name, @name2, @name3). Existing entry for this tuple will be removed and freed with @f if found.
| table: | the hash table | | name: | the name of the userdata | | name2: | a second name of the userdata | | name3: | a third name of the userdata | | userdata: | a pointer to the userdata | | f: | the deallocator function for replaced item (if any) | | Returns: | 0 the addition succeeded and -1 in case of error. |