summaryrefslogtreecommitdiff
path: root/include/qapi/qobject-input-visitor.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:48 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:14:20 +0100
commitaa3a982e674b09ae32502940f93ba98b3a8ad50e (patch)
tree9cf6963dda739b319ac1aa31cd433e69bbd959e9 /include/qapi/qobject-input-visitor.h
parent1f41a645b65530859bf5984aa08e103bb452b473 (diff)
downloadqemu-aa3a982e674b09ae32502940f93ba98b3a8ad50e.tar.gz
qapi: Improve qobject visitor documentation
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-29-git-send-email-armbru@redhat.com>
Diffstat (limited to 'include/qapi/qobject-input-visitor.h')
-rw-r--r--include/qapi/qobject-input-visitor.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/qapi/qobject-input-visitor.h b/include/qapi/qobject-input-visitor.h
index 21db9c4b4a..0b7633a38f 100644
--- a/include/qapi/qobject-input-visitor.h
+++ b/include/qapi/qobject-input-visitor.h
@@ -1,6 +1,7 @@
/*
* Input Visitor
*
+ * Copyright (C) 2017 Red Hat, Inc.
* Copyright IBM, Corp. 2011
*
* Authors:
@@ -20,7 +21,41 @@
typedef struct QObjectInputVisitor QObjectInputVisitor;
/*
- * Return a new input visitor that converts a QObject to a QAPI object.
+ * Create a QObject input visitor for @obj
+ *
+ * A QObject input visitor visit builds a QAPI object from a QObject.
+ * This simultaneously walks the QAPI object being built and the
+ * QObject. The latter walk starts at @obj.
+ *
+ * visit_type_FOO() creates an instance of QAPI type FOO. The visited
+ * QObject must match FOO. QDict matches struct/union types, QList
+ * matches list types, QString matches type 'str' and enumeration
+ * types, QInt matches integer types, QFloat matches type 'number',
+ * QBool matches type 'bool'. Type 'any' is matched by QObject. A
+ * QAPI alternate type is matched when one of its member types is.
+ *
+ * visit_start_struct() ... visit_end_struct() visits a QDict and
+ * creates a QAPI struct/union. Visits in between visit the
+ * dictionary members. visit_optional() is true when the QDict has
+ * this member. visit_check_struct() fails if unvisited members
+ * remain.
+ *
+ * visit_start_list() ... visit_end_list() visits a QList and creates
+ * a QAPI list. Visits in between visit list members, one after the
+ * other. visit_next_list() returns NULL when all QList members have
+ * been visited. visit_check_list() fails if unvisited members
+ * remain.
+ *
+ * visit_start_alternate() ... visit_end_alternate() visits a QObject
+ * and creates a QAPI alternate. The visit in between visits the same
+ * QObject and initializes the alternate member that is in use.
+ *
+ * Error messages refer to parts of @obj in JavaScript/Python syntax.
+ * For example, 'a.b[2]' refers to the second member of the QList
+ * member 'b' of the QDict member 'a' of QDict @obj.
+ *
+ * The caller is responsible for freeing the visitor with
+ * visit_free().
*/
Visitor *qobject_input_visitor_new(QObject *obj);