1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-marshal-recursive.h Marshalling routines for recursive types
4 * Copyright (C) 2004 Red Hat, Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef DBUS_MARSHAL_RECURSIVE_H
25 #define DBUS_MARSHAL_RECURSIVE_H
28 #include <dbus/dbus-marshal-basic.h>
31 #error "config.h not included here"
34 /* Notes on my plan to implement this:
35 * - also have DBusTypeWriter (heh)
36 * - TypeReader has accessors for:
38 * . array of basic type (efficiency hack)
39 * . another type reader
40 * - a dict will appear to be a list of string, whatever, string, whatever
41 * - a variant will contain another TypeReader
42 * - a struct will be a list of whatever, whatever, whatever
44 * So the basic API usage is to go next, next, next; if the
45 * item is a basic type or basic array then read the item;
46 * if it's another type reader then process it; if it's
47 * a container type (struct, array, variant, dict) then
55 const DBusString *type_str;
57 const DBusString *value_str;
61 typedef struct DBusTypeReader DBusTypeReader;
68 DBusString *value_str;
72 typedef struct DBusTypeWriter DBusTypeWriter;
74 void _dbus_type_reader_init (DBusTypeReader *reader,
76 const DBusString *type_str,
78 const DBusString *value_str,
80 int _dbus_type_reader_get_value_end (DBusTypeReader *reader);
81 int _dbus_type_reader_get_type_end (DBusTypeReader *reader);
82 int _dbus_type_reader_get_current_type (DBusTypeReader *reader);
83 int _dbus_type_reader_get_array_type (DBusTypeReader *reader);
84 void _dbus_type_reader_read_basic (DBusTypeReader *reader,
86 dbus_bool_t _dbus_type_reader_read_array (DBusTypeReader *reader,
90 void _dbus_type_reader_recurse (DBusTypeReader *reader);
91 void _dbus_type_reader_unrecurse (DBusTypeReader *reader);
92 dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader);
95 void _dbus_type_writer_init (DBusTypeWriter *writer,
99 DBusString *value_str,
101 dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer,
104 dbus_bool_t _dbus_type_writer_write_array (DBusTypeWriter *writer,
108 dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer,
110 dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer);
112 #endif /* DBUS_MARSHAL_RECURSIVE_H */