DBusTypeWriterClass isn't going to work well, so remove vestiges of it.
[platform/upstream/dbus.git] / dbus / dbus-marshal-recursive.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-marshal-recursive.h  Marshalling routines for recursive types
3  *
4  * Copyright (C) 2004 Red Hat, Inc.
5  *
6  * Licensed under the Academic Free License version 2.1
7  * 
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.
12  *
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.
17  * 
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
21  *
22  */
23
24 #ifndef DBUS_MARSHAL_RECURSIVE_H
25 #define DBUS_MARSHAL_RECURSIVE_H
26
27 #include <config.h>
28 #include <dbus/dbus-marshal-basic.h>
29
30 #ifndef PACKAGE
31 #error "config.h not included here"
32 #endif
33
34 typedef struct DBusTypeReader      DBusTypeReader;
35 typedef struct DBusTypeWriter      DBusTypeWriter;
36 typedef struct DBusTypeReaderClass DBusTypeReaderClass;
37
38 struct DBusTypeReader
39 {
40   int byte_order;
41   const DBusString *type_str;
42   int type_pos;
43   const DBusString *value_str;
44   int value_pos;
45
46   const DBusTypeReaderClass *klass;
47   union
48   {
49     struct {
50       int start_pos;
51       dbus_uint32_t len;
52       int element_type;
53     } array;
54
55     struct {
56       int len_pos;
57
58     } dict;
59
60     struct {
61       dbus_uint32_t finished : 1;
62     } strct;
63   } u;
64 };
65
66 struct DBusTypeWriter
67 {
68   int byte_order;
69   DBusString *type_str;
70   int type_pos;
71   DBusString *value_str;
72   int value_pos;
73
74   dbus_uint32_t inside_array : 1;
75
76   int container_type;
77   union
78   {
79     struct {
80       int start_pos; /* first element */
81       int len_pos;
82       int element_type_pos; /* position in type_str of array element type */
83       int element_type_len;
84     } array;
85
86     struct {
87       int len_pos;
88
89     } dict;
90   } u;
91 };
92
93 void        _dbus_type_reader_init                (DBusTypeReader    *reader,
94                                                    int                byte_order,
95                                                    const DBusString  *type_str,
96                                                    int                type_pos,
97                                                    const DBusString  *value_str,
98                                                    int                value_pos);
99 int         _dbus_type_reader_get_current_type    (DBusTypeReader    *reader);
100 dbus_bool_t _dbus_type_reader_array_is_empty      (DBusTypeReader    *reader);
101 void        _dbus_type_reader_read_basic          (DBusTypeReader    *reader,
102                                                    void              *value);
103 dbus_bool_t _dbus_type_reader_read_array_of_basic (DBusTypeReader    *reader,
104                                                    int                type,
105                                                    void             **array,
106                                                    int               *array_len);
107 void        _dbus_type_reader_recurse             (DBusTypeReader    *reader,
108                                                    DBusTypeReader    *subreader);
109 dbus_bool_t _dbus_type_reader_next                (DBusTypeReader    *reader);
110
111 void        _dbus_type_writer_init          (DBusTypeWriter *writer,
112                                              int             byte_order,
113                                              DBusString     *type_str,
114                                              int             type_pos,
115                                              DBusString     *value_str,
116                                              int             value_pos);
117 dbus_bool_t _dbus_type_writer_write_basic   (DBusTypeWriter *writer,
118                                              int             type,
119                                              const void     *value);
120 dbus_bool_t _dbus_type_writer_write_array   (DBusTypeWriter *writer,
121                                              int             type,
122                                              const void     *array,
123                                              int             array_len);
124 dbus_bool_t _dbus_type_writer_recurse       (DBusTypeWriter *writer,
125                                              int             container_type,
126                                              DBusTypeWriter *sub);
127 dbus_bool_t _dbus_type_writer_recurse_array (DBusTypeWriter *writer,
128                                              const char     *element_type,
129                                              DBusTypeWriter *sub);
130 dbus_bool_t _dbus_type_writer_unrecurse     (DBusTypeWriter *writer,
131                                              DBusTypeWriter *sub);
132
133
134 #endif /* DBUS_MARSHAL_RECURSIVE_H */