qapi: Anonymous unions
authorKevin Wolf <kwolf@redhat.com>
Mon, 8 Jul 2013 14:14:21 +0000 (16:14 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 26 Jul 2013 19:10:11 +0000 (21:10 +0200)
commit69dd62dfd60631ba69201d8a197fde1ece4b4df3
tree9963bd4874919f3a53e0cc2aab0550385fd3ff79
parentea66c6d8819c8fc5f73a28554992be64e5399fed
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>
docs/qapi-code-gen.txt
include/qapi/qmp/qobject.h
include/qapi/visitor-impl.h
include/qapi/visitor.h
qapi/qapi-visit-core.c
qapi/qmp-input-visitor.c
qobject/qjson.c
scripts/qapi-types.py
scripts/qapi-visit.py
scripts/qapi.py