Top | ![]() |
![]() |
![]() |
![]() |
void | bt_persistence_collect_hashtable_entries () |
gchar * | bt_persistence_get_value () |
BtPersistence * | bt_persistence_load () |
gboolean | bt_persistence_load_hashtable () |
gint | bt_persistence_parse_enum () |
xmlNodePtr | bt_persistence_save () |
gboolean | bt_persistence_save_hashtable () |
gboolean | bt_persistence_save_list () |
gboolean | bt_persistence_set_value () |
const gchar * | bt_persistence_strfmt_double () |
const gchar * | bt_persistence_strfmt_enum () |
const gchar * | bt_persistence_strfmt_long () |
const gchar * | bt_persistence_strfmt_uchar () |
const gchar * | bt_persistence_strfmt_ulong () |
Classes can implement this interface to store their data as xml and restore them from xml. They should call the interface methods on their children objects (which also implement the interface) to serialize/ deserialize a whole object hierarchy.
void bt_persistence_collect_hashtable_entries (gpointer const key
,gpointer const value
,gpointer const user_data
);
Gather GHashTable entries in a list. Should be used with g_hash_table_foreach()
.
gchar *
bt_persistence_get_value (GValue * const gvalue
);
Returns the string representation of the given gvalue
. Free it when done.
BtPersistence * bt_persistence_load (const GType type
,const BtPersistence * const self
,xmlNodePtr node
,GError **err
,...
);
Deserializes the given object from the node
. If self
is NULL and a type
is
given it constructs a new object.
gboolean bt_persistence_load_hashtable (GHashTable *hashtable
,xmlNodePtr node
);
Iterates over the xml-node and deserializes elements into the hashtable.
gint bt_persistence_parse_enum (GType enum_type
,const gchar *str
);
Convinience methods, that parses a enum value nick and to get the corresponding intger value.
xmlNodePtr bt_persistence_save (const BtPersistence * const self
,xmlNodePtr const parent_node
);
Serializes the given object into node
.
gboolean bt_persistence_save_hashtable (GHashTable *hashtable
,xmlNodePtr const node
);
Iterates over a hashtable with strings and serializes them.
gboolean bt_persistence_save_list (const GList *list
,xmlNodePtr const node
);
Iterates over a list of objects, which must implement the BtPersistence
interface and calls bt_persistence_save()
on each item.
gboolean bt_persistence_set_value (GValue * const gvalue
,const gchar * const svalue
);
Stores the supplied value into the given gvalue
.
const gchar *
bt_persistence_strfmt_double (const gdouble val
);
Convinience methods, that formats a value to be serialized as a string.
const gchar * bt_persistence_strfmt_enum (GType enum_type
,gint value
);
Convinience methods, that formats a value to be serialized as a string.
const gchar *
bt_persistence_strfmt_long (const glong val
);
Convinience methods, that formats a value to be serialized as a string.
const gchar *
bt_persistence_strfmt_uchar (const guchar val
);
Convinience methods, that formats a value to be serialized as a string.
struct BtPersistenceInterface { /* virtual methods */ xmlNodePtr (*save)(const BtPersistence * const self, xmlNodePtr const node); BtPersistence* (*load)(const GType type, const BtPersistence * const self, xmlNodePtr node, GError **err, va_list var_args); };
BtPersistence interface