mirror of
https://github.com/mii443/qemu.git
synced 2025-08-23 23:49:36 +00: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:
@ -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)
|
||||
|
Reference in New Issue
Block a user