dict

dict - string dictionary

dictionary of reusable strings, just used to avoid allocation and freeing operations.

Author(s): Daniel Veillard

Synopsis

typedef struct _xmlDict xmlDict;
typedef xmlDict * xmlDictPtr;
void	xmlDictCleanup			(void);
xmlDictPtr	xmlDictCreate		(void);
xmlDictPtr	xmlDictCreateSub	(xmlDictPtr sub);
const xmlChar *	xmlDictExists		(xmlDictPtr dict, 
const xmlChar * name,
int len); void xmlDictFree (xmlDictPtr dict); size_t xmlDictGetUsage (xmlDictPtr dict); const xmlChar * xmlDictLookup (xmlDictPtr dict,
const xmlChar * name,
int len); int xmlDictOwns (xmlDictPtr dict,
const xmlChar * str); const xmlChar * xmlDictQLookup (xmlDictPtr dict,
const xmlChar * prefix,
const xmlChar * name); int xmlDictReference (xmlDictPtr dict); size_t xmlDictSetLimit (xmlDictPtr dict,
size_t limit); int xmlDictSize (xmlDictPtr dict); int xmlInitializeDict (void);

Description

Details

Structure xmlDict

struct _xmlDict {
The content of this structure is not made public by the API.
} xmlDict;


Typedef xmlDictPtr

xmlDict * xmlDictPtr;


xmlDictCleanup ()

void	xmlDictCleanup			(void)

DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all.


xmlDictCreate ()

xmlDictPtr	xmlDictCreate		(void)

Create a new dictionary

Returns: the newly created dictionary, or NULL if an error occurred.

xmlDictCreateSub ()

xmlDictPtr	xmlDictCreateSub	(xmlDictPtr sub)

Create a new dictionary, inheriting strings from the read-only dictionary @sub. On lookup, strings are first searched in the new dictionary, then in @sub, and if not found are created in the new dictionary.

sub: an existing dictionary
Returns: the newly created dictionary, or NULL if an error occurred.

xmlDictExists ()

const xmlChar *	xmlDictExists		(xmlDictPtr dict, 
const xmlChar * name,
int len)

Check if a string exists in the dictionary.

dict: the dictionary
name: the name of the userdata
len: the length of the name, if -1 it is recomputed
Returns: the internal copy of the name or NULL if not found.

xmlDictFree ()

void	xmlDictFree			(xmlDictPtr dict)

Free the hash @dict and its contents. The userdata is deallocated with @f if provided.

dict: the dictionary

xmlDictGetUsage ()

size_t	xmlDictGetUsage			(xmlDictPtr dict)

Get how much memory is used by a dictionary for strings Added in 2.9.0

dict: the dictionary
Returns: the amount of strings allocated

xmlDictLookup ()

const xmlChar *	xmlDictLookup		(xmlDictPtr dict, 
const xmlChar * name,
int len)

Lookup a string and add it to the dictionary if it wasn't found.

dict: dictionary
name: string key
len: length of the key, if -1 it is recomputed
Returns: the interned copy of the string or NULL if a memory allocation failed.

xmlDictOwns ()

int	xmlDictOwns			(xmlDictPtr dict, 
const xmlChar * str)

check if a string is owned by the dictionary

dict: the dictionary
str: the string
Returns: 1 if true, 0 if false and -1 in case of error -1 in case of error

xmlDictQLookup ()

const xmlChar *	xmlDictQLookup		(xmlDictPtr dict, 
const xmlChar * prefix,
const xmlChar * name)

Lookup the QName @prefix:@name and add it to the dictionary if it wasn't found.

dict: the dictionary
prefix: the prefix
name: the name
Returns: the interned copy of the string or NULL if a memory allocation failed.

xmlDictReference ()

int	xmlDictReference		(xmlDictPtr dict)

Increment the reference counter of a dictionary

dict: the dictionary
Returns: 0 in case of success and -1 in case of error

xmlDictSetLimit ()

size_t	xmlDictSetLimit			(xmlDictPtr dict, 
size_t limit)

Set a size limit for the dictionary Added in 2.9.0

dict: the dictionary
limit: the limit in bytes
Returns: the previous limit of the dictionary or 0

xmlDictSize ()

int	xmlDictSize			(xmlDictPtr dict)

Query the number of elements installed in the hash @dict.

dict: the dictionary
Returns: the number of elements in the dictionary or -1 in case of error

xmlInitializeDict ()

int	xmlInitializeDict		(void)

DEPRECATED: Alias for xmlInitParser.

Returns: 0.