2 * Core Definitions for QAPI Visitor implementations
4 * Copyright (C) 2012-2016 Red Hat, Inc.
6 * Author: Paolo Bonizni <pbonzini@redhat.com>
8 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
9 * See the COPYING.LIB file in the top-level directory.
12 #ifndef QAPI_VISITOR_IMPL_H
13 #define QAPI_VISITOR_IMPL_H
15 #include "qapi/visitor.h"
20 void (*start_struct
)(Visitor
*v
, const char *name
, void **obj
,
21 size_t size
, Error
**errp
);
22 void (*end_struct
)(Visitor
*v
, Error
**errp
);
24 void (*start_list
)(Visitor
*v
, const char *name
, Error
**errp
);
26 GenericList
*(*next_list
)(Visitor
*v
, GenericList
**list
, size_t size
);
28 void (*end_list
)(Visitor
*v
);
30 /* Optional, needed for input and dealloc visitors. */
31 void (*start_alternate
)(Visitor
*v
, const char *name
,
32 GenericAlternate
**obj
, size_t size
,
33 bool promote_int
, Error
**errp
);
35 /* Optional, needed for dealloc visitor. */
36 void (*end_alternate
)(Visitor
*v
);
39 void (*type_enum
)(Visitor
*v
, const char *name
, int *obj
,
40 const char *const strings
[], Error
**errp
);
43 void (*type_int64
)(Visitor
*v
, const char *name
, int64_t *obj
,
46 void (*type_uint64
)(Visitor
*v
, const char *name
, uint64_t *obj
,
48 /* Optional; fallback is type_uint64(). */
49 void (*type_size
)(Visitor
*v
, const char *name
, uint64_t *obj
,
52 void (*type_bool
)(Visitor
*v
, const char *name
, bool *obj
, Error
**errp
);
53 void (*type_str
)(Visitor
*v
, const char *name
, char **obj
, Error
**errp
);
54 void (*type_number
)(Visitor
*v
, const char *name
, double *obj
,
56 void (*type_any
)(Visitor
*v
, const char *name
, QObject
**obj
,
59 /* May be NULL; most useful for input visitors. */
60 void (*optional
)(Visitor
*v
, const char *name
, bool *present
);
63 void input_type_enum(Visitor
*v
, const char *name
, int *obj
,
64 const char *const strings
[], Error
**errp
);
65 void output_type_enum(Visitor
*v
, const char *name
, int *obj
,
66 const char *const strings
[], Error
**errp
);