int object_property_get_enum(Object *obj, const char *name,

                             const char *typename, Error **errp)

{

    Error *err = NULL;

    StringOutputVisitor *sov;

    Visitor *v;

    char *str;

    int ret;

    ObjectProperty *prop = object_property_find(obj, name, errp);

    EnumProperty *enumprop;



    if (prop == NULL) {

        return 0;

    }



    if (!g_str_equal(prop->type, typename)) {

        error_setg(errp, "Property %s on %s is not '%s' enum type",

                   name, object_class_get_name(

                       object_get_class(obj)), typename);

        return 0;

    }



    enumprop = prop->opaque;



    sov = string_output_visitor_new(false);

    object_property_get(obj, string_output_get_visitor(sov), name, &err);

    if (err) {

        error_propagate(errp, err);

        string_output_visitor_cleanup(sov);

        return 0;

    }

    str = string_output_get_string(sov);

    string_output_visitor_cleanup(sov);

    v = string_input_visitor_new(str);

    visit_type_enum(v, name, &ret, enumprop->strings, errp);



    g_free(str);

    visit_free(v);



    return ret;

}

int object_property_get_enum(Object *obj, const char *name,

                             const char *typename, Error **errp)

{

    Error *err = NULL;

    StringOutputVisitor *sov;

    Visitor *v;

    char *str;

    int ret;

    ObjectProperty *prop = object_property_find(obj, name, errp);

    EnumProperty *enumprop;



    if (prop == NULL) {

        return 0;

    }



    if (!g_str_equal(prop->type, typename)) {

        error_setg(errp, "Property %s on %s is not '%s' enum type",

                   name, object_class_get_name(

                       object_get_class(obj)), typename);

        return 0;

    }



    enumprop = prop->opaque;



    sov = string_output_visitor_new(false);

    object_property_get(obj, string_output_get_visitor(sov), name, &err);

    if (err) {

        error_propagate(errp, err);

        string_output_visitor_cleanup(sov);

        return 0;

    }

    str = string_output_get_string(sov);

    string_output_visitor_cleanup(sov);

    v = string_input_visitor_new(str);

    visit_type_enum(v, name, &ret, enumprop->strings, errp);



    g_free(str);

    visit_free(v);



    return ret;

}

int FUNC_0(Object *VAR_0, const char *VAR_1,

                             const char *VAR_2, Error **VAR_3)

{

    Error *err = NULL;

    StringOutputVisitor *sov;

    Visitor *v;

    char *VAR_4;

    int VAR_5;

    ObjectProperty *prop = object_property_find(VAR_0, VAR_1, VAR_3);

    EnumProperty *enumprop;



    if (prop == NULL) {

        return 0;

    }



    if (!g_str_equal(prop->type, VAR_2)) {

        error_setg(VAR_3, "Property %s on %s is not '%s' enum type",

                   VAR_1, object_class_get_name(

                       object_get_class(VAR_0)), VAR_2);

        return 0;

    }



    enumprop = prop->opaque;



    sov = string_output_visitor_new(false);

    object_property_get(VAR_0, string_output_get_visitor(sov), VAR_1, &err);

    if (err) {

        error_propagate(VAR_3, err);

        string_output_visitor_cleanup(sov);

        return 0;

    }

    VAR_4 = string_output_get_string(sov);

    string_output_visitor_cleanup(sov);

    v = string_input_visitor_new(VAR_4);

    visit_type_enum(v, VAR_1, &VAR_5, enumprop->strings, VAR_3);



    g_free(VAR_4);

    visit_free(v);



    return VAR_5;

}

int FUNC_0(Object *VAR_0, const char *VAR_1,
const char *VAR_2, Error **VAR_3)
{ Error *err = NULL; StringOutputVisitor *sov; Visitor *v; char *VAR_4; int VAR_5; ObjectProperty *prop = object_property_find(VAR_0, VAR_1, VAR_3); EnumProperty *enumprop; if (prop == NULL) { return 0; } if (!g_str_equal(prop->type, VAR_2)) { error_setg(VAR_3, "Property %s on %s is not '%s' enum type",
VAR_1, object_class_get_name(
object_get_class(VAR_0)), VAR_2); return 0; } enumprop = prop->opaque; sov = string_output_visitor_new(false); object_property_get(VAR_0, string_output_get_visitor(sov), VAR_1, &err); if (err) { error_propagate(VAR_3, err); string_output_visitor_cleanup(sov); return 0; } VAR_4 = string_output_get_string(sov); string_output_visitor_cleanup(sov); v = string_input_visitor_new(VAR_4); visit_type_enum(v, VAR_1, &VAR_5, enumprop->strings, VAR_3); g_free(VAR_4); visit_free(v); return VAR_5; }