]>
Commit | Line | Data |
---|---|---|
e4e6aa14 MR |
1 | /* |
2 | * Output Visitor | |
3 | * | |
4 | * Copyright IBM, Corp. 2011 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <[email protected]> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. | |
10 | * See the COPYING.LIB file in the top-level directory. | |
11 | * | |
12 | */ | |
13 | ||
b3db211f DB |
14 | #ifndef QOBJECT_OUTPUT_VISITOR_H |
15 | #define QOBJECT_OUTPUT_VISITOR_H | |
e4e6aa14 | 16 | |
7b1b5d19 | 17 | #include "qapi/visitor.h" |
e4e6aa14 | 18 | |
7d5e199a | 19 | typedef struct QObjectOutputVisitor QObjectOutputVisitor; |
e4e6aa14 | 20 | |
aa3a982e MA |
21 | /** |
22 | * Create a QObject output visitor for @obj | |
23 | * | |
24 | * A QObject output visitor visit builds a QObject from QAPI Object. | |
25 | * This simultaneously walks the QAPI object and the QObject being | |
26 | * built. The latter walk starts at @obj. | |
27 | * | |
28 | * visit_type_FOO() creates a QObject for QAPI type FOO. It creates a | |
29 | * QDict for struct/union types, a QList for list types, QString for | |
01b2ffce MAL |
30 | * type 'str' and enumeration types, QNum for integer and float |
31 | * types, QBool for type 'bool'. For type 'any', it increments the | |
32 | * QObject's reference count. For QAPI alternate types, it creates | |
33 | * the QObject for the member that is in use. | |
aa3a982e MA |
34 | * |
35 | * visit_start_struct() ... visit_end_struct() visits a QAPI | |
36 | * struct/union and creates a QDict. Visits in between visit the | |
37 | * members. visit_optional() is true when the struct/union has this | |
38 | * member. visit_check_struct() does nothing. | |
39 | * | |
40 | * visit_start_list() ... visit_end_list() visits a QAPI list and | |
41 | * creates a QList. Visits in between visit list members, one after | |
42 | * the other. visit_next_list() returns NULL when all QAPI list | |
43 | * members have been visited. visit_check_list() does nothing. | |
44 | * | |
45 | * visit_start_alternate() ... visit_end_alternate() visits a QAPI | |
46 | * alternate. The visit in between creates the QObject for the | |
47 | * alternate member that is in use. | |
48 | * | |
49 | * Errors are not expected to happen. | |
3b098d56 | 50 | * |
aa3a982e MA |
51 | * The caller is responsible for freeing the visitor with |
52 | * visit_free(). | |
3b098d56 | 53 | */ |
7d5e199a | 54 | Visitor *qobject_output_visitor_new(QObject **result); |
e4e6aa14 MR |
55 | |
56 | #endif |