summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal-recursive.h
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-12-29 22:22:41 +0000
committerHavoc Pennington <hp@redhat.com>2004-12-29 22:22:41 +0000
commit9b0fc4e482d6d7d9d6105d876fbbd2182e7b6dd3 (patch)
tree5e194e4b70170e884ea5edd432dd43d8916313a4 /dbus/dbus-marshal-recursive.h
parent8645ee5251a7be5a77d6f4c8aa023d34c81c242d (diff)
switch to a vtable approach for the reader
Diffstat (limited to 'dbus/dbus-marshal-recursive.h')
-rw-r--r--dbus/dbus-marshal-recursive.h29
1 files changed, 6 insertions, 23 deletions
diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h
index 8e5427bd..6d0a40b4 100644
--- a/dbus/dbus-marshal-recursive.h
+++ b/dbus/dbus-marshal-recursive.h
@@ -31,23 +31,10 @@
#error "config.h not included here"
#endif
-/* Notes on my plan to implement this:
- * - also have DBusTypeWriter (heh)
- * - TypeReader has accessors for:
- * . basic type
- * . array of basic type (efficiency hack)
- * . another type reader
- * - a dict will appear to be a list of string, whatever, string, whatever
- * - a variant will contain another TypeReader
- * - a struct will be a list of whatever, whatever, whatever
- *
- * So the basic API usage is to go next, next, next; if the
- * item is a basic type or basic array then read the item;
- * if it's another type reader then process it; if it's
- * a container type (struct, array, variant, dict) then
- * recurse.
- *
- */
+typedef struct DBusTypeReader DBusTypeReader;
+typedef struct DBusTypeWriter DBusTypeWriter;
+typedef struct DBusTypeReaderClass DBusTypeReaderClass;
+typedef struct DBusTypeWriterClass DBusTypeWriterClass;
struct DBusTypeReader
{
@@ -57,8 +44,7 @@ struct DBusTypeReader
const DBusString *value_str;
int value_pos;
- /* Hmm - it might be cleaner to do TypeReaderClass *vtable for container type */
- int container_type;
+ const DBusTypeReaderClass *klass;
union
{
struct {
@@ -78,8 +64,6 @@ struct DBusTypeReader
} u;
};
-typedef struct DBusTypeReader DBusTypeReader;
-
struct DBusTypeWriter
{
int byte_order;
@@ -90,6 +74,7 @@ struct DBusTypeWriter
dbus_uint32_t inside_array : 1;
+ /* const DBusTypeWriterClass *klass; */
int container_type;
union
{
@@ -107,8 +92,6 @@ struct DBusTypeWriter
} u;
};
-typedef struct DBusTypeWriter DBusTypeWriter;
-
void _dbus_type_reader_init (DBusTypeReader *reader,
int byte_order,
const DBusString *type_str,