/*
 * Input Visitor
 *
 * Copyright (C) 2017 Red Hat, Inc.
 * Copyright IBM, Corp. 2011
 *
 * Authors:
 *  Anthony Liguori   <aliguori@us.ibm.com>
 *
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
 * See the COPYING.LIB file in the top-level directory.
 *
 */

#ifndef QOBJECT_INPUT_VISITOR_H
#define QOBJECT_INPUT_VISITOR_H

#include "qapi/visitor.h"
#include "qapi/qmp/qobject.h"

typedef struct QObjectInputVisitor QObjectInputVisitor;

/*
 * Create a QObject input visitor for @obj
 *
 * A QObject input visitor visit builds a QAPI object from a QObject.
 * This simultaneously walks the QAPI object being built and the
 * QObject.  The latter walk starts at @obj.
 *
 * visit_type_FOO() creates an instance of QAPI type FOO.  The visited
 * QObject must match FOO.  QDict matches struct/union types, QList
 * matches list types, QString matches type 'str' and enumeration
 * types, QInt matches integer types, QFloat matches type 'number',
 * QBool matches type 'bool'.  Type 'any' is matched by QObject.  A
 * QAPI alternate type is matched when one of its member types is.
 *
 * visit_start_struct() ... visit_end_struct() visits a QDict and
 * creates a QAPI struct/union.  Visits in between visit the
 * dictionary members.  visit_optional() is true when the QDict has
 * this member.  visit_check_struct() fails if unvisited members
 * remain.
 *
 * visit_start_list() ... visit_end_list() visits a QList and creates
 * a QAPI list.  Visits in between visit list members, one after the
 * other.  visit_next_list() returns NULL when all QList members have
 * been visited.  visit_check_list() fails if unvisited members
 * remain.
 *
 * visit_start_alternate() ... visit_end_alternate() visits a QObject
 * and creates a QAPI alternate.  The visit in between visits the same
 * QObject and initializes the alternate member that is in use.
 *
 * Error messages refer to parts of @obj in JavaScript/Python syntax.
 * For example, 'a.b[2]' refers to the second member of the QList
 * member 'b' of the QDict member 'a' of QDict @obj.
 *
 * The caller is responsible for freeing the visitor with
 * visit_free().
 */
Visitor *qobject_input_visitor_new(QObject *obj);

/*
 * Create a QObject input visitor for @obj for use with keyval_parse()
 *
 * This is like qobject_input_visitor_new(), except scalars are all
 * QString, and error messages refer to parts of @obj in the syntax
 * keyval_parse() uses for KEYs.
 */
Visitor *qobject_input_visitor_new_keyval(QObject *obj);

/*
 * Create a QObject input visitor for parsing @str.
 *
 * If @str looks like JSON, parse it as JSON, else as KEY=VALUE,...
 * @implied_key applies to KEY=VALUE, and works as in keyval_parse().
 * On failure, store an error through @errp and return NULL.
 * On success, return a new QObject input visitor for the parse.
 */
Visitor *qobject_input_visitor_new_str(const char *str,
                                       const char *implied_key,
                                       Error **errp);

#endif
