mirror of
https://github.com/qemu/qemu.git
synced 2025-08-11 06:18:15 +00:00
docs/qapidoc: add visit_entity()
Finally, the core entry method for a qapi entity. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250311034303.75779-54-jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
8cb0a41490
commit
c05de7235a
@ -78,6 +78,8 @@
|
|||||||
|
|
||||||
|
|
||||||
class Transmogrifier:
|
class Transmogrifier:
|
||||||
|
# pylint: disable=too-many-public-methods
|
||||||
|
|
||||||
# Field names used for different entity types:
|
# Field names used for different entity types:
|
||||||
field_types = {
|
field_types = {
|
||||||
"enum": "value",
|
"enum": "value",
|
||||||
@ -362,6 +364,25 @@ def visit_freeform(self, doc: QAPIDoc) -> None:
|
|||||||
self.add_lines(text, info)
|
self.add_lines(text, info)
|
||||||
self.ensure_blank_line()
|
self.ensure_blank_line()
|
||||||
|
|
||||||
|
def visit_entity(self, ent: QAPISchemaDefinition) -> None:
|
||||||
|
assert ent.info
|
||||||
|
|
||||||
|
try:
|
||||||
|
self._curr_ent = ent
|
||||||
|
|
||||||
|
# Squish structs and unions together into an "object" directive.
|
||||||
|
meta = ent.meta
|
||||||
|
if meta in ("struct", "union"):
|
||||||
|
meta = "object"
|
||||||
|
|
||||||
|
# This line gets credited to the start of the /definition/.
|
||||||
|
self.add_line(f".. qapi:{meta}:: {ent.name}", ent.info)
|
||||||
|
with self.indented():
|
||||||
|
self.preamble(ent)
|
||||||
|
self.visit_sections(ent)
|
||||||
|
finally:
|
||||||
|
self._curr_ent = None
|
||||||
|
|
||||||
|
|
||||||
class QAPISchemaGenDepVisitor(QAPISchemaVisitor):
|
class QAPISchemaGenDepVisitor(QAPISchemaVisitor):
|
||||||
"""A QAPI schema visitor which adds Sphinx dependencies each module
|
"""A QAPI schema visitor which adds Sphinx dependencies each module
|
||||||
|
Loading…
Reference in New Issue
Block a user