libinstpatch Reference Manual | ||||
---|---|---|---|---|
Top | Description |
gboolean (*IpatchXmlEncodeFunc) (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean (*IpatchXmlDecodeFunc) (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); void ipatch_xml_register_handler (GType type
,const char *prop_name
,IpatchXmlEncodeFunc encode_func
,IpatchXmlDecodeFunc decode_func
); gboolean ipatch_xml_lookup_handler (GType type
,GParamSpec *pspec
,IpatchXmlEncodeFunc *encode_func
,IpatchXmlDecodeFunc *decode_func
); gboolean ipatch_xml_lookup_handler_by_prop_name (GType type
,const char *prop_name
,IpatchXmlEncodeFunc *encode_func
,IpatchXmlDecodeFunc *decode_func
); gboolean ipatch_xml_encode_object (GNode *node
,GObject *object
,gboolean create_element
,GError **err
); gboolean ipatch_xml_encode_property (GNode *node
,GObject *object
,GParamSpec *pspec
,gboolean create_element
,GError **err
); gboolean ipatch_xml_encode_property_by_name (GNode *node
,GObject *object
,const char *propname
,gboolean create_element
,GError **err
); gboolean ipatch_xml_encode_value (GNode *node
,GValue *value
,GError **err
); gboolean ipatch_xml_decode_object (GNode *node
,GObject *object
,GError **err
); gboolean ipatch_xml_decode_property (GNode *node
,GObject *object
,GParamSpec *pspec
,GError **err
); gboolean ipatch_xml_decode_property_by_name (GNode *node
,GObject *object
,const char *propname
,GError **err
); gboolean ipatch_xml_decode_value (GNode *node
,GValue *value
,GError **err
); gboolean ipatch_xml_default_encode_object_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean ipatch_xml_default_encode_property_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean ipatch_xml_default_encode_value_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean ipatch_xml_default_decode_object_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean ipatch_xml_default_decode_property_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
); gboolean ipatch_xml_default_decode_value_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Functions for saving/loading GObject, GValue and GObject properties to/from XML trees. Includes a system for registering custom encoding and decoding handlers for objects, properties and value types.
gboolean (*IpatchXmlEncodeFunc) (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Function type for encoding objects, properties or GValue types to XML trees. Forms the basis of serializing GObject and GValues to XML. The caller handles creating an XML node element to contain the given object, property or value XML encoding.
|
XML node to encode XML to |
|
Object being encoded (object and property encoders) |
|
Spec of property being encoded (property encoders only) |
|
Value to encode (property and GValue encoders only) |
|
Location to store error value (or NULL if ignoring)
|
Returns : |
Should return TRUE on success and FALSE on error (in which
case err should be set).
|
gboolean (*IpatchXmlDecodeFunc) (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Function type for decoding objects, properties or GValue types from XML trees to
their original instance values in memory. For object decoders, only object
will be set and the decoded XML content should be assigned to the object;
for property decoders object
, pspec
and value
will be set, value
is
initialized to the property value type and the decoded value should be
assigned to it; for GValue decoders, only the value
will be initialized
which the decoded value should be assigned to.
|
XML node to be decoded |
|
Object being decoded to (object and property decoders, NULL otherwise)
|
|
Spec of property being decoded (property decoders only, NULL otherwise)
|
|
Value to decode to (property and GValue decoders only, NULL otherwise)
|
|
Location to store error value (or NULL if ignoring)
|
Returns : |
Should return TRUE on success, FALSE otherwise (in which case err
should be set)
|
void ipatch_xml_register_handler (GType type
,const char *prop_name
,IpatchXmlEncodeFunc encode_func
,IpatchXmlDecodeFunc decode_func
);
Registers XML encoding/decoding handlers for a GObject type, GObject property or GValue type.
|
GType to register handler functions for (GObject type if an object or object property handler, GValue type for value handlers). |
|
GObject property name (or NULL if not a GObject property handler)
|
|
Function to handle encoding (object/property/value -> XML) |
|
Function to handle decoding (XML -> object/property/value) |
gboolean ipatch_xml_lookup_handler (GType type
,GParamSpec *pspec
,IpatchXmlEncodeFunc *encode_func
,IpatchXmlDecodeFunc *decode_func
);
Looks up handlers for a given GObject type, GObject property or GValue
type previously registered with ipatch_xml_register_handler()
.
These functions are used for encoding/decoding to/from XML.
gboolean ipatch_xml_lookup_handler_by_prop_name (GType type
,const char *prop_name
,IpatchXmlEncodeFunc *encode_func
,IpatchXmlDecodeFunc *decode_func
);
Like ipatch_xml_lookup_handler()
but takes a prop_name
string to indicate which
GObject property to lookup instead of a GParamSpec.
gboolean ipatch_xml_encode_object (GNode *node
,GObject *object
,gboolean create_element
,GError **err
);
Encodes an object to XML.
gboolean ipatch_xml_encode_property (GNode *node
,GObject *object
,GParamSpec *pspec
,gboolean create_element
,GError **err
);
Encode an object property to an XML node.
|
XML node to encode to |
|
GObject to encode property of |
|
Parameter specification of property to encode |
|
TRUE to create a <prop name="PROPNAME"> element, FALSE to
assign object property value to node
|
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE otherwise
|
gboolean ipatch_xml_encode_property_by_name (GNode *node
,GObject *object
,const char *propname
,gboolean create_element
,GError **err
);
Encode an object property by name to an XML node.
|
XML node to encode to |
|
GObject to encode property of |
|
Name of object property to encode |
|
TRUE to create a <prop name="PROPNAME"> element, FALSE to
assign object property value to node
|
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE otherwise
|
gboolean ipatch_xml_encode_value (GNode *node
,GValue *value
,GError **err
);
Encodes a GValue to an XML node text value.
|
XML node to encode to |
|
Value to encode |
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE on error (err may be set)
|
gboolean ipatch_xml_decode_object (GNode *node
,GObject *object
,GError **err
);
Decodes XML to an object. The default GObject decoder will only decode those properties which don't have the IPATCH_PARAM_NO_SAVE flag set.
gboolean ipatch_xml_decode_property (GNode *node
,GObject *object
,GParamSpec *pspec
,GError **err
);
Decode an object property from an XML node value to an object. Note that the property is NOT checked for the IPATCH_PARAM_NO_SAVE flag.
gboolean ipatch_xml_decode_property_by_name (GNode *node
,GObject *object
,const char *propname
,GError **err
);
Decode an object property from an XML node value to an object by property name. Note that the property is NOT checked for the IPATCH_PARAM_NO_SAVE flag.
gboolean ipatch_xml_decode_value (GNode *node
,GValue *value
,GError **err
);
Decodes a GValue from an XML node text value.
|
XML node to decode from |
|
Value to decode to |
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE on error (err may be set)
|
gboolean ipatch_xml_default_encode_object_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Default GObject encode handler. Useful for custom handlers to chain to the default if needed.
gboolean ipatch_xml_default_encode_property_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Default GObject property encode handler. Useful for custom handlers to chain to the default if needed.
|
XML node to encode XML to |
|
Object to encode |
|
Parameter spec of property to encode |
|
Value of the property |
|
Location to store error value (or NULL if ignoring)
|
Returns : |
TRUE on success, FALSE on error (err may be set)
|
gboolean ipatch_xml_default_encode_value_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Default GValue encode handler. Useful for custom handlers to chain to the default if needed.
gboolean ipatch_xml_default_decode_object_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Default GObject decode handler. Useful for custom handlers to chain to the default if needed.
gboolean ipatch_xml_default_decode_property_func (GNode *node
,GObject *object
,GParamSpec *pspec
,GValue *value
,GError **err
);
Default GObject property decode handler. Useful for custom handlers to chain to the default if needed.
|
XML node to decode XML from |
|
Object whose property is being decoded |
|
Parameter spec of property to decode |
|
Initialized value to decode to |
|
Location to store error value (or NULL if ignoring)
|
Returns : |
TRUE on success, FALSE on error (err may be set)
|