diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-09 09:52:59 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-22 08:31:24 +0100 |
commit | b2cd7dee86f27b6307b4bd411133bfb6ebc2be66 (patch) | |
tree | a922c847aa76bf0c9af162fec05e0e764e78cc45 /include | |
parent | 2d7799f2cccc54a71268d357403848fb4c48206c (diff) | |
download | qemu-b2cd7dee86f27b6307b4bd411133bfb6ebc2be66.tar.gz qemu-b2cd7dee86f27b6307b4bd411133bfb6ebc2be66.tar.bz2 qemu-b2cd7dee86f27b6307b4bd411133bfb6ebc2be66.zip |
qom: add generic string parsing/printing
Add generic property accessors that take a string and parse it
appropriately for the property type. All the magic here is done
by the new string-based visitors.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/object.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/qemu/object.h b/include/qemu/object.h index 5179c0cf5a..ff6be14dfc 100644 --- a/include/qemu/object.h +++ b/include/qemu/object.h @@ -730,6 +730,30 @@ void object_property_set(Object *obj, struct Visitor *v, const char *name, struct Error **errp); /** + * object_property_parse: + * @obj: the object + * @string: the string that will be used to parse the property value. + * @name: the name of the property + * @errp: returns an error if this function fails + * + * Parses a string and writes the result into a property of an object. + */ +void object_property_parse(Object *obj, const char *string, + const char *name, struct Error **errp); + +/** + * object_property_print: + * @obj: the object + * @name: the name of the property + * @errp: returns an error if this function fails + * + * Returns a string representation of the value of the property. The + * caller shall free the string. + */ +char *object_property_print(Object *obj, const char *name, + struct Error **errp); + +/** * object_property_get_type: * @obj: the object * @name: the name of the property |