summary refs log tree commit diff stats
path: root/include/qapi/visitor.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-07-08 16:14:21 +0200
committerKevin Wolf <kwolf@redhat.com>2013-07-26 21:10:11 +0200
commit69dd62dfd60631ba69201d8a197fde1ece4b4df3 (patch)
tree9963bd4874919f3a53e0cc2aab0550385fd3ff79 /include/qapi/visitor.h
parentea66c6d8819c8fc5f73a28554992be64e5399fed (diff)
downloadfocaccia-qemu-69dd62dfd60631ba69201d8a197fde1ece4b4df3.tar.gz
focaccia-qemu-69dd62dfd60631ba69201d8a197fde1ece4b4df3.zip
qapi: Anonymous unions
The discriminator for anonymous unions is the data type. This allows to
have a union type that allows both of these:

    { 'file': 'my_existing_block_device_id' }
    { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }

Unions like this are specified in the schema with an empty dict as
discriminator. For this example you could take:

    { 'union': 'BlockRef',
      'discriminator': {},
      'data': { 'definition': 'BlockOptions',
                'reference': 'str' } }
    { 'type': 'ExampleObject',
      'data: { 'file': 'BlockRef' } }

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/qapi/visitor.h')
-rw-r--r--include/qapi/visitor.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index bd24f85e97..48a2a2edfd 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -13,6 +13,7 @@
 #ifndef QAPI_VISITOR_CORE_H
 #define QAPI_VISITOR_CORE_H
 
+#include "qapi/qmp/qobject.h"
 #include "qapi/error.h"
 #include <stdlib.h>
 
@@ -42,6 +43,8 @@ void visit_end_list(Visitor *v, Error **errp);
 void visit_start_optional(Visitor *v, bool *present, const char *name,
                           Error **errp);
 void visit_end_optional(Visitor *v, Error **errp);
+void visit_get_next_type(Visitor *v, int *obj, const int *qtypes,
+                         const char *name, Error **errp);
 void visit_type_enum(Visitor *v, int *obj, const char *strings[],
                      const char *kind, const char *name, Error **errp);
 void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp);