2 * Core Definitions for QAPI Visitor implementations
4 * Copyright (C) 2012 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/error.h"
16 #include "qapi/visitor.h"
21 void (*start_struct
)(Visitor
*v
, void **obj
, const char *kind
,
22 const char *name
, size_t size
, Error
**errp
);
23 void (*end_struct
)(Visitor
*v
, Error
**errp
);
25 void (*start_implicit_struct
)(Visitor
*v
, void **obj
, size_t size
,
27 void (*end_implicit_struct
)(Visitor
*v
, Error
**errp
);
29 void (*start_list
)(Visitor
*v
, const char *name
, Error
**errp
);
30 GenericList
*(*next_list
)(Visitor
*v
, GenericList
**list
, Error
**errp
);
31 void (*end_list
)(Visitor
*v
, Error
**errp
);
33 void (*type_enum
)(Visitor
*v
, int *obj
, const char * const strings
[],
34 const char *kind
, const char *name
, Error
**errp
);
35 void (*get_next_type
)(Visitor
*v
, int *kind
, const int *qobjects
,
36 const char *name
, Error
**errp
);
38 void (*type_int
)(Visitor
*v
, int64_t *obj
, const char *name
, Error
**errp
);
39 void (*type_bool
)(Visitor
*v
, bool *obj
, const char *name
, Error
**errp
);
40 void (*type_str
)(Visitor
*v
, char **obj
, const char *name
, Error
**errp
);
41 void (*type_number
)(Visitor
*v
, double *obj
, const char *name
,
43 void (*type_any
)(Visitor
*v
, QObject
**obj
, const char *name
,
47 void (*optional
)(Visitor
*v
, bool *present
, const char *name
,
50 void (*type_uint8
)(Visitor
*v
, uint8_t *obj
, const char *name
, Error
**errp
);
51 void (*type_uint16
)(Visitor
*v
, uint16_t *obj
, const char *name
, Error
**errp
);
52 void (*type_uint32
)(Visitor
*v
, uint32_t *obj
, const char *name
, Error
**errp
);
53 void (*type_uint64
)(Visitor
*v
, uint64_t *obj
, const char *name
, Error
**errp
);
54 void (*type_int8
)(Visitor
*v
, int8_t *obj
, const char *name
, Error
**errp
);
55 void (*type_int16
)(Visitor
*v
, int16_t *obj
, const char *name
, Error
**errp
);
56 void (*type_int32
)(Visitor
*v
, int32_t *obj
, const char *name
, Error
**errp
);
57 void (*type_int64
)(Visitor
*v
, int64_t *obj
, const char *name
, Error
**errp
);
58 /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */
59 void (*type_size
)(Visitor
*v
, uint64_t *obj
, const char *name
, Error
**errp
);
60 bool (*start_union
)(Visitor
*v
, bool data_present
, Error
**errp
);
61 void (*end_union
)(Visitor
*v
, bool data_present
, Error
**errp
);
64 void input_type_enum(Visitor
*v
, int *obj
, const char * const strings
[],
65 const char *kind
, const char *name
, Error
**errp
);
66 void output_type_enum(Visitor
*v
, int *obj
, const char * const strings
[],
67 const char *kind
, const char *name
, Error
**errp
);