mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: Introduce a first class 'null' type
I expect the 'null' type to be useful mostly for members of alternate types. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
d2f95f4d48
commit
4d2d5c41a9
8 changed files with 31 additions and 8 deletions
|
@ -20,6 +20,7 @@ import sys
|
|||
from ordereddict import OrderedDict
|
||||
|
||||
builtin_types = {
|
||||
'null': 'QTYPE_QNULL',
|
||||
'str': 'QTYPE_QSTRING',
|
||||
'int': 'QTYPE_QNUM',
|
||||
'number': 'QTYPE_QNUM',
|
||||
|
@ -1056,6 +1057,7 @@ class QAPISchemaType(QAPISchemaEntity):
|
|||
|
||||
def alternate_qtype(self):
|
||||
json2qtype = {
|
||||
'null': 'QTYPE_QNULL',
|
||||
'string': 'QTYPE_QSTRING',
|
||||
'number': 'QTYPE_QNUM',
|
||||
'int': 'QTYPE_QNUM',
|
||||
|
@ -1515,7 +1517,8 @@ class QAPISchema(object):
|
|||
('uint64', 'int', 'uint64_t'),
|
||||
('size', 'int', 'uint64_t'),
|
||||
('bool', 'boolean', 'bool'),
|
||||
('any', 'value', 'QObject' + pointer_suffix)]:
|
||||
('any', 'value', 'QObject' + pointer_suffix),
|
||||
('null', 'null', 'QNull' + pointer_suffix)]:
|
||||
self._def_builtin_type(*t)
|
||||
self.the_empty_object_type = QAPISchemaObjectType(
|
||||
'q_empty', None, None, None, [], None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue