| Evolution-Data-Server Manual: Utilities (libedataserver) | ||||
|---|---|---|---|---|
enum EXmlHashType;GHashTable * e_xml_to_hash (xmlDoc *doc, EXmlHashType type);xmlDoc * e_xml_from_hash (GHashTable *hash, EXmlHashType type, constgchar *root_node);void e_xml_destroy_hash (GHashTable *hash); enum EXmlHashStatus;void (*EXmlHashFunc) (constgchar *key, constgchar *value,gpointer user_data);gboolean (*EXmlHashRemoveFunc) (constgchar *key, constgchar *value,gpointer user_data); typedef EXmlHash; EXmlHash * e_xmlhash_new (constgchar *filename);void e_xmlhash_add (EXmlHash *hash, constgchar *key, constgchar *data);void e_xmlhash_remove (EXmlHash *hash, constgchar *key); EXmlHashStatus e_xmlhash_compare (EXmlHash *hash, constgchar *key, constgchar *compare_data);void e_xmlhash_foreach_key (EXmlHash *hash, EXmlHashFunc func,gpointer user_data);void e_xmlhash_foreach_key_remove (EXmlHash *hash, EXmlHashRemoveFunc func,gpointer user_data);void e_xmlhash_write (EXmlHash *hash);void e_xmlhash_destroy (EXmlHash *hash);
typedef enum {
E_XML_HASH_TYPE_OBJECT_UID,
E_XML_HASH_TYPE_PROPERTY
} EXmlHashType;
GHashTable * e_xml_to_hash (xmlDoc *doc, EXmlHashType type);
Creates a doc.
If type is * E_XML_HASH_TYPE_PROPERTY, all XML nodes will be
indexed in the type is
E_XML_HASH_TYPE_OBJECT_UID, then XML objects will be indexed in
the hash by their UID (other nodes will still be indexed by name).
|
The |
|
The value type to use as a key in the hash table. |
Returns : |
The newly-created doc.
|
xmlDoc * e_xml_from_hash (GHashTable *hash, EXmlHashType type, constgchar *root_node);
Uses the key/value pair representation of an XML structure in hash
to build an equivalent e_xml_to_hash().
|
The |
|
The EXmlHashType used to store the XML. |
|
|
Returns : |
The hash.
|
void e_xml_destroy_hash (GHashTable *hash);
Frees the memory used by hash and its contents.
|
The |
typedef enum {
E_XMLHASH_STATUS_SAME,
E_XMLHASH_STATUS_DIFFERENT,
E_XMLHASH_STATUS_NOT_FOUND
} EXmlHashStatus;
void (*EXmlHashFunc) (constgchar *key, constgchar *value,gpointer user_data);
|
|
|
|
|
gboolean (*EXmlHashRemoveFunc) (constgchar *key, constgchar *value,gpointer user_data);
|
|
|
|
|
|
Returns : |
EXmlHash * e_xmlhash_new (constgchar *filename);
Creates a new EXmlHash from the file filename. If filename does
not already exist, an empty EXmlHash will be created.
|
The name of an XML file. |
Returns : |
The new EXmlHash structure, or NULLfilename.
|
void e_xmlhash_add (EXmlHash *hash, constgchar *key, constgchar *data);
Adds a new key/value pair to the EXmlHash hash.
|
The EXmlHash to add an entry to. |
|
The key to use for the entry. |
|
The value of the new entry. |
void e_xmlhash_remove (EXmlHash *hash, constgchar *key);
Remove the entry in hash with key equal to key, if it exists.
|
The EXmlHash to remove an entry from. |
|
The key of the entry to remove. |
EXmlHashStatus e_xmlhash_compare (EXmlHash *hash, constgchar *key, constgchar *compare_data);
Compares the value with key equal to key in hash against
compare_data.
|
The EXmlHash to compare against. |
|
The key of the hash entry to compare with. |
|
The data to compare against the hash entry. |
Returns : |
E_XMLHASH_STATUS_SAME if the value and compare_data are
equal,E_XMLHASH_STATUS_DIFFERENT if they are different, or
E_XMLHASH_STATUS_NOT_FOUND if there is no entry in hash with
its key equal to key.
|
void e_xmlhash_foreach_key (EXmlHash *hash, EXmlHashFunc func,gpointer user_data);
Executes func against each key/value pair in hash.
|
An EXmlHash. |
|
The EXmlHashFunc to execute on the data in hash.
|
|
The data to pass to func.
|
void e_xmlhash_foreach_key_remove (EXmlHash *hash, EXmlHashRemoveFunc func,gpointer user_data);
|
|
|
|
|
void e_xmlhash_write (EXmlHash *hash);
Writes the XML represented by hash to the file originally passed
to e_xmlhash_new().
|
The EXmlHash to write. |