mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-15 14:13:31 -06:00
docs/qapi-domain: add qapi:event directive
Adds the .. qapi:event:: directive, object, and :qapi:event:`name` cross-referencing role. Adds the :memb type name: field list syntax for documenting event data members. As this syntax and phrasing will be shared with Structs and Unions as well, add the field list definition to a shared abstract class. As per usual, QAPI cross-referencing for types in the member field list will be added in a forthcoming commit. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250311034303.75779-22-jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
bac3f1313c
commit
6d5f6f69ca
1 changed files with 24 additions and 0 deletions
|
@ -346,6 +346,27 @@ class QAPIAlternate(QAPIObject):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class QAPIObjectWithMembers(QAPIObject):
|
||||||
|
"""Base class for Events/Structs/Unions"""
|
||||||
|
|
||||||
|
doc_field_types = QAPIObject.doc_field_types.copy()
|
||||||
|
doc_field_types.extend(
|
||||||
|
[
|
||||||
|
# :member type name: descr
|
||||||
|
TypedField(
|
||||||
|
"member",
|
||||||
|
label=_("Members"),
|
||||||
|
names=("memb",),
|
||||||
|
can_collapse=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class QAPIEvent(QAPIObjectWithMembers):
|
||||||
|
"""Description of a QAPI Event."""
|
||||||
|
|
||||||
|
|
||||||
class QAPIModule(QAPIDescription):
|
class QAPIModule(QAPIDescription):
|
||||||
"""
|
"""
|
||||||
Directive to mark description of a new module.
|
Directive to mark description of a new module.
|
||||||
|
@ -472,6 +493,7 @@ class QAPIDomain(Domain):
|
||||||
object_types: Dict[str, ObjType] = {
|
object_types: Dict[str, ObjType] = {
|
||||||
"module": ObjType(_("module"), "mod", "any"),
|
"module": ObjType(_("module"), "mod", "any"),
|
||||||
"command": ObjType(_("command"), "cmd", "any"),
|
"command": ObjType(_("command"), "cmd", "any"),
|
||||||
|
"event": ObjType(_("event"), "event", "any"),
|
||||||
"enum": ObjType(_("enum"), "enum", "type", "any"),
|
"enum": ObjType(_("enum"), "enum", "type", "any"),
|
||||||
"alternate": ObjType(_("alternate"), "alt", "type", "any"),
|
"alternate": ObjType(_("alternate"), "alt", "type", "any"),
|
||||||
}
|
}
|
||||||
|
@ -481,6 +503,7 @@ class QAPIDomain(Domain):
|
||||||
directives = {
|
directives = {
|
||||||
"module": QAPIModule,
|
"module": QAPIModule,
|
||||||
"command": QAPICommand,
|
"command": QAPICommand,
|
||||||
|
"event": QAPIEvent,
|
||||||
"enum": QAPIEnum,
|
"enum": QAPIEnum,
|
||||||
"alternate": QAPIAlternate,
|
"alternate": QAPIAlternate,
|
||||||
}
|
}
|
||||||
|
@ -491,6 +514,7 @@ class QAPIDomain(Domain):
|
||||||
roles = {
|
roles = {
|
||||||
"mod": QAPIXRefRole(),
|
"mod": QAPIXRefRole(),
|
||||||
"cmd": QAPIXRefRole(),
|
"cmd": QAPIXRefRole(),
|
||||||
|
"event": QAPIXRefRole(),
|
||||||
"enum": QAPIXRefRole(),
|
"enum": QAPIXRefRole(),
|
||||||
"alt": QAPIXRefRole(),
|
"alt": QAPIXRefRole(),
|
||||||
# reference any data type (excludes modules, commands, events)
|
# reference any data type (excludes modules, commands, events)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue