hw/core/loader: Add new function rom_ptr_for_as()
[qemu/ar7.git] / include / qapi / qobject-input-visitor.h
blob8d693888105473397f6f9aa4e5d92251aeb9983d
1 /*
2 * Input Visitor
4 * Copyright (C) 2017 Red Hat, Inc.
5 * Copyright IBM, Corp. 2011
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
10 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
11 * See the COPYING.LIB file in the top-level directory.
15 #ifndef QOBJECT_INPUT_VISITOR_H
16 #define QOBJECT_INPUT_VISITOR_H
18 #include "qapi/qapi-types-compat.h"
19 #include "qapi/visitor.h"
21 typedef struct QObjectInputVisitor QObjectInputVisitor;
24 * Create a QObject input visitor for @obj
26 * A QObject input visitor visit builds a QAPI object from a QObject.
27 * This simultaneously walks the QAPI object being built and the
28 * QObject. The latter walk starts at @obj.
30 * visit_type_FOO() creates an instance of QAPI type FOO. The visited
31 * QObject must match FOO. QDict matches struct/union types, QList
32 * matches list types, QString matches type 'str' and enumeration
33 * types, QNum matches integer and float types, QBool matches type
34 * 'bool'. Type 'any' is matched by QObject. A QAPI alternate type
35 * is matched when one of its member types is.
37 * visit_start_struct() ... visit_end_struct() visits a QDict and
38 * creates a QAPI struct/union. Visits in between visit the
39 * dictionary members. visit_optional() is true when the QDict has
40 * this member. visit_check_struct() fails if unvisited members
41 * remain.
43 * visit_start_list() ... visit_end_list() visits a QList and creates
44 * a QAPI list. Visits in between visit list members, one after the
45 * other. visit_next_list() returns NULL when all QList members have
46 * been visited. visit_check_list() fails if unvisited members
47 * remain.
49 * visit_start_alternate() ... visit_end_alternate() visits a QObject
50 * and creates a QAPI alternate. The visit in between visits the same
51 * QObject and initializes the alternate member that is in use.
53 * Error messages refer to parts of @obj in JavaScript/Python syntax.
54 * For example, 'a.b[2]' refers to the second member of the QList
55 * member 'b' of the QDict member 'a' of QDict @obj.
57 * The caller is responsible for freeing the visitor with
58 * visit_free().
60 Visitor *qobject_input_visitor_new(QObject *obj);
62 void qobject_input_visitor_set_policy(Visitor *v,
63 CompatPolicyInput deprecated);
66 * Create a QObject input visitor for @obj for use with keyval_parse()
68 * This is like qobject_input_visitor_new(), except scalars are all
69 * QString, and error messages refer to parts of @obj in the syntax
70 * keyval_parse() uses for KEYs.
72 Visitor *qobject_input_visitor_new_keyval(QObject *obj);
75 * Create a QObject input visitor for parsing @str.
77 * If @str looks like JSON, parse it as JSON, else as KEY=VALUE,...
78 * @implied_key applies to KEY=VALUE, and works as in keyval_parse().
79 * On failure, store an error through @errp and return NULL.
80 * On success, return a new QObject input visitor for the parse.
82 Visitor *qobject_input_visitor_new_str(const char *str,
83 const char *implied_key,
84 Error **errp);
86 #endif