open -> new rename fallout
[qemu/aliguori.git] / qapi / qapi-visit-core.c
blobddef3eda124fbc2144790cb2a342c4f3cb6ea014
1 /*
2 * Core Definitions for QAPI Visitor Classes
4 * Copyright IBM, Corp. 2011
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
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.
14 #include "qapi/qapi-visit-core.h"
16 void visit_start_handle(Visitor *v, void **obj, const char *kind,
17 const char *name, Error **errp)
19 if (!error_is_set(errp) && v->start_handle) {
20 v->start_handle(v, obj, kind, name, errp);
24 void visit_end_handle(Visitor *v, Error **errp)
26 if (!error_is_set(errp) && v->end_handle) {
27 v->end_handle(v, errp);
31 void visit_start_struct(Visitor *v, void **obj, const char *kind,
32 const char *name, size_t size, Error **errp)
34 if (!error_is_set(errp)) {
35 v->start_struct(v, obj, kind, name, size, errp);
39 void visit_end_struct(Visitor *v, Error **errp)
41 if (!error_is_set(errp)) {
42 v->end_struct(v, errp);
46 void visit_start_list(Visitor *v, const char *name, Error **errp)
48 if (!error_is_set(errp)) {
49 v->start_list(v, name, errp);
53 GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)
55 if (!error_is_set(errp)) {
56 return v->next_list(v, list, errp);
59 return 0;
62 void visit_end_list(Visitor *v, Error **errp)
64 if (!error_is_set(errp)) {
65 v->end_list(v, errp);
69 void visit_start_optional(Visitor *v, bool *present, const char *name,
70 Error **errp)
72 if (!error_is_set(errp) && v->start_optional) {
73 v->start_optional(v, present, name, errp);
77 void visit_end_optional(Visitor *v, Error **errp)
79 if (!error_is_set(errp) && v->end_optional) {
80 v->end_optional(v, errp);
84 void visit_type_enum(Visitor *v, int *obj, const char *strings[],
85 const char *kind, const char *name, Error **errp)
87 if (!error_is_set(errp)) {
88 v->type_enum(v, obj, strings, kind, name, errp);
92 void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
94 if (!error_is_set(errp)) {
95 v->type_int(v, obj, name, errp);
99 void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
101 if (!error_is_set(errp)) {
102 v->type_bool(v, obj, name, errp);
106 void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
108 if (!error_is_set(errp)) {
109 v->type_str(v, obj, name, errp);
113 void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
115 if (!error_is_set(errp)) {
116 v->type_number(v, obj, name, errp);