Top | ![]() |
![]() |
![]() |
![]() |
GXmlEnumerationGXmlEnumeration — Convenient static methods for enumeration serialization to string. |
GXmlEnumeration * | gxml_enumeration_new () |
gchar * | gxml_enumeration_get_nick () |
gchar * | gxml_enumeration_get_nick_camelcase () |
gchar * | gxml_enumeration_get_string () |
GEnumValue * | gxml_enumeration_parse () |
GEnumValue * | gxml_enumeration_to_array () |
GEnumValue * | gxml_enumeration_parse_integer () |
gchar ** | gxml_enumeration_to_string_array () |
gpointer | gxml_enumeration_ref () |
void | gxml_enumeration_unref () |
GParamSpec * | gxml_param_spec_enumeration () |
void | gxml_value_set_enumeration () |
gpointer | gxml_value_get_enumeration () |
void | gxml_value_take_enumeration () |
#define | GXML_TYPE_ENUMERATION |
struct | GXmlEnumeration |
struct | GXmlEnumerationClass |
enum | GXmlEnumerationError |
Enumerations have a set of utility methods to better represent on serialisation/deserialization.
Enumerations could be converted to string using its definition on GEnumClass, by taking its nick name directly or converting to its camel case representation.
Any enumeration value type in a <code>GLib.Object</code>'s property could be deserialized from its definition given on GEnumClass (name and nick) or from its camel case representation.
gchar * gxml_enumeration_get_nick (GType enumeration
,gint val
,GError **error
);
Introspect an enumeration to get value's nick name.
Returns: an string representing an enumeration's value.
gchar * gxml_enumeration_get_nick_camelcase (GType enumeration
,gint val
,GError **error
);
Introspect an enumeration to get value's nick name and transform to camel case representation.
Returns: an string representing an enumeration's value.
gchar * gxml_enumeration_get_string (GType enumeration
,gint val
,gboolean use_nick
,gboolean camelcase
,GError **error
);
Transform enumeration's value to its string representation.
Returns: an string representing an enumeration's value.
enumeration |
. a GType of type . |
[in] |
val |
. an integer to parse an enum value of type . |
[in] |
use_nick |
. makes to returns value's nick name in GEnumClass . |
[in] |
camelcase |
. makes to returns value's nick name in GEnumClass as camel case representation. If . |
[in] |
error |
location to store the error occuring, or |
GEnumValue * gxml_enumeration_parse (GType enumeration
,const gchar *val
,GError **error
);
Parse val
to an enumeration's value.
Returns: an GEnumValue representing an enumeration's value.
GEnumValue * gxml_enumeration_to_array (GType enumeration
,int *result_length1
);
Transform an enumeration in an array of GEnumValue.
Returns: an array of GEnumValue representing an enumeration.
GEnumValue * gxml_enumeration_parse_integer (GType enumeration
,gint val
);
From a integer valuer calculates a valid GEnumValue for a GType.
Returns: a GEnumValue or null if fails.
gchar ** gxml_enumeration_to_string_array (GType enumeration
,int *result_length1
,GError **error
);
Transform an enumeration in an array of strings representing enumeration values.
Returns: an array of strings representing an enumeration.
gpointer
gxml_enumeration_ref (gpointer instance
);
Increases the reference count of object
.
void
gxml_enumeration_unref (gpointer instance
);
Decreases the reference count of object
. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).
GParamSpec * gxml_param_spec_enumeration (const gchar *name
,const gchar *nick
,const gchar *blurb
,GType object_type
,GParamFlags flags
);
Creates a new GParamSpecBoxed instance specifying a GXML_TYPE_ENUMERATION
derived property.
See
for details on property names.g_param_spec_internal()
name |
canonical name of the property specified |
|
nick |
nick name for the property specified |
|
blurb |
description of the property specified |
|
object_type |
GXML_TYPE_ENUMERATION derived type of this property |
|
flags |
flags for the property specified |
void gxml_value_set_enumeration (GValue *value
,gpointer v_object
);
Set the contents of a GXML_TYPE_ENUMERATION
derived GValue to v_object
.
gxml_value_set_enumeration()
increases the reference count of v_object
(the GValue holds a reference to v_object
). If you do not wish to increase the reference count of the object (i.e. you wish to pass your current reference to the GValue because you no longer need it), use gxml_value_take_enumeration()
instead.
It is important that your GValue holds a reference to v_object
(either its own, or one it has taken) to ensure that the object won't be destroyed while the GValue still exists).
value |
a valid GValue of |
|
v_object |
object value to be set |
gpointer
gxml_value_get_enumeration (const GValue *value
);
Get the contents of a GXML_TYPE_ENUMERATION
derived GValue.
void gxml_value_take_enumeration (GValue *value
,gpointer v_object
);
Sets the contents of a GXML_TYPE_ENUMERATION
derived GValue to v_object
and takes over the ownership of the callers reference to v_object
; the caller doesn't have to unref it any more (i.e. the reference count of the object is not increased).
If you want the GValue to hold its own reference to v_object
, use gxml_value_set_enumeration()
instead.
value |
a valid GValue of |
|
v_object |
object value to be set |
#define GXML_TYPE_ENUMERATION (gxml_enumeration_get_type ())
The type for GXmlEnumeration.
struct GXmlEnumeration { GTypeInstance parent_instance; volatile int ref_count; GXmlEnumerationPrivate * priv; };
Convenient static methods for enumeration serialization to string.
Enumerations have a set of utility methods to better represent on serialisation/deserialization.
Enumerations could be converted to string using its definition on GEnumClass, by taking its nick name directly or converting to its camel case representation.
Any enumeration value type in a <code>GLib.Object</code>'s property could be deserialized from its definition given on GEnumClass (name and nick) or from its camel case representation.
struct GXmlEnumerationClass { GTypeClass parent_class; void (*finalize) (GXmlEnumeration *self); };
The class structure for GXML_TYPE_ENUMERATION
. All the fields in this structure are private and should never be accessed directly.