提交 01ae9cc2 编写于 作者: M Marc-André Lureau 提交者: Markus Armbruster

qapi: add condition to variants documentation

Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-21-marcandre.lureau@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 8867bf08
...@@ -168,8 +168,8 @@ def texi_members(doc, what, base, variants, member_func): ...@@ -168,8 +168,8 @@ def texi_members(doc, what, base, variants, member_func):
items += '@item The members of @code{%s}\n' % base.doc_type() items += '@item The members of @code{%s}\n' % base.doc_type()
if variants: if variants:
for v in variants.variants: for v in variants.variants:
when = ' when @code{%s} is @t{"%s"}' % ( when = ' when @code{%s} is @t{"%s"}%s' % (
variants.tag_member.name, v.name) variants.tag_member.name, v.name, texi_if(v.ifcond, " (", ")"))
if v.type.is_implicit(): if v.type.is_implicit():
assert not v.type.base and not v.type.variants assert not v.type.base and not v.type.variants
for m in v.type.local_members: for m in v.type.local_members:
......
...@@ -86,13 +86,13 @@ ...@@ -86,13 +86,13 @@
{ 'union': 'Object', { 'union': 'Object',
'base': 'Base', 'base': 'Base',
'discriminator': 'base1', 'discriminator': 'base1',
'data': { 'one': 'Variant1', 'two': 'Variant2' } } 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
## ##
# @SugaredUnion: # @SugaredUnion:
## ##
{ 'union': 'SugaredUnion', { 'union': 'SugaredUnion',
'data': { 'one': 'Variant1', 'two': 'Variant2' } } 'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
## ##
# == Another subsection # == Another subsection
......
...@@ -25,6 +25,7 @@ object Object ...@@ -25,6 +25,7 @@ object Object
tag base1 tag base1
case one: Variant1 case one: Variant1
case two: Variant2 case two: Variant2
if ['IFTWO']
object q_obj_Variant1-wrapper object q_obj_Variant1-wrapper
member data: Variant1 optional=False member data: Variant1 optional=False
object q_obj_Variant2-wrapper object q_obj_Variant2-wrapper
...@@ -32,11 +33,13 @@ object q_obj_Variant2-wrapper ...@@ -32,11 +33,13 @@ object q_obj_Variant2-wrapper
enum SugaredUnionKind enum SugaredUnionKind
member one member one
member two member two
if ['IFTWO']
object SugaredUnion object SugaredUnion
member type: SugaredUnionKind optional=False member type: SugaredUnionKind optional=False
tag type tag type
case one: q_obj_Variant1-wrapper case one: q_obj_Variant1-wrapper
case two: q_obj_Variant2-wrapper case two: q_obj_Variant2-wrapper
if ['IFTWO']
object q_obj_cmd-arg object q_obj_cmd-arg
member arg1: int optional=False member arg1: int optional=False
member arg2: str optional=True member arg2: str optional=True
......
...@@ -142,7 +142,7 @@ Not documented ...@@ -142,7 +142,7 @@ Not documented
@table @asis @table @asis
@item The members of @code{Base} @item The members of @code{Base}
@item The members of @code{Variant1} when @code{base1} is @t{"one"} @item The members of @code{Variant1} when @code{base1} is @t{"one"}
@item The members of @code{Variant2} when @code{base1} is @t{"two"} @item The members of @code{Variant2} when @code{base1} is @t{"two"} (@b{If:} @code{IFTWO})
@end table @end table
@end deftp @end deftp
...@@ -158,7 +158,7 @@ Not documented ...@@ -158,7 +158,7 @@ Not documented
@item @code{type} @item @code{type}
One of @t{"one"}, @t{"two"} One of @t{"one"}, @t{"two"}
@item @code{data: Variant1} when @code{type} is @t{"one"} @item @code{data: Variant1} when @code{type} is @t{"one"}
@item @code{data: Variant2} when @code{type} is @t{"two"} @item @code{data: Variant2} when @code{type} is @t{"two"} (@b{If:} @code{IFTWO})
@end table @end table
@end deftp @end deftp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册