mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 04:05:11 +01:00
Merge branch '896-variant-type-docs' into 'master'
Documentation and typing improvements for GVariant bytes Closes #896 See merge request GNOME/glib!117
This commit is contained in:
commit
df28cfe0b5
@ -563,7 +563,10 @@
|
|||||||
<title>Bytestrings</title>
|
<title>Bytestrings</title>
|
||||||
<para>
|
<para>
|
||||||
The bytestring syntax is a piece of syntactic sugar meant to complement the bytestring APIs in GVariant. It
|
The bytestring syntax is a piece of syntactic sugar meant to complement the bytestring APIs in GVariant. It
|
||||||
constructs arrays of non-nul bytes (type '<literal>ay</literal>') with a nul terminator at the end.
|
constructs arrays of non-nul bytes (type '<literal>ay</literal>') with a nul terminator at the end. These are
|
||||||
|
normal C strings with no particular encoding enforced, so the bytes may not be valid UTF-8.
|
||||||
|
Bytestrings are a special case of byte arrays; byte arrays (also type '<literal>ay</literal>'), in the general
|
||||||
|
case, can contain nul at any position, and need not end with nul.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Bytestrings are specified with either <literal>b""</literal> or <literal>b''</literal>. As with strings,
|
Bytestrings are specified with either <literal>b""</literal> or <literal>b''</literal>. As with strings,
|
||||||
|
@ -984,7 +984,7 @@ data = g_variant_new_parsed ("(%o, {'brightness': {'value': <%i>, 'max': <%i>}})
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The '<literal>^</literal>' character currently supports conversion to and from bytestrings or to and from arrays
|
The '<literal>^</literal>' character currently supports conversion to and from bytestrings or to and from arrays
|
||||||
of strings or bytestrings. It has a number of forms.
|
of strings or bytestrings. It does not support byte arrays. It has a number of forms.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -403,11 +403,11 @@ g_variant_get_boolean (GVariant *value)
|
|||||||
* It is an error to call this function with a @value of any type
|
* It is an error to call this function with a @value of any type
|
||||||
* other than %G_VARIANT_TYPE_BYTE.
|
* other than %G_VARIANT_TYPE_BYTE.
|
||||||
*
|
*
|
||||||
* Returns: a #guchar
|
* Returns: a #guint8
|
||||||
*
|
*
|
||||||
* Since: 2.24
|
* Since: 2.24
|
||||||
**/
|
**/
|
||||||
NUMERIC_TYPE (BYTE, byte, guchar)
|
NUMERIC_TYPE (BYTE, byte, guint8)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_variant_new_int16:
|
* g_variant_new_int16:
|
||||||
@ -1105,7 +1105,7 @@ g_variant_lookup_value (GVariant *dictionary,
|
|||||||
* the appropriate type:
|
* the appropriate type:
|
||||||
* - %G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.)
|
* - %G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.)
|
||||||
* - %G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!)
|
* - %G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!)
|
||||||
* - %G_VARIANT_TYPE_BYTE: #guchar
|
* - %G_VARIANT_TYPE_BYTE: #guint8
|
||||||
* - %G_VARIANT_TYPE_HANDLE: #guint32
|
* - %G_VARIANT_TYPE_HANDLE: #guint32
|
||||||
* - %G_VARIANT_TYPE_DOUBLE: #gdouble
|
* - %G_VARIANT_TYPE_DOUBLE: #gdouble
|
||||||
*
|
*
|
||||||
@ -5042,7 +5042,7 @@ g_variant_valist_get_leaf (const gchar **str,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
*(guchar *) ptr = g_variant_get_byte (value);
|
*(guint8 *) ptr = g_variant_get_byte (value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
@ -5083,7 +5083,7 @@ g_variant_valist_get_leaf (const gchar **str,
|
|||||||
switch (*(*str)++)
|
switch (*(*str)++)
|
||||||
{
|
{
|
||||||
case 'y':
|
case 'y':
|
||||||
*(guchar *) ptr = 0;
|
*(guint8 *) ptr = 0;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -80,7 +80,7 @@ GVariantClass g_variant_classify (GVarian
|
|||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
GVariant * g_variant_new_boolean (gboolean value);
|
GVariant * g_variant_new_boolean (gboolean value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
GVariant * g_variant_new_byte (guchar value);
|
GVariant * g_variant_new_byte (guint8 value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
GVariant * g_variant_new_int16 (gint16 value);
|
GVariant * g_variant_new_int16 (gint16 value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
@ -133,7 +133,7 @@ GVariant * g_variant_new_fixed_array (const G
|
|||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
gboolean g_variant_get_boolean (GVariant *value);
|
gboolean g_variant_get_boolean (GVariant *value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
guchar g_variant_get_byte (GVariant *value);
|
guint8 g_variant_get_byte (GVariant *value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
gint16 g_variant_get_int16 (GVariant *value);
|
gint16 g_variant_get_int16 (GVariant *value);
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user