diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2017-03-06 10:18:33 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2017-03-06 10:18:33 +0000 |
| commit | fbddc2e5608eb655493253d080598375db61a748 (patch) | |
| tree | 9cf6963dda739b319ac1aa31cd433e69bbd959e9 /include/qapi/qobject-input-visitor.h | |
| parent | 17783ac828adc694d986698d2d7014aedfeb48c6 (diff) | |
| parent | aa3a982e674b09ae32502940f93ba98b3a8ad50e (diff) | |
| download | focaccia-qemu-fbddc2e5608eb655493253d080598375db61a748.tar.gz focaccia-qemu-fbddc2e5608eb655493253d080598375db61a748.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-02-28' into staging
QAPI patches for 2017-02-28 # gpg: Signature made Sun 05 Mar 2017 08:21:51 GMT # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2017-02-28: (27 commits) qapi: Improve qobject visitor documentation qapi: Fix object input visit beyond end of list tests: Cover input visit beyond end of list qapi: Make input visitors detect unvisited list tails test-qobject-input-visitor: Cover missing nested struct member tests: Cover partial input visit of list test-string-input-visitor: Improve list coverage test-string-input-visitor: Tear down existing test automatically tests-qobject-input-strict: Merge into test-qobject-input-visitor qapi: Drop unused non-strict qobject input visitor test-qobject-input-visitor: Use strict visitor qom: Make object_property_set_qobject()'s input visitor strict qapi: Make string input and opts visitor require non-null input qapi: Drop string input visitor method optional() qapi: Improve qobject input visitor error reporting qapi: Make QObject input visitor set *list reliably qapi: Clean up after commit 3d344c2 qapi: Improve a QObject input visitor error message qmp: Eliminate silly QERR_QMP_* macros qmp: Drop duplicated QMP command object checks ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qapi/qobject-input-visitor.h')
| -rw-r--r-- | include/qapi/qobject-input-visitor.h | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/include/qapi/qobject-input-visitor.h b/include/qapi/qobject-input-visitor.h index cde328da9f..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,11 +21,42 @@ typedef struct QObjectInputVisitor QObjectInputVisitor; /* - * Return a new input visitor that converts a QObject to a QAPI object. + * Create a QObject input visitor for @obj * - * Set @strict to reject a parse that doesn't consume all keys of a - * dictionary; otherwise excess input is ignored. + * 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, bool strict); +Visitor *qobject_input_visitor_new(QObject *obj); #endif |