2010-02-10 17:13:06 +01:00
|
|
|
/*
|
|
|
|
* Copyright © 2007, 2008 Ryan Lortie
|
|
|
|
* Copyright © 2009, 2010 Codethink Limited
|
|
|
|
*
|
2022-05-18 10:15:38 +02:00
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*
|
2010-02-10 17:13:06 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-01-05 12:47:07 +01:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2010-02-10 17:13:06 +01:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2014-01-23 12:58:29 +01:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2010-02-10 17:13:06 +01:00
|
|
|
*
|
|
|
|
* Author: Ryan Lortie <desrt@desrt.ca>
|
|
|
|
*/
|
|
|
|
|
2012-12-28 05:43:14 +01:00
|
|
|
#ifndef __G_VARIANT_H__
|
|
|
|
#define __G_VARIANT_H__
|
|
|
|
|
2011-10-12 06:24:46 +02:00
|
|
|
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
2010-06-22 14:09:27 +02:00
|
|
|
#error "Only <glib.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2010-02-10 17:13:06 +01:00
|
|
|
#include <glib/gvarianttype.h>
|
2010-02-19 16:42:53 +01:00
|
|
|
#include <glib/gstring.h>
|
2012-10-23 16:11:33 +02:00
|
|
|
#include <glib/gbytes.h>
|
2010-02-10 17:13:06 +01:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _GVariant GVariant;
|
|
|
|
|
2010-02-19 16:42:53 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
G_VARIANT_CLASS_BOOLEAN = 'b',
|
|
|
|
G_VARIANT_CLASS_BYTE = 'y',
|
|
|
|
G_VARIANT_CLASS_INT16 = 'n',
|
|
|
|
G_VARIANT_CLASS_UINT16 = 'q',
|
|
|
|
G_VARIANT_CLASS_INT32 = 'i',
|
|
|
|
G_VARIANT_CLASS_UINT32 = 'u',
|
|
|
|
G_VARIANT_CLASS_INT64 = 'x',
|
|
|
|
G_VARIANT_CLASS_UINT64 = 't',
|
|
|
|
G_VARIANT_CLASS_HANDLE = 'h',
|
|
|
|
G_VARIANT_CLASS_DOUBLE = 'd',
|
|
|
|
G_VARIANT_CLASS_STRING = 's',
|
|
|
|
G_VARIANT_CLASS_OBJECT_PATH = 'o',
|
|
|
|
G_VARIANT_CLASS_SIGNATURE = 'g',
|
|
|
|
G_VARIANT_CLASS_VARIANT = 'v',
|
|
|
|
G_VARIANT_CLASS_MAYBE = 'm',
|
|
|
|
G_VARIANT_CLASS_ARRAY = 'a',
|
|
|
|
G_VARIANT_CLASS_TUPLE = '(',
|
|
|
|
G_VARIANT_CLASS_DICT_ENTRY = '{'
|
|
|
|
} GVariantClass;
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
void g_variant_unref (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
GVariant * g_variant_ref (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
GVariant * g_variant_ref_sink (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-06-19 16:42:11 +02:00
|
|
|
gboolean g_variant_is_floating (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-07-11 14:27:53 +02:00
|
|
|
GVariant * g_variant_take_ref (GVariant *value);
|
2010-02-10 17:13:06 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
const GVariantType * g_variant_get_type (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
const gchar * g_variant_get_type_string (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_is_of_type (GVariant *value,
|
|
|
|
const GVariantType *type);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_is_container (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariantClass g_variant_classify (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_boolean (gboolean value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2014-07-01 18:34:38 +02:00
|
|
|
GVariant * g_variant_new_byte (guint8 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_int16 (gint16 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_uint16 (guint16 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_int32 (gint32 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_uint32 (guint32 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_int64 (gint64 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_uint64 (guint64 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_handle (gint32 value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-02-08 16:04:36 +01:00
|
|
|
GVariant * g_variant_new_double (gdouble value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_string (const gchar *string);
|
2013-04-20 17:44:53 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_38
|
|
|
|
GVariant * g_variant_new_take_string (gchar *string);
|
2013-07-11 18:16:44 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_38
|
|
|
|
GVariant * g_variant_new_printf (const gchar *format_string,
|
|
|
|
...) G_GNUC_PRINTF (1, 2);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_object_path (const gchar *object_path);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_is_object_path (const gchar *string);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_signature (const gchar *signature);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_is_signature (const gchar *string);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_variant (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_strv (const gchar * const *strv,
|
|
|
|
gssize length);
|
2012-05-25 14:42:50 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_30
|
2011-07-20 13:11:19 +02:00
|
|
|
GVariant * g_variant_new_objv (const gchar * const *strv,
|
|
|
|
gssize length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
GVariant * g_variant_new_bytestring (const gchar *string);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
GVariant * g_variant_new_bytestring_array (const gchar * const *strv,
|
|
|
|
gssize length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-09-23 10:57:55 +02:00
|
|
|
GVariant * g_variant_new_fixed_array (const GVariantType *element_type,
|
|
|
|
gconstpointer elements,
|
2011-10-06 18:19:58 +02:00
|
|
|
gsize n_elements,
|
2011-09-23 10:57:55 +02:00
|
|
|
gsize element_size);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_get_boolean (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2014-07-01 18:34:38 +02:00
|
|
|
guint8 g_variant_get_byte (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gint16 g_variant_get_int16 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
guint16 g_variant_get_uint16 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gint32 g_variant_get_int32 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
guint32 g_variant_get_uint32 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gint64 g_variant_get_int64 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
guint64 g_variant_get_uint64 (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gint32 g_variant_get_handle (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gdouble g_variant_get_double (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_get_variant (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
const gchar * g_variant_get_string (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gchar * g_variant_dup_string (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
const gchar ** g_variant_get_strv (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gchar ** g_variant_dup_strv (GVariant *value,
|
|
|
|
gsize *length);
|
2012-05-25 14:42:50 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_30
|
2011-07-20 13:11:19 +02:00
|
|
|
const gchar ** g_variant_get_objv (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-07-20 13:11:19 +02:00
|
|
|
gchar ** g_variant_dup_objv (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
const gchar * g_variant_get_bytestring (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
gchar * g_variant_dup_bytestring (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
const gchar ** g_variant_get_bytestring_array (GVariant *value,
|
|
|
|
gsize *length);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-07-07 16:37:16 +02:00
|
|
|
gchar ** g_variant_dup_bytestring_array (GVariant *value,
|
|
|
|
gsize *length);
|
2010-02-19 16:42:53 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_maybe (const GVariantType *child_type,
|
|
|
|
GVariant *child);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_array (const GVariantType *child_type,
|
|
|
|
GVariant * const *children,
|
|
|
|
gsize n_children);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_tuple (GVariant * const *children,
|
|
|
|
gsize n_children);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_new_dict_entry (GVariant *key,
|
|
|
|
GVariant *value);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GVariant * g_variant_get_maybe (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
gsize g_variant_n_children (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-08 16:30:59 +01:00
|
|
|
void g_variant_get_child (GVariant *value,
|
|
|
|
gsize index_,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
GVariant * g_variant_get_child_value (GVariant *value,
|
2010-02-19 16:42:53 +01:00
|
|
|
gsize index_);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-11-27 12:45:45 +01:00
|
|
|
gboolean g_variant_lookup (GVariant *dictionary,
|
2010-11-06 02:33:06 +01:00
|
|
|
const gchar *key,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-11-27 12:45:45 +01:00
|
|
|
GVariant * g_variant_lookup_value (GVariant *dictionary,
|
2010-11-06 02:33:06 +01:00
|
|
|
const gchar *key,
|
2010-11-27 12:45:45 +01:00
|
|
|
const GVariantType *expected_type);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gconstpointer g_variant_get_fixed_array (GVariant *value,
|
|
|
|
gsize *n_elements,
|
|
|
|
gsize element_size);
|
2010-02-10 17:13:06 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
gsize g_variant_get_size (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
gconstpointer g_variant_get_data (GVariant *value);
|
2012-10-23 16:11:33 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_36
|
|
|
|
GBytes * g_variant_get_data_as_bytes (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-10 17:13:06 +01:00
|
|
|
void g_variant_store (GVariant *value,
|
|
|
|
gpointer data);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gchar * g_variant_print (GVariant *value,
|
|
|
|
gboolean type_annotate);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
GString * g_variant_print_string (GVariant *value,
|
|
|
|
GString *string,
|
|
|
|
gboolean type_annotate);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
guint g_variant_hash (gconstpointer value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-19 16:42:53 +01:00
|
|
|
gboolean g_variant_equal (gconstpointer one,
|
|
|
|
gconstpointer two);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 19:46:09 +01:00
|
|
|
GVariant * g_variant_get_normal_form (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 19:46:09 +01:00
|
|
|
gboolean g_variant_is_normal_form (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 19:46:09 +01:00
|
|
|
GVariant * g_variant_byteswap (GVariant *value);
|
2012-10-23 16:11:33 +02:00
|
|
|
|
|
|
|
GLIB_AVAILABLE_IN_2_36
|
|
|
|
GVariant * g_variant_new_from_bytes (const GVariantType *type,
|
|
|
|
GBytes *bytes,
|
|
|
|
gboolean trusted);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-14 20:55:48 +01:00
|
|
|
GVariant * g_variant_new_from_data (const GVariantType *type,
|
|
|
|
gconstpointer data,
|
|
|
|
gsize size,
|
|
|
|
gboolean trusted,
|
|
|
|
GDestroyNotify notify,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2010-02-22 06:39:01 +01:00
|
|
|
typedef struct _GVariantIter GVariantIter;
|
|
|
|
struct _GVariantIter {
|
|
|
|
/*< private >*/
|
2022-12-15 00:55:20 +01:00
|
|
|
guintptr x[16];
|
2010-02-22 06:39:01 +01:00
|
|
|
};
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
GVariantIter * g_variant_iter_new (GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
gsize g_variant_iter_init (GVariantIter *iter,
|
|
|
|
GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
GVariantIter * g_variant_iter_copy (GVariantIter *iter);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
gsize g_variant_iter_n_children (GVariantIter *iter);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
void g_variant_iter_free (GVariantIter *iter);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
GVariant * g_variant_iter_next_value (GVariantIter *iter);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
gboolean g_variant_iter_next (GVariantIter *iter,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
gboolean g_variant_iter_loop (GVariantIter *iter,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GVariantBuilder GVariantBuilder;
|
2010-03-03 09:37:37 +01:00
|
|
|
struct _GVariantBuilder {
|
|
|
|
/*< private >*/
|
2016-05-13 17:55:30 +02:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
gsize partial_magic;
|
|
|
|
const GVariantType *type;
|
2022-12-15 00:55:18 +01:00
|
|
|
guintptr y[14];
|
2016-07-21 12:24:38 +02:00
|
|
|
} s;
|
2022-12-15 00:55:18 +01:00
|
|
|
guintptr x[16];
|
2016-07-21 12:24:38 +02:00
|
|
|
} u;
|
2010-03-03 09:37:37 +01:00
|
|
|
};
|
2010-02-22 06:39:01 +01:00
|
|
|
|
2010-06-20 18:30:27 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
2010-11-09 22:56:28 +01:00
|
|
|
G_VARIANT_PARSE_ERROR_FAILED,
|
|
|
|
G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED,
|
|
|
|
G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE,
|
|
|
|
G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED,
|
|
|
|
G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END,
|
|
|
|
G_VARIANT_PARSE_ERROR_INVALID_CHARACTER,
|
|
|
|
G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING,
|
|
|
|
G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH,
|
|
|
|
G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE,
|
|
|
|
G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING,
|
|
|
|
G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE,
|
|
|
|
G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE,
|
|
|
|
G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG,
|
|
|
|
G_VARIANT_PARSE_ERROR_TYPE_ERROR,
|
|
|
|
G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN,
|
|
|
|
G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD,
|
|
|
|
G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT,
|
2019-10-18 14:50:09 +02:00
|
|
|
G_VARIANT_PARSE_ERROR_VALUE_EXPECTED,
|
|
|
|
G_VARIANT_PARSE_ERROR_RECURSION
|
2010-06-20 18:30:27 +02:00
|
|
|
} GVariantParseError;
|
2013-09-17 11:10:28 +02:00
|
|
|
#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ())
|
2010-06-20 18:30:27 +02:00
|
|
|
|
2013-09-17 11:10:28 +02:00
|
|
|
GLIB_DEPRECATED_IN_2_38_FOR(g_variant_parse_error_quark)
|
2010-03-21 18:31:46 +01:00
|
|
|
GQuark g_variant_parser_get_error_quark (void);
|
|
|
|
|
2013-09-17 11:10:28 +02:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
|
|
|
GQuark g_variant_parse_error_quark (void);
|
|
|
|
|
2016-05-13 17:55:30 +02:00
|
|
|
/**
|
|
|
|
* G_VARIANT_BUILDER_INIT:
|
|
|
|
* @variant_type: a const GVariantType*
|
|
|
|
*
|
|
|
|
* A stack-allocated #GVariantBuilder must be initialized if it is
|
|
|
|
* used together with g_auto() to avoid warnings or crashes if
|
|
|
|
* function returns before g_variant_builder_init() is called on the
|
2021-08-02 16:56:42 +02:00
|
|
|
* builder.
|
|
|
|
*
|
|
|
|
* This macro can be used as initializer instead of an
|
2016-05-13 17:55:30 +02:00
|
|
|
* explicit zeroing a variable when declaring it and a following
|
|
|
|
* g_variant_builder_init(), but it cannot be assigned to a variable.
|
|
|
|
*
|
|
|
|
* The passed @variant_type should be a static GVariantType to avoid
|
|
|
|
* lifetime issues, as copying the @variant_type does not happen in
|
|
|
|
* the G_VARIANT_BUILDER_INIT() call, but rather in functions that
|
|
|
|
* make sure that #GVariantBuilder is valid.
|
|
|
|
*
|
2021-08-02 16:56:42 +02:00
|
|
|
* |[<!-- language="C" -->
|
2016-05-13 17:55:30 +02:00
|
|
|
* g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING);
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Since: 2.50
|
|
|
|
*/
|
2022-03-04 12:29:58 +01:00
|
|
|
#define G_VARIANT_BUILDER_INIT(variant_type) \
|
|
|
|
{ \
|
|
|
|
{ \
|
|
|
|
{ \
|
|
|
|
2942751021u /* == GVSB_MAGIC_PARTIAL, see gvariant.c */, variant_type, { 0, } \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
2016-05-13 17:55:30 +02:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-03 09:37:37 +01:00
|
|
|
GVariantBuilder * g_variant_builder_new (const GVariantType *type);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
void g_variant_builder_unref (GVariantBuilder *builder);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
GVariantBuilder * g_variant_builder_ref (GVariantBuilder *builder);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-03 09:37:37 +01:00
|
|
|
void g_variant_builder_init (GVariantBuilder *builder,
|
|
|
|
const GVariantType *type);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
GVariant * g_variant_builder_end (GVariantBuilder *builder);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-03 09:37:37 +01:00
|
|
|
void g_variant_builder_clear (GVariantBuilder *builder);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-03 09:37:37 +01:00
|
|
|
void g_variant_builder_open (GVariantBuilder *builder,
|
2010-02-22 06:39:01 +01:00
|
|
|
const GVariantType *type);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-03 09:37:37 +01:00
|
|
|
void g_variant_builder_close (GVariantBuilder *builder);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
void g_variant_builder_add_value (GVariantBuilder *builder,
|
|
|
|
GVariant *value);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-02-22 06:39:01 +01:00
|
|
|
void g_variant_builder_add (GVariantBuilder *builder,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-06-03 11:24:31 +02:00
|
|
|
void g_variant_builder_add_parsed (GVariantBuilder *builder,
|
|
|
|
const gchar *format,
|
|
|
|
...);
|
2010-02-22 06:39:01 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-08 16:30:59 +01:00
|
|
|
GVariant * g_variant_new (const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-08 16:30:59 +01:00
|
|
|
void g_variant_get (GVariant *value,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-08 16:30:59 +01:00
|
|
|
GVariant * g_variant_new_va (const gchar *format_string,
|
|
|
|
const gchar **endptr,
|
|
|
|
va_list *app);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-08 16:30:59 +01:00
|
|
|
void g_variant_get_va (GVariant *value,
|
|
|
|
const gchar *format_string,
|
|
|
|
const gchar **endptr,
|
|
|
|
va_list *app);
|
2013-03-21 13:10:36 +01:00
|
|
|
GLIB_AVAILABLE_IN_2_34
|
2012-08-18 20:12:55 +02:00
|
|
|
gboolean g_variant_check_format_string (GVariant *value,
|
|
|
|
const gchar *format_string,
|
|
|
|
gboolean copy_only);
|
2010-03-08 16:30:59 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 18:31:46 +01:00
|
|
|
GVariant * g_variant_parse (const GVariantType *type,
|
|
|
|
const gchar *text,
|
|
|
|
const gchar *limit,
|
|
|
|
const gchar **endptr,
|
|
|
|
GError **error);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 18:31:46 +01:00
|
|
|
GVariant * g_variant_new_parsed (const gchar *format,
|
|
|
|
...);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-03-21 18:31:46 +01:00
|
|
|
GVariant * g_variant_new_parsed_va (const gchar *format,
|
|
|
|
va_list *app);
|
|
|
|
|
2013-12-22 17:41:19 +01:00
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
gchar * g_variant_parse_error_print_context (GError *error,
|
|
|
|
const gchar *source_str);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-04-23 02:48:24 +02:00
|
|
|
gint g_variant_compare (gconstpointer one,
|
|
|
|
gconstpointer two);
|
2014-01-24 15:42:13 +01:00
|
|
|
|
|
|
|
typedef struct _GVariantDict GVariantDict;
|
|
|
|
struct _GVariantDict {
|
|
|
|
/*< private >*/
|
2016-06-04 15:01:31 +02:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
GVariant *asv;
|
|
|
|
gsize partial_magic;
|
2022-12-15 00:55:18 +01:00
|
|
|
guintptr y[14];
|
2016-07-21 12:24:38 +02:00
|
|
|
} s;
|
2022-12-15 00:55:18 +01:00
|
|
|
guintptr x[16];
|
2016-07-21 12:24:38 +02:00
|
|
|
} u;
|
2014-01-24 15:42:13 +01:00
|
|
|
};
|
|
|
|
|
2016-06-04 15:01:31 +02:00
|
|
|
/**
|
|
|
|
* G_VARIANT_DICT_INIT:
|
|
|
|
* @asv: (nullable): a GVariant*
|
|
|
|
*
|
|
|
|
* A stack-allocated #GVariantDict must be initialized if it is used
|
|
|
|
* together with g_auto() to avoid warnings or crashes if function
|
|
|
|
* returns before g_variant_dict_init() is called on the builder.
|
2021-08-02 16:56:42 +02:00
|
|
|
*
|
2016-06-04 15:01:31 +02:00
|
|
|
* This macro can be used as initializer instead of an explicit
|
|
|
|
* zeroing a variable when declaring it and a following
|
|
|
|
* g_variant_dict_init(), but it cannot be assigned to a variable.
|
|
|
|
*
|
|
|
|
* The passed @asv has to live long enough for #GVariantDict to gather
|
|
|
|
* the entries from, as the gathering does not happen in the
|
|
|
|
* G_VARIANT_DICT_INIT() call, but rather in functions that make sure
|
|
|
|
* that #GVariantDict is valid. In context where the initialization
|
|
|
|
* value has to be a constant expression, the only possible value of
|
|
|
|
* @asv is %NULL. It is still possible to call g_variant_dict_init()
|
|
|
|
* safely with a different @asv right after the variable was
|
|
|
|
* initialized with G_VARIANT_DICT_INIT().
|
|
|
|
*
|
2021-08-02 16:56:42 +02:00
|
|
|
* |[<!-- language="C" -->
|
2016-06-04 15:01:31 +02:00
|
|
|
* g_autoptr(GVariant) variant = get_asv_variant ();
|
|
|
|
* g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT (variant);
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Since: 2.50
|
|
|
|
*/
|
2022-03-04 12:29:58 +01:00
|
|
|
#define G_VARIANT_DICT_INIT(asv) \
|
|
|
|
{ \
|
|
|
|
{ \
|
|
|
|
{ \
|
|
|
|
asv, 3488698669u /* == GVSD_MAGIC_PARTIAL, see gvariant.c */, { 0, } \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
2016-06-04 15:01:31 +02:00
|
|
|
|
2014-01-24 15:42:13 +01:00
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
GVariantDict * g_variant_dict_new (GVariant *from_asv);
|
|
|
|
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
void g_variant_dict_init (GVariantDict *dict,
|
|
|
|
GVariant *from_asv);
|
|
|
|
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
gboolean g_variant_dict_lookup (GVariantDict *dict,
|
|
|
|
const gchar *key,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
GVariant * g_variant_dict_lookup_value (GVariantDict *dict,
|
|
|
|
const gchar *key,
|
|
|
|
const GVariantType *expected_type);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
gboolean g_variant_dict_contains (GVariantDict *dict,
|
|
|
|
const gchar *key);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
void g_variant_dict_insert (GVariantDict *dict,
|
|
|
|
const gchar *key,
|
|
|
|
const gchar *format_string,
|
|
|
|
...);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
void g_variant_dict_insert_value (GVariantDict *dict,
|
|
|
|
const gchar *key,
|
|
|
|
GVariant *value);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
gboolean g_variant_dict_remove (GVariantDict *dict,
|
|
|
|
const gchar *key);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
void g_variant_dict_clear (GVariantDict *dict);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
GVariant * g_variant_dict_end (GVariantDict *dict);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
GVariantDict * g_variant_dict_ref (GVariantDict *dict);
|
|
|
|
GLIB_AVAILABLE_IN_2_40
|
|
|
|
void g_variant_dict_unref (GVariantDict *dict);
|
|
|
|
|
2010-02-10 17:13:06 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __G_VARIANT_H__ */
|