Updated FSF's address
[platform/upstream/glib.git] / glib / gvariant-serialiser.h
1 /*
2  * Copyright © 2007, 2008 Ryan Lortie
3  * Copyright © 2010 Codethink Limited
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author: Ryan Lortie <desrt@desrt.ca>
19  */
20
21 #ifndef __G_VARIANT_SERIALISER_H__
22 #define __G_VARIANT_SERIALISER_H__
23
24 #include "gvarianttypeinfo.h"
25
26 typedef struct
27 {
28   GVariantTypeInfo *type_info;
29   guchar           *data;
30   gsize             size;
31 } GVariantSerialised;
32
33 /* deserialisation */
34 GLIB_AVAILABLE_IN_ALL
35 gsize                           g_variant_serialised_n_children         (GVariantSerialised        container);
36 GLIB_AVAILABLE_IN_ALL
37 GVariantSerialised              g_variant_serialised_get_child          (GVariantSerialised        container,
38                                                                          gsize                     index);
39
40 /* serialisation */
41 typedef void                  (*GVariantSerialisedFiller)               (GVariantSerialised       *serialised,
42                                                                          gpointer                  data);
43
44 GLIB_AVAILABLE_IN_ALL
45 gsize                           g_variant_serialiser_needed_size        (GVariantTypeInfo         *info,
46                                                                          GVariantSerialisedFiller  gsv_filler,
47                                                                          const gpointer           *children,
48                                                                          gsize                     n_children);
49
50 GLIB_AVAILABLE_IN_ALL
51 void                            g_variant_serialiser_serialise          (GVariantSerialised        container,
52                                                                          GVariantSerialisedFiller  gsv_filler,
53                                                                          const gpointer           *children,
54                                                                          gsize                     n_children);
55
56 /* misc */
57 GLIB_AVAILABLE_IN_ALL
58 gboolean                        g_variant_serialised_is_normal          (GVariantSerialised        value);
59 GLIB_AVAILABLE_IN_ALL
60 void                            g_variant_serialised_byteswap           (GVariantSerialised        value);
61
62 /* validation of strings */
63 GLIB_AVAILABLE_IN_ALL
64 gboolean                        g_variant_serialiser_is_string          (gconstpointer             data,
65                                                                          gsize                     size);
66 GLIB_AVAILABLE_IN_ALL
67 gboolean                        g_variant_serialiser_is_object_path     (gconstpointer             data,
68                                                                          gsize                     size);
69 GLIB_AVAILABLE_IN_ALL
70 gboolean                        g_variant_serialiser_is_signature       (gconstpointer             data,
71                                                                          gsize                     size);
72
73 #endif /* __G_VARIANT_SERIALISER_H__ */