aboutsummaryrefslogtreecommitdiff
path: root/include/qapi/visitor-impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/qapi/visitor-impl.h')
-rw-r--r--include/qapi/visitor-impl.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 2bd8f292b2..51c338a43d 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -14,6 +14,17 @@
#include "qapi/visitor.h"
+/*
+ * There are three classes of visitors; setting the class determines
+ * how QAPI enums are visited, as well as what additional restrictions
+ * can be asserted.
+ */
+typedef enum VisitorType {
+ VISITOR_INPUT,
+ VISITOR_OUTPUT,
+ VISITOR_DEALLOC,
+} VisitorType;
+
struct Visitor
{
/* Must be set */
@@ -36,10 +47,6 @@ struct Visitor
void (*end_alternate)(Visitor *v);
/* Must be set. */
- void (*type_enum)(Visitor *v, const char *name, int *obj,
- const char *const strings[], Error **errp);
-
- /* Must be set. */
void (*type_int64)(Visitor *v, const char *name, int64_t *obj,
Error **errp);
/* Must be set. */
@@ -58,11 +65,9 @@ struct Visitor
/* May be NULL; most useful for input visitors. */
void (*optional)(Visitor *v, const char *name, bool *present);
-};
-void input_type_enum(Visitor *v, const char *name, int *obj,
- const char *const strings[], Error **errp);
-void output_type_enum(Visitor *v, const char *name, int *obj,
- const char *const strings[], Error **errp);
+ /* Must be set */
+ VisitorType type;
+};
#endif