2017-03-20 21:11:54 +08:00
|
|
|
# -*- Mode: Python -*-
|
2020-07-30 02:50:24 +08:00
|
|
|
# vim: filetype=python
|
|
|
|
#
|
2017-03-20 21:11:54 +08:00
|
|
|
# Positive QAPI doc comment tests
|
|
|
|
|
|
|
|
{ 'pragma': { 'doc-required': true } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# = Section
|
|
|
|
#
|
|
|
|
# == Subsection
|
|
|
|
#
|
|
|
|
# *strong* _with emphasis_
|
|
|
|
# @var {in braces}
|
|
|
|
# * List item one
|
|
|
|
# - Two, multiple
|
|
|
|
# lines
|
|
|
|
#
|
|
|
|
# 3. Three
|
|
|
|
# Still in list
|
|
|
|
#
|
|
|
|
# Not in list
|
|
|
|
# - Second list
|
|
|
|
# Note: still in list
|
|
|
|
#
|
|
|
|
# Note: not in list
|
|
|
|
# 1. Third list
|
|
|
|
# is numbered
|
|
|
|
#
|
|
|
|
# - another item
|
|
|
|
#
|
|
|
|
# | example
|
|
|
|
# | multiple lines
|
|
|
|
#
|
|
|
|
# Returns: the King
|
|
|
|
# Since: the first age
|
|
|
|
# Notes:
|
|
|
|
#
|
|
|
|
# 1. Lorem ipsum dolor sit amet
|
|
|
|
#
|
|
|
|
# 2. Ut enim ad minim veniam
|
|
|
|
#
|
|
|
|
# Duis aute irure dolor
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> in
|
|
|
|
# <- out
|
|
|
|
# Examples:
|
|
|
|
# - *verbatim*
|
|
|
|
# - {braces}
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# @Enum:
|
|
|
|
# @one: The _one_ {and only}
|
|
|
|
#
|
2020-03-17 19:54:37 +08:00
|
|
|
# Features:
|
|
|
|
# @enum-feat: Also _one_ {and only}
|
|
|
|
#
|
2017-03-20 21:11:54 +08:00
|
|
|
# @two is undocumented
|
|
|
|
##
|
2018-12-13 20:37:20 +08:00
|
|
|
{ 'enum': 'Enum', 'data':
|
|
|
|
[ { 'name': 'one', 'if': 'defined(IFONE)' }, 'two' ],
|
2020-03-17 19:54:37 +08:00
|
|
|
'features': [ 'enum-feat' ],
|
2018-12-13 20:37:20 +08:00
|
|
|
'if': 'defined(IFCOND)' }
|
2017-03-20 21:11:54 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @Base:
|
|
|
|
# @base1:
|
|
|
|
# the first member
|
|
|
|
##
|
|
|
|
{ 'struct': 'Base', 'data': { 'base1': 'Enum' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @Variant1:
|
|
|
|
# A paragraph
|
|
|
|
#
|
|
|
|
# Another paragraph (but no @var: line)
|
2019-10-18 16:14:53 +08:00
|
|
|
#
|
|
|
|
# Features:
|
|
|
|
# @variant1-feat: a feature
|
2020-03-17 19:54:45 +08:00
|
|
|
# @member-feat: a member feature
|
2017-03-20 21:11:54 +08:00
|
|
|
##
|
2018-12-13 20:37:21 +08:00
|
|
|
{ 'struct': 'Variant1',
|
2019-10-18 16:14:53 +08:00
|
|
|
'features': [ 'variant1-feat' ],
|
2020-03-17 19:54:45 +08:00
|
|
|
'data': { 'var1': { 'type': 'str',
|
|
|
|
'features': [ 'member-feat' ],
|
|
|
|
'if': 'defined(IFSTR)' } } }
|
2017-03-20 21:11:54 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @Variant2:
|
|
|
|
##
|
|
|
|
{ 'struct': 'Variant2', 'data': {} }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @Object:
|
2020-03-17 19:54:37 +08:00
|
|
|
# Features:
|
|
|
|
# @union-feat1: a feature
|
2017-03-20 21:11:54 +08:00
|
|
|
##
|
|
|
|
{ 'union': 'Object',
|
2020-03-17 19:54:37 +08:00
|
|
|
'features': [ 'union-feat1' ],
|
2017-03-20 21:11:54 +08:00
|
|
|
'base': 'Base',
|
|
|
|
'discriminator': 'base1',
|
2018-12-13 20:37:22 +08:00
|
|
|
'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
|
2017-03-20 21:11:54 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @SugaredUnion:
|
2020-03-17 19:54:37 +08:00
|
|
|
# Features:
|
|
|
|
# @union-feat2: a feature
|
2017-03-20 21:11:54 +08:00
|
|
|
##
|
|
|
|
{ 'union': 'SugaredUnion',
|
2020-03-17 19:54:37 +08:00
|
|
|
'features': [ 'union-feat2' ],
|
2018-12-13 20:37:22 +08:00
|
|
|
'data': { 'one': 'Variant1', 'two': { 'type': 'Variant2', 'if': 'IFTWO' } } }
|
2017-03-20 21:11:54 +08:00
|
|
|
|
2019-10-24 19:02:21 +08:00
|
|
|
##
|
|
|
|
# @Alternate:
|
|
|
|
# @i: an integer
|
|
|
|
# @b is undocumented
|
2020-03-17 19:54:37 +08:00
|
|
|
#
|
|
|
|
# Features:
|
|
|
|
# @alt-feat: a feature
|
2019-10-24 19:02:21 +08:00
|
|
|
##
|
|
|
|
{ 'alternate': 'Alternate',
|
2020-03-17 19:54:37 +08:00
|
|
|
'features': [ 'alt-feat' ],
|
2019-10-24 19:02:21 +08:00
|
|
|
'data': { 'i': 'int', 'b': 'bool' } }
|
|
|
|
|
2017-03-20 21:11:54 +08:00
|
|
|
##
|
|
|
|
# == Another subsection
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# @cmd:
|
|
|
|
# @arg1: the first argument
|
|
|
|
#
|
|
|
|
# @arg2: the second
|
|
|
|
# argument
|
2019-10-18 16:14:53 +08:00
|
|
|
#
|
|
|
|
# Features:
|
|
|
|
# @cmd-feat1: a feature
|
|
|
|
# @cmd-feat2: another feature
|
2017-03-20 21:11:54 +08:00
|
|
|
# Note: @arg3 is undocumented
|
|
|
|
# Returns: @Object
|
|
|
|
# TODO: frobnicate
|
|
|
|
# Notes:
|
|
|
|
# - Lorem ipsum dolor sit amet
|
|
|
|
# - Ut enim ad minim veniam
|
|
|
|
#
|
|
|
|
# Duis aute irure dolor
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> in
|
|
|
|
# <- out
|
|
|
|
# Examples:
|
|
|
|
# - *verbatim*
|
|
|
|
# - {braces}
|
|
|
|
# Since: 2.10
|
|
|
|
##
|
|
|
|
{ 'command': 'cmd',
|
|
|
|
'data': { 'arg1': 'int', '*arg2': 'str', 'arg3': 'bool' },
|
2019-10-18 16:14:53 +08:00
|
|
|
'returns': 'Object',
|
|
|
|
'features': [ 'cmd-feat1', 'cmd-feat2' ] }
|
2017-03-20 21:11:54 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @cmd-boxed:
|
|
|
|
# If you're bored enough to read this, go see a video of boxed cats
|
2019-10-18 16:14:53 +08:00
|
|
|
# Features:
|
|
|
|
# @cmd-feat1: a feature
|
|
|
|
# @cmd-feat2: another feature
|
2017-03-20 21:11:54 +08:00
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> in
|
|
|
|
#
|
|
|
|
# <- out
|
|
|
|
##
|
|
|
|
{ 'command': 'cmd-boxed', 'boxed': true,
|
2019-10-18 16:14:53 +08:00
|
|
|
'data': 'Object',
|
|
|
|
'features': [ 'cmd-feat1', 'cmd-feat2' ] }
|
2019-10-24 19:02:20 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @EVT-BOXED:
|
2020-03-17 19:54:37 +08:00
|
|
|
# Features:
|
|
|
|
# @feat3: a feature
|
2019-10-24 19:02:20 +08:00
|
|
|
##
|
|
|
|
{ 'event': 'EVT-BOXED', 'boxed': true,
|
2020-03-17 19:54:37 +08:00
|
|
|
'features': [ 'feat3' ],
|
2019-10-24 19:02:20 +08:00
|
|
|
'data': 'Object' }
|