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 typedef struct DBusTypeReader DBusTypeReader;
35 typedef struct DBusTypeWriter DBusTypeWriter;
36 typedef struct DBusTypeReaderClass DBusTypeReaderClass;
40 dbus_uint32_t byte_order : 8;
42 dbus_uint32_t types_only : 1; /* iterate over types not values */
44 dbus_uint32_t finished : 1; /* marks we're at end iterator for cases
45 * where we don't have another way to tell
47 const DBusString *type_str;
49 const DBusString *value_str;
52 const DBusTypeReaderClass *klass;
65 dbus_uint32_t byte_order : 8;
67 dbus_uint32_t container_type : 8;
69 dbus_uint32_t type_pos_is_expectation : 1; /* type_pos is an insertion point or an expected next type */
72 DBusString *value_str;
78 int start_pos; /* first element */
80 int element_type_pos; /* position of array element type in type_str */
85 void _dbus_type_reader_init (DBusTypeReader *reader,
87 const DBusString *type_str,
89 const DBusString *value_str,
91 void _dbus_type_reader_init_types_only (DBusTypeReader *reader,
92 const DBusString *type_str,
94 int _dbus_type_reader_get_current_type (DBusTypeReader *reader);
95 dbus_bool_t _dbus_type_reader_array_is_empty (DBusTypeReader *reader);
96 void _dbus_type_reader_read_basic (DBusTypeReader *reader,
98 dbus_bool_t _dbus_type_reader_read_array_of_basic (DBusTypeReader *reader,
102 void _dbus_type_reader_recurse (DBusTypeReader *reader,
103 DBusTypeReader *subreader);
104 dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader);
106 void _dbus_type_writer_init (DBusTypeWriter *writer,
108 DBusString *type_str,
110 DBusString *value_str,
112 dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer,
115 dbus_bool_t _dbus_type_writer_write_array (DBusTypeWriter *writer,
119 dbus_bool_t _dbus_type_writer_recurse_struct (DBusTypeWriter *writer,
120 DBusTypeWriter *sub);
121 dbus_bool_t _dbus_type_writer_recurse_array (DBusTypeWriter *writer,
122 const char *element_type,
123 DBusTypeWriter *sub);
124 dbus_bool_t _dbus_type_writer_recurse_variant (DBusTypeWriter *writer,
125 const char *contained_type,
126 DBusTypeWriter *sub);
127 dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer,
128 DBusTypeWriter *sub);
132 #endif /* DBUS_MARSHAL_RECURSIVE_H */