GIO Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <gio/gio.h> gchar * g_dbus_generate_guid (void
); gboolean g_dbus_is_guid (const gchar *string
); gboolean g_dbus_is_name (const gchar *string
); gboolean g_dbus_is_unique_name (const gchar *string
); gboolean g_dbus_is_member_name (const gchar *string
); gboolean g_dbus_is_interface_name (const gchar *string
); GVariant * g_dbus_gvalue_to_gvariant (const GValue *gvalue
,const GVariantType *type
); void g_dbus_gvariant_to_gvalue (GVariant *value
,GValue *out_gvalue
);
gchar * g_dbus_generate_guid (void
);
Generate a D-Bus GUID that can be used with
e.g. g_dbus_connection_new()
.
See the D-Bus specification regarding what strings are valid D-Bus GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
Returns : |
A valid D-Bus GUID. Free with g_free() . |
Since 2.26
gboolean g_dbus_is_guid (const gchar *string
);
Checks if string
is a D-Bus GUID.
See the D-Bus specification regarding what strings are valid D-Bus GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
Since 2.26
gboolean g_dbus_is_name (const gchar *string
);
Checks if string
is a valid D-Bus bus name (either unique or well-known).
Since 2.26
gboolean g_dbus_is_unique_name (const gchar *string
);
Checks if string
is a valid D-Bus unique bus name.
Since 2.26
gboolean g_dbus_is_member_name (const gchar *string
);
Checks if string
is a valid D-Bus member (e.g. signal or method) name.
Since 2.26
gboolean g_dbus_is_interface_name (const gchar *string
);
Checks if string
is a valid D-Bus interface name.
Since 2.26
GVariant * g_dbus_gvalue_to_gvariant (const GValue *gvalue
,const GVariantType *type
);
Converts a GValue to a GVariant of the type indicated by the type
parameter.
The conversion is using the following rules:
Table 4. GValue / GVariant conversion rules
If the GType for gvalue is... |
... then type must be |
---|---|
G_TYPE_STRING | 's', 'o', 'g' or 'ay' |
G_TYPE_STRV | 'as', 'ao' or 'aay' |
G_TYPE_BOOLEAN | 'b' |
G_TYPE_UCHAR | 'y' |
G_TYPE_INT | 'i' or 'n' |
G_TYPE_UINT | 'u' or 'q' |
G_TYPE_INT64 | 'x' |
G_TYPE_UINT64 | 't' |
G_TYPE_DOUBLE | 'd' |
G_TYPE_VARIANT | Any GVariantType |
This can fail if e.g. gvalue
is of type G_TYPE_STRING and type
is 'i'. It will
also fail for any GType (including e.g. G_TYPE_OBJECT and
G_TYPE_BOXED derived-types) not in the table above.
Note that if gvalue
is of type G_TYPE_VARIANT and its value is
NULL
, the empty GVariant instance (never
NULL
) for type
is returned (e.g. 0 for scalar types, the empty
string for string types, '/'
for object path
types, the empty array for any array type and so on).
See the g_dbus_gvariant_to_gvalue()
function for how to convert a
GVariant to a GValue.
|
A GValue to convert to a GVariant. |
|
A GVariantType. |
Returns : |
A GVariant (never floating) of GVariantType
type holding the data from gvalue or NULL in case of
failure. Free with g_variant_unref() . |
Since 2.30
void g_dbus_gvariant_to_gvalue (GVariant *value
,GValue *out_gvalue
);
Converts a GVariant to a GValue. If value
is floating, it is consumed.
The rules specified in the g_dbus_gvalue_to_gvariant()
function are
used - this function is essentially its reverse form.
The conversion never fails - a valid GValue is always returned in
out_gvalue
.
|
A GVariant. |
|
Return location pointing to a zero-filled (uninitialized) GValue. [out] |
Since 2.30