|
@@ -25,19 +25,21 @@
|
|
* for doing work at each node of a QAPI graph; it can also be used
|
|
* for doing work at each node of a QAPI graph; it can also be used
|
|
* for a virtual walk, where there is no actual QAPI C struct.
|
|
* for a virtual walk, where there is no actual QAPI C struct.
|
|
*
|
|
*
|
|
- * There are four kinds of visitor classes: input visitors (QObject,
|
|
|
|
- * string, and QemuOpts) parse an external representation and build
|
|
|
|
- * the corresponding QAPI graph, output visitors (QObject and string) take
|
|
|
|
- * a completed QAPI graph and generate an external representation, the
|
|
|
|
- * dealloc visitor can take a QAPI graph (possibly partially
|
|
|
|
- * constructed) and recursively free its resources, and the clone
|
|
|
|
- * visitor performs a deep clone of one QAPI object to another. While
|
|
|
|
- * the dealloc and QObject input/output visitors are general, the string,
|
|
|
|
- * QemuOpts, and clone visitors have some implementation limitations;
|
|
|
|
- * see the documentation for each visitor for more details on what it
|
|
|
|
- * supports. Also, see visitor-impl.h for the callback contracts
|
|
|
|
- * implemented by each visitor, and docs/devel/qapi-code-gen.txt for more
|
|
|
|
- * about the QAPI code generator.
|
|
|
|
|
|
+ * There are four kinds of visitors: input visitors (QObject, string,
|
|
|
|
+ * and QemuOpts) parse an external representation and build the
|
|
|
|
+ * corresponding QAPI object, output visitors (QObject and string)
|
|
|
|
+ * take a QAPI object and generate an external representation, the
|
|
|
|
+ * dealloc visitor takes a QAPI object (possibly partially
|
|
|
|
+ * constructed) and recursively frees it, and the clone visitor
|
|
|
|
+ * performs a deep clone of a QAPI object.
|
|
|
|
+ *
|
|
|
|
+ * While the dealloc and QObject input/output visitors are general,
|
|
|
|
+ * the string, QemuOpts, and clone visitors have some implementation
|
|
|
|
+ * limitations; see the documentation for each visitor for more
|
|
|
|
+ * details on what it supports. Also, see visitor-impl.h for the
|
|
|
|
+ * callback contracts implemented by each visitor, and
|
|
|
|
+ * docs/devel/qapi-code-gen.txt for more about the QAPI code
|
|
|
|
+ * generator.
|
|
*
|
|
*
|
|
* All of the visitors are created via:
|
|
* All of the visitors are created via:
|
|
*
|
|
*
|
|
@@ -45,11 +47,15 @@
|
|
*
|
|
*
|
|
* A visitor should be used for exactly one top-level visit_type_FOO()
|
|
* A visitor should be used for exactly one top-level visit_type_FOO()
|
|
* or virtual walk; if that is successful, the caller can optionally
|
|
* or virtual walk; if that is successful, the caller can optionally
|
|
- * call visit_complete() (for now, useful only for output visits, but
|
|
|
|
- * safe to call on all visits). Then, regardless of success or
|
|
|
|
- * failure, the user should call visit_free() to clean up resources.
|
|
|
|
- * It is okay to free the visitor without completing the visit, if
|
|
|
|
- * some other error is detected in the meantime.
|
|
|
|
|
|
+ * call visit_complete() (useful only for output visits, but safe to
|
|
|
|
+ * call on all visits). Then, regardless of success or failure, the
|
|
|
|
+ * user should call visit_free() to clean up resources. It is okay to
|
|
|
|
+ * free the visitor without completing the visit, if some other error
|
|
|
|
+ * is detected in the meantime.
|
|
|
|
+ *
|
|
|
|
+ * The clone and dealloc visitor should not be used directly outside
|
|
|
|
+ * of QAPI code. Use the qapi_free_FOO() and QAPI_CLONE() instead,
|
|
|
|
+ * described below.
|
|
*
|
|
*
|
|
* All QAPI types have a corresponding function with a signature
|
|
* All QAPI types have a corresponding function with a signature
|
|
* roughly compatible with this:
|
|
* roughly compatible with this:
|
|
@@ -58,7 +64,7 @@
|
|
*
|
|
*
|
|
* where T is FOO for scalar types, and FOO * otherwise. The scalar
|
|
* where T is FOO for scalar types, and FOO * otherwise. The scalar
|
|
* visitors are declared here; the remaining visitors are generated in
|
|
* visitors are declared here; the remaining visitors are generated in
|
|
- * qapi-visit.h.
|
|
|
|
|
|
+ * qapi-visit-MODULE.h.
|
|
*
|
|
*
|
|
* The @name parameter of visit_type_FOO() describes the relation
|
|
* The @name parameter of visit_type_FOO() describes the relation
|
|
* between this QAPI value and its parent container. When visiting
|
|
* between this QAPI value and its parent container. When visiting
|
|
@@ -68,55 +74,56 @@
|
|
* alternate, @name should equal the name used for visiting the
|
|
* alternate, @name should equal the name used for visiting the
|
|
* alternate.
|
|
* alternate.
|
|
*
|
|
*
|
|
- * The visit_type_FOO() functions expect a non-null @obj argument;
|
|
|
|
- * they allocate *@obj during input visits, leave it unchanged on
|
|
|
|
- * output visits, and recursively free any resources during a dealloc
|
|
|
|
- * visit. Each function also takes the customary @errp argument (see
|
|
|
|
|
|
+ * The visit_type_FOO() functions take a non-null @obj argument; they
|
|
|
|
+ * allocate *@obj during input visits, leave it unchanged during
|
|
|
|
+ * output and clone visits, and free it (recursively) during a dealloc
|
|
|
|
+ * visit.
|
|
|
|
+ *
|
|
|
|
+ * Each function also takes the customary @errp argument (see
|
|
* qapi/error.h for details), for reporting any errors (such as if a
|
|
* qapi/error.h for details), for reporting any errors (such as if a
|
|
* member @name is not present, or is present but not the specified
|
|
* member @name is not present, or is present but not the specified
|
|
- * type).
|
|
|
|
|
|
+ * type). Only input visitors can fail.
|
|
*
|
|
*
|
|
* If an error is detected during visit_type_FOO() with an input
|
|
* If an error is detected during visit_type_FOO() with an input
|
|
- * visitor, then *@obj will be NULL for pointer types, and left
|
|
|
|
- * unchanged for scalar types. Using an output or clone visitor with
|
|
|
|
- * an incomplete object has undefined behavior (other than a special
|
|
|
|
- * case for visit_type_str() treating NULL like ""), while the dealloc
|
|
|
|
- * visitor safely handles incomplete objects. Since input visitors
|
|
|
|
- * never produce an incomplete object, such an object is possible only
|
|
|
|
- * by manual construction.
|
|
|
|
|
|
+ * visitor, then *@obj will be set to NULL for pointer types, and left
|
|
|
|
+ * unchanged for scalar types.
|
|
|
|
+ *
|
|
|
|
+ * Using an output or clone visitor with an incomplete object has
|
|
|
|
+ * undefined behavior (other than a special case for visit_type_str()
|
|
|
|
+ * treating NULL like ""), while the dealloc visitor safely handles
|
|
|
|
+ * incomplete objects. Since input visitors never produce an
|
|
|
|
+ * incomplete object, such an object is possible only by manual
|
|
|
|
+ * construction.
|
|
*
|
|
*
|
|
* For the QAPI object types (structs, unions, and alternates), there
|
|
* For the QAPI object types (structs, unions, and alternates), there
|
|
- * is an additional generated function in qapi-visit.h compatible
|
|
|
|
- * with:
|
|
|
|
|
|
+ * is an additional generated function in qapi-visit-MODULE.h
|
|
|
|
+ * compatible with:
|
|
*
|
|
*
|
|
* void visit_type_FOO_members(Visitor *v, FOO *obj, Error **errp);
|
|
* void visit_type_FOO_members(Visitor *v, FOO *obj, Error **errp);
|
|
*
|
|
*
|
|
* for visiting the members of a type without also allocating the QAPI
|
|
* for visiting the members of a type without also allocating the QAPI
|
|
* struct.
|
|
* struct.
|
|
*
|
|
*
|
|
- * Additionally, in qapi-types.h, all QAPI pointer types (structs,
|
|
|
|
- * unions, alternates, and lists) have a generated function compatible
|
|
|
|
|
|
+ * Additionally, QAPI pointer types (structs, unions, alternates, and
|
|
|
|
+ * lists) have a generated function in qapi-types-MODULE.h compatible
|
|
* with:
|
|
* with:
|
|
*
|
|
*
|
|
* void qapi_free_FOO(FOO *obj);
|
|
* void qapi_free_FOO(FOO *obj);
|
|
*
|
|
*
|
|
- * where behaves like free() in that @obj may be NULL. Such objects
|
|
|
|
- * may also be used with the following macro, provided alongside the
|
|
|
|
- * clone visitor:
|
|
|
|
|
|
+ * Does nothing when @obj is NULL.
|
|
|
|
+ *
|
|
|
|
+ * Such objects may also be used with macro
|
|
*
|
|
*
|
|
* Type *QAPI_CLONE(Type, src);
|
|
* Type *QAPI_CLONE(Type, src);
|
|
*
|
|
*
|
|
- * in order to perform a deep clone of @src. Because of the generated
|
|
|
|
- * qapi_free functions and the QAPI_CLONE() macro, the clone and
|
|
|
|
- * dealloc visitor should not be used directly outside of QAPI code.
|
|
|
|
|
|
+ * in order to perform a deep clone of @src.
|
|
*
|
|
*
|
|
- * QAPI types can also inherit from a base class; when this happens, a
|
|
|
|
- * function is generated for easily going from the derived type to the
|
|
|
|
- * base type:
|
|
|
|
|
|
+ * For QAPI types can that inherit from a base type, a function is
|
|
|
|
+ * generated for going from the derived type to the base type:
|
|
*
|
|
*
|
|
* BASE *qapi_CHILD_base(CHILD *obj);
|
|
* BASE *qapi_CHILD_base(CHILD *obj);
|
|
*
|
|
*
|
|
- * For a real QAPI struct, typical input usage involves:
|
|
|
|
|
|
+ * Typical input visitor usage involves:
|
|
*
|
|
*
|
|
* <example>
|
|
* <example>
|
|
* Foo *f;
|
|
* Foo *f;
|
|
@@ -153,36 +160,22 @@
|
|
* qapi_free_FooList(l);
|
|
* qapi_free_FooList(l);
|
|
* </example>
|
|
* </example>
|
|
*
|
|
*
|
|
- * Similarly, typical output usage is:
|
|
|
|
|
|
+ * Typical output visitor usage:
|
|
*
|
|
*
|
|
* <example>
|
|
* <example>
|
|
* Foo *f = ...obtain populated object...
|
|
* Foo *f = ...obtain populated object...
|
|
- * Error *err = NULL;
|
|
|
|
* Visitor *v;
|
|
* Visitor *v;
|
|
* Type *result;
|
|
* Type *result;
|
|
*
|
|
*
|
|
* v = FOO_visitor_new(..., &result);
|
|
* v = FOO_visitor_new(..., &result);
|
|
- * visit_type_Foo(v, NULL, &f, &err);
|
|
|
|
- * if (err) {
|
|
|
|
- * ...handle error...
|
|
|
|
- * } else {
|
|
|
|
- * visit_complete(v, &result);
|
|
|
|
- * ...use result...
|
|
|
|
- * }
|
|
|
|
|
|
+ * visit_type_Foo(v, NULL, &f, &error_abort);
|
|
|
|
+ * visit_complete(v, &result);
|
|
* visit_free(v);
|
|
* visit_free(v);
|
|
|
|
+ * ...use result...
|
|
* </example>
|
|
* </example>
|
|
*
|
|
*
|
|
- * When visiting a real QAPI struct, this file provides several
|
|
|
|
- * helpers that rely on in-tree information to control the walk:
|
|
|
|
- * visit_optional() for the 'has_member' field associated with
|
|
|
|
- * optional 'member' in the C struct; and visit_next_list() for
|
|
|
|
- * advancing through a FooList linked list. Similarly, the
|
|
|
|
- * visit_is_input() helper makes it possible to write code that is
|
|
|
|
- * visitor-agnostic everywhere except for cleanup. Only the generated
|
|
|
|
- * visit_type functions need to use these helpers.
|
|
|
|
- *
|
|
|
|
* It is also possible to use the visitors to do a virtual walk, where
|
|
* It is also possible to use the visitors to do a virtual walk, where
|
|
- * no actual QAPI struct is present. In this situation, decisions
|
|
|
|
|
|
+ * no actual QAPI object is present. In this situation, decisions
|
|
* about what needs to be walked are made by the calling code, and
|
|
* about what needs to be walked are made by the calling code, and
|
|
* structured visits are split between pairs of start and end methods
|
|
* structured visits are split between pairs of start and end methods
|
|
* (where the end method must be called if the start function
|
|
* (where the end method must be called if the start function
|
|
@@ -215,6 +208,9 @@
|
|
* goto outlist;
|
|
* goto outlist;
|
|
* }
|
|
* }
|
|
* outlist:
|
|
* outlist:
|
|
|
|
+ * if (!err) {
|
|
|
|
+ * visit_check_list(v, &err);
|
|
|
|
+ * }
|
|
* visit_end_list(v, NULL);
|
|
* visit_end_list(v, NULL);
|
|
* if (!err) {
|
|
* if (!err) {
|
|
* visit_check_struct(v, &err);
|
|
* visit_check_struct(v, &err);
|
|
@@ -222,9 +218,14 @@
|
|
* outobj:
|
|
* outobj:
|
|
* visit_end_struct(v, NULL);
|
|
* visit_end_struct(v, NULL);
|
|
* out:
|
|
* out:
|
|
- * error_propagate(errp, err);
|
|
|
|
* visit_free(v);
|
|
* visit_free(v);
|
|
* </example>
|
|
* </example>
|
|
|
|
+ *
|
|
|
|
+ * This file provides helpers for use by the generated
|
|
|
|
+ * visit_type_FOO(): visit_optional() for the 'has_member' field
|
|
|
|
+ * associated with optional 'member' in the C struct,
|
|
|
|
+ * visit_next_list() for advancing through a FooList linked list, and
|
|
|
|
+ * visit_is_input() for cleaning up on failure.
|
|
*/
|
|
*/
|
|
|
|
|
|
/*** Useful types ***/
|
|
/*** Useful types ***/
|
|
@@ -282,9 +283,8 @@ void visit_free(Visitor *v);
|
|
* into *@obj. @obj may also be NULL for a virtual walk, in which
|
|
* into *@obj. @obj may also be NULL for a virtual walk, in which
|
|
* case @size is ignored.
|
|
* case @size is ignored.
|
|
*
|
|
*
|
|
- * @errp obeys typical error usage, and reports failures such as a
|
|
|
|
- * member @name is not present, or present but not an object. On
|
|
|
|
- * error, input visitors set *@obj to NULL.
|
|
|
|
|
|
+ * On failure, set *@obj to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
*
|
|
*
|
|
* After visit_start_struct() succeeds, the caller may visit its
|
|
* After visit_start_struct() succeeds, the caller may visit its
|
|
* members one after the other, passing the member's name and address
|
|
* members one after the other, passing the member's name and address
|
|
@@ -301,8 +301,8 @@ void visit_start_struct(Visitor *v, const char *name, void **obj,
|
|
/*
|
|
/*
|
|
* Prepare for completing an object visit.
|
|
* Prepare for completing an object visit.
|
|
*
|
|
*
|
|
- * @errp obeys typical error usage, and reports failures such as
|
|
|
|
- * unparsed keys remaining in the input stream.
|
|
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*
|
|
*
|
|
* Should be called prior to visit_end_struct() if all other
|
|
* Should be called prior to visit_end_struct() if all other
|
|
* intermediate visit steps were successful, to allow the visitor one
|
|
* intermediate visit steps were successful, to allow the visitor one
|
|
@@ -338,14 +338,13 @@ void visit_end_struct(Visitor *v, void **obj);
|
|
* allow @list to be NULL for a virtual walk, in which case @size is
|
|
* allow @list to be NULL for a virtual walk, in which case @size is
|
|
* ignored.
|
|
* ignored.
|
|
*
|
|
*
|
|
- * @errp obeys typical error usage, and reports failures such as a
|
|
|
|
- * member @name is not present, or present but not a list. On error,
|
|
|
|
- * input visitors set *@list to NULL.
|
|
|
|
|
|
+ * On failure, set *@list to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
*
|
|
*
|
|
* After visit_start_list() succeeds, the caller may visit its members
|
|
* After visit_start_list() succeeds, the caller may visit its members
|
|
- * one after the other. A real visit (where @obj is non-NULL) uses
|
|
|
|
|
|
+ * one after the other. A real visit (where @list is non-NULL) uses
|
|
* visit_next_list() for traversing the linked list, while a virtual
|
|
* visit_next_list() for traversing the linked list, while a virtual
|
|
- * visit (where @obj is NULL) uses other means. For each list
|
|
|
|
|
|
+ * visit (where @list is NULL) uses other means. For each list
|
|
* element, call the appropriate visit_type_FOO() with name set to
|
|
* element, call the appropriate visit_type_FOO() with name set to
|
|
* NULL and obj set to the address of the value member of the list
|
|
* NULL and obj set to the address of the value member of the list
|
|
* element. Finally, visit_end_list() needs to be called with the
|
|
* element. Finally, visit_end_list() needs to be called with the
|
|
@@ -374,8 +373,8 @@ GenericList *visit_next_list(Visitor *v, GenericList *tail, size_t size);
|
|
/*
|
|
/*
|
|
* Prepare for completing a list visit.
|
|
* Prepare for completing a list visit.
|
|
*
|
|
*
|
|
- * @errp obeys typical error usage, and reports failures such as
|
|
|
|
- * unvisited list tail remaining in the input stream.
|
|
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*
|
|
*
|
|
* Should be called prior to visit_end_list() if all other
|
|
* Should be called prior to visit_end_list() if all other
|
|
* intermediate visit steps were successful, to allow the visitor one
|
|
* intermediate visit steps were successful, to allow the visitor one
|
|
@@ -407,8 +406,11 @@ void visit_end_list(Visitor *v, void **list);
|
|
*
|
|
*
|
|
* @obj must not be NULL. Input and clone visitors use @size to
|
|
* @obj must not be NULL. Input and clone visitors use @size to
|
|
* determine how much memory to allocate into *@obj, then determine
|
|
* determine how much memory to allocate into *@obj, then determine
|
|
- * the qtype of the next thing to be visited, stored in (*@obj)->type.
|
|
|
|
- * Other visitors will leave @obj unchanged.
|
|
|
|
|
|
+ * the qtype of the next thing to be visited, and store it in
|
|
|
|
+ * (*@obj)->type. Other visitors leave @obj unchanged.
|
|
|
|
+ *
|
|
|
|
+ * On failure, set *@obj to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
*
|
|
*
|
|
* If successful, this must be paired with visit_end_alternate() with
|
|
* If successful, this must be paired with visit_end_alternate() with
|
|
* the same @obj to clean up, even if visiting the contents of the
|
|
* the same @obj to clean up, even if visiting the contents of the
|
|
@@ -461,12 +463,15 @@ bool visit_optional(Visitor *v, const char *name, bool *present);
|
|
*
|
|
*
|
|
* Currently, all input visitors parse text input, and all output
|
|
* Currently, all input visitors parse text input, and all output
|
|
* visitors produce text output. The mapping between enumeration
|
|
* visitors produce text output. The mapping between enumeration
|
|
- * values and strings is done by the visitor core, using @strings; it
|
|
|
|
- * should be the ENUM_lookup array from visit-types.h.
|
|
|
|
|
|
+ * values and strings is done by the visitor core, using @lookup.
|
|
|
|
+ *
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*
|
|
*
|
|
* May call visit_type_str() under the hood, and the enum visit may
|
|
* May call visit_type_str() under the hood, and the enum visit may
|
|
* fail even if the corresponding string visit succeeded; this implies
|
|
* fail even if the corresponding string visit succeeded; this implies
|
|
- * that visit_type_str() must have no unwelcome side effects.
|
|
|
|
|
|
+ * that an input visitor's visit_type_str() must have no unwelcome
|
|
|
|
+ * side effects.
|
|
*/
|
|
*/
|
|
void visit_type_enum(Visitor *v, const char *name, int *obj,
|
|
void visit_type_enum(Visitor *v, const char *name, int *obj,
|
|
const QEnumLookup *lookup, Error **errp);
|
|
const QEnumLookup *lookup, Error **errp);
|
|
@@ -476,6 +481,11 @@ void visit_type_enum(Visitor *v, const char *name, int *obj,
|
|
*/
|
|
*/
|
|
bool visit_is_input(Visitor *v);
|
|
bool visit_is_input(Visitor *v);
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Check if visitor is a dealloc visitor.
|
|
|
|
+ */
|
|
|
|
+bool visit_is_dealloc(Visitor *v);
|
|
|
|
+
|
|
/*** Visiting built-in types ***/
|
|
/*** Visiting built-in types ***/
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -486,6 +496,9 @@ bool visit_is_input(Visitor *v);
|
|
*
|
|
*
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* other visitors will leave *@obj unchanged.
|
|
* other visitors will leave *@obj unchanged.
|
|
|
|
+ *
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*/
|
|
*/
|
|
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
|
|
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
|
|
|
|
|
|
@@ -562,6 +575,9 @@ void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
|
|
*
|
|
*
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* other visitors will leave *@obj unchanged.
|
|
* other visitors will leave *@obj unchanged.
|
|
|
|
+ *
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*/
|
|
*/
|
|
void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
|
|
void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
|
|
|
|
|
|
@@ -579,6 +595,9 @@ void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
|
|
* It is safe to cast away const when preparing a (const char *) value
|
|
* It is safe to cast away const when preparing a (const char *) value
|
|
* into @obj for use by an output visitor.
|
|
* into @obj for use by an output visitor.
|
|
*
|
|
*
|
|
|
|
+ * On failure, set *@obj to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
|
|
+ *
|
|
* FIXME: Callers that try to output NULL *obj should not be allowed.
|
|
* FIXME: Callers that try to output NULL *obj should not be allowed.
|
|
*/
|
|
*/
|
|
void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
|
|
void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
|
|
@@ -592,6 +611,9 @@ void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* other visitors will leave *@obj unchanged. Visitors should
|
|
* other visitors will leave *@obj unchanged. Visitors should
|
|
* document if infinity or NaN are not permitted.
|
|
* document if infinity or NaN are not permitted.
|
|
|
|
+ *
|
|
|
|
+ * On failure, store an error through @errp. Can happen only when @v
|
|
|
|
+ * is an input visitor.
|
|
*/
|
|
*/
|
|
void visit_type_number(Visitor *v, const char *name, double *obj,
|
|
void visit_type_number(Visitor *v, const char *name, double *obj,
|
|
Error **errp);
|
|
Error **errp);
|
|
@@ -606,6 +628,9 @@ void visit_type_number(Visitor *v, const char *name, double *obj,
|
|
* other visitors will leave *@obj unchanged. *@obj must be non-NULL
|
|
* other visitors will leave *@obj unchanged. *@obj must be non-NULL
|
|
* for output visitors.
|
|
* for output visitors.
|
|
*
|
|
*
|
|
|
|
+ * On failure, set *@obj to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
|
|
+ *
|
|
* Note that some kinds of input can't express arbitrary QObject.
|
|
* Note that some kinds of input can't express arbitrary QObject.
|
|
* E.g. the visitor returned by qobject_input_visitor_new_keyval()
|
|
* E.g. the visitor returned by qobject_input_visitor_new_keyval()
|
|
* can't create numbers or booleans, only strings.
|
|
* can't create numbers or booleans, only strings.
|
|
@@ -620,6 +645,9 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
|
|
*
|
|
*
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
|
* other visitors ignore *@obj.
|
|
* other visitors ignore *@obj.
|
|
|
|
+ *
|
|
|
|
+ * On failure, set *@obj to NULL and store an error through @errp.
|
|
|
|
+ * Can happen only when @v is an input visitor.
|
|
*/
|
|
*/
|
|
void visit_type_null(Visitor *v, const char *name, QNull **obj,
|
|
void visit_type_null(Visitor *v, const char *name, QNull **obj,
|
|
Error **errp);
|
|
Error **errp);
|