1
2
3
4
5
6
7
8
9
10
11
12#include "qemu/osdep.h"
13#include "qapi/error.h"
14#include "qemu-common.h"
15#include "qom/object.h"
16#include "qom/qom-qobject.h"
17#include "qapi/visitor.h"
18#include "qapi/qobject-input-visitor.h"
19#include "qapi/qobject-output-visitor.h"
20
21void object_property_set_qobject(Object *obj, QObject *value,
22 const char *name, Error **errp)
23{
24 Visitor *v;
25
26 v = qobject_input_visitor_new(value);
27 object_property_set(obj, v, name, errp);
28 visit_free(v);
29}
30
31QObject *object_property_get_qobject(Object *obj, const char *name,
32 Error **errp)
33{
34 QObject *ret = NULL;
35 Error *local_err = NULL;
36 Visitor *v;
37
38 v = qobject_output_visitor_new(&ret);
39 object_property_get(obj, v, name, &local_err);
40 if (!local_err) {
41 visit_complete(v, &ret);
42 }
43 error_propagate(errp, local_err);
44 visit_free(v);
45 return ret;
46}
47