]>
Commit | Line | Data |
---|---|---|
9f5f1350 PB |
1 | /* |
2 | * QEMU Object Model - QObject wrappers | |
3 | * | |
4 | * Copyright (C) 2012 Red Hat, Inc. | |
5 | * | |
6 | * Author: Paolo Bonzini <pbonzini@redhat.com> | |
7 | * | |
8 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
9 | * See the COPYING file in the top-level directory. | |
10 | */ | |
11 | ||
9bbc853b | 12 | #include "qemu/osdep.h" |
da34e65c | 13 | #include "qapi/error.h" |
14cccb61 PB |
14 | #include "qom/object.h" |
15 | #include "qom/qom-qobject.h" | |
7b1b5d19 | 16 | #include "qapi/visitor.h" |
b3db211f DB |
17 | #include "qapi/qobject-input-visitor.h" |
18 | #include "qapi/qobject-output-visitor.h" | |
9f5f1350 PB |
19 | |
20 | void object_property_set_qobject(Object *obj, QObject *value, | |
21 | const char *name, Error **errp) | |
22 | { | |
b70ce101 | 23 | Visitor *v; |
05601ed2 | 24 | |
048abb7b | 25 | v = qobject_input_visitor_new(value); |
b70ce101 EB |
26 | object_property_set(obj, v, name, errp); |
27 | visit_free(v); | |
9f5f1350 PB |
28 | } |
29 | ||
30 | QObject *object_property_get_qobject(Object *obj, const char *name, | |
31 | Error **errp) | |
32 | { | |
33 | QObject *ret = NULL; | |
34 | Error *local_err = NULL; | |
3b098d56 | 35 | Visitor *v; |
9f5f1350 | 36 | |
7d5e199a | 37 | v = qobject_output_visitor_new(&ret); |
3b098d56 | 38 | object_property_get(obj, v, name, &local_err); |
9f5f1350 | 39 | if (!local_err) { |
3b098d56 | 40 | visit_complete(v, &ret); |
9f5f1350 PB |
41 | } |
42 | error_propagate(errp, local_err); | |
3b098d56 | 43 | visit_free(v); |
9f5f1350 PB |
44 | return ret; |
45 | } |