[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 20/35] docs/qapi-domain: add qapi:event directive
From: |
John Snow |
Subject: |
[RFC PATCH v2 20/35] docs/qapi-domain: add qapi:event directive |
Date: |
Thu, 12 Dec 2024 20:12:49 -0500 |
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>
---
docs/sphinx/qapi-domain.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/docs/sphinx/qapi-domain.py b/docs/sphinx/qapi-domain.py
index e0c31b2ee4d..e042421016f 100644
--- a/docs/sphinx/qapi-domain.py
+++ b/docs/sphinx/qapi-domain.py
@@ -321,6 +321,29 @@ 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."""
+
+ pass
+
+
class QAPIModule(SphinxDirective):
"""
Directive to mark description of a new module.
@@ -481,6 +504,7 @@ class QAPIDomain(Domain):
object_types: Dict[str, ObjType] = {
"module": ObjType(_("module"), "mod", "obj"),
"command": ObjType(_("command"), "cmd", "obj"),
+ "event": ObjType(_("event"), "event", "obj"),
"enum": ObjType(_("enum"), "enum", "obj", "type"),
"alternate": ObjType(_("alternate"), "alt", "obj", "type"),
}
@@ -490,6 +514,7 @@ class QAPIDomain(Domain):
directives = {
"module": QAPIModule,
"command": QAPICommand,
+ "event": QAPIEvent,
"enum": QAPIEnum,
"alternate": QAPIAlternate,
}
@@ -500,6 +525,7 @@ class QAPIDomain(Domain):
roles = {
"mod": QAPIXRefRole(),
"cmd": QAPIXRefRole(),
+ "event": QAPIXRefRole(),
"enum": QAPIXRefRole(),
"alt": QAPIXRefRole(),
# reference any data type (excludes modules, commands, events)
--
2.47.0
- [RFC PATCH v2 10/35] docs/qapi-domain: add compatibility node classes, (continued)
- [RFC PATCH v2 10/35] docs/qapi-domain: add compatibility node classes, John Snow, 2024/12/12
- [RFC PATCH v2 11/35] docs/qapi-domain: add qapi:command directive, John Snow, 2024/12/12
- [RFC PATCH v2 12/35] docs/qapi-domain: add :since: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 13/35] docs/qapi-domain: add "Arguments:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 14/35] docs/qapi-domain: add "Features:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 15/35] docs/qapi-domain: add "Errors:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 16/35] docs/qapi-domain: add "Returns:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 17/35] docs/qapi-domain: add returns-nodesc, John Snow, 2024/12/12
- [RFC PATCH v2 19/35] docs/qapi-domain: add qapi:alternate directive, John Snow, 2024/12/12
- [RFC PATCH v2 18/35] docs/qapi-domain: add qapi:enum directive, John Snow, 2024/12/12
- [RFC PATCH v2 20/35] docs/qapi-domain: add qapi:event directive,
John Snow <=
- [RFC PATCH v2 22/35] docs/qapi-domain: add qapi:union and qapi:branch directives, John Snow, 2024/12/12
- [RFC PATCH v2 23/35] docs/qapi-domain: add :deprecated: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 24/35] docs/qapi-domain: add :unstable: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 26/35] docs/qapi-domain: add warnings for malformed field lists, John Snow, 2024/12/12
- [RFC PATCH v2 27/35] docs/qapi-domain: add type cross-refs to field lists, John Snow, 2024/12/12
- [RFC PATCH v2 25/35] docs/qapi-domain: add :ifcond: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 30/35] docs/qapi-domain: implement error context reporting fix, John Snow, 2024/12/12
- [RFC PATCH v2 28/35] docs/qapi-domain: add CSS styling, John Snow, 2024/12/12
- [RFC PATCH v2 29/35] docs/qapi-domain: warn when QAPI domain xrefs fail to resolve, John Snow, 2024/12/12
- [RFC PATCH v2 31/35] docs/qapi-domain: collapsible branches, John Snow, 2024/12/12