2 * Copyright © 2007, 2008 Ryan Lortie
3 * Copyright © 2010 Codethink Limited
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 * Author: Ryan Lortie <desrt@desrt.ca>
23 #ifndef __G_VARIANT_SERIALISER_H__
24 #define __G_VARIANT_SERIALISER_H__
26 #include "gvarianttypeinfo.h"
30 GVariantTypeInfo *type_info;
33 gsize depth; /* same semantics as GVariant.depth */
35 /* If ordered_offsets_up_to == n this means that all the frame offsets up to and
36 * including the frame offset determining the end of element n are in order.
37 * This guarantees that the bytes of element n don't overlap with any previous
40 * This is both read and set by g_variant_serialised_get_child() for arrays of
41 * non-fixed-width types, and for tuples.
43 * Even when dealing with tuples, @ordered_offsets_up_to is an element index,
44 * rather than an index into the frame offsets. */
45 gsize ordered_offsets_up_to;
47 /* Similar to @ordered_offsets_up_to. This gives the index of the child element
48 * whose frame offset is the highest in the offset table which has been
51 * This is always ≥ @ordered_offsets_up_to. It is always an element index.
53 * See documentation in gvariant-core.c for `struct GVariant` for details. */
54 gsize checked_offsets_up_to;
59 gsize g_variant_serialised_n_children (GVariantSerialised container);
61 GVariantSerialised g_variant_serialised_get_child (GVariantSerialised container,
65 typedef void (*GVariantSerialisedFiller) (GVariantSerialised *serialised,
69 gsize g_variant_serialiser_needed_size (GVariantTypeInfo *info,
70 GVariantSerialisedFiller gsv_filler,
71 const gpointer *children,
75 void g_variant_serialiser_serialise (GVariantSerialised container,
76 GVariantSerialisedFiller gsv_filler,
77 const gpointer *children,
81 GLIB_AVAILABLE_IN_2_60
82 gboolean g_variant_serialised_check (GVariantSerialised serialised);
84 gboolean g_variant_serialised_is_normal (GVariantSerialised value);
86 void g_variant_serialised_byteswap (GVariantSerialised value);
88 /* validation of strings */
90 gboolean g_variant_serialiser_is_string (gconstpointer data,
93 gboolean g_variant_serialiser_is_object_path (gconstpointer data,
96 gboolean g_variant_serialiser_is_signature (gconstpointer data,
99 #endif /* __G_VARIANT_SERIALISER_H__ */