/* oneofrule.c generated by valac, the Vala compiler
 * generated from oneofrule.vala, do not modify */

/* oneofrule.vala
 *
 * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Didier 'Ptitjes Villevalois <ptitjes@free.fr>
 */

#include "valadoc.h"
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#define VALADOC_TYPE_ONE_OF_RULE (valadoc_one_of_rule_get_type ())
#define VALADOC_ONE_OF_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALADOC_TYPE_ONE_OF_RULE, ValadocOneOfRule))
#define VALADOC_ONE_OF_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALADOC_TYPE_ONE_OF_RULE, ValadocOneOfRuleClass))
#define VALADOC_IS_ONE_OF_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALADOC_TYPE_ONE_OF_RULE))
#define VALADOC_IS_ONE_OF_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALADOC_TYPE_ONE_OF_RULE))
#define VALADOC_ONE_OF_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALADOC_TYPE_ONE_OF_RULE, ValadocOneOfRuleClass))

typedef struct _ValadocOneOfRule ValadocOneOfRule;
typedef struct _ValadocOneOfRuleClass ValadocOneOfRuleClass;
typedef struct _ValadocOneOfRulePrivate ValadocOneOfRulePrivate;
enum  {
	VALADOC_ONE_OF_RULE_0_PROPERTY,
	VALADOC_ONE_OF_RULE_NUM_PROPERTIES
};
static GParamSpec* valadoc_one_of_rule_properties[VALADOC_ONE_OF_RULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define VALADOC_ONE_OF_RULE_TYPE_STATE (valadoc_one_of_rule_state_get_type ())
#define VALADOC_ONE_OF_RULE_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALADOC_ONE_OF_RULE_TYPE_STATE, ValadocOneOfRuleState))
#define VALADOC_ONE_OF_RULE_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALADOC_ONE_OF_RULE_TYPE_STATE, ValadocOneOfRuleStateClass))
#define VALADOC_ONE_OF_RULE_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALADOC_ONE_OF_RULE_TYPE_STATE))
#define VALADOC_ONE_OF_RULE_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALADOC_ONE_OF_RULE_TYPE_STATE))
#define VALADOC_ONE_OF_RULE_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALADOC_ONE_OF_RULE_TYPE_STATE, ValadocOneOfRuleStateClass))

typedef struct _ValadocOneOfRuleState ValadocOneOfRuleState;
typedef struct _ValadocOneOfRuleStateClass ValadocOneOfRuleStateClass;
typedef struct _ValadocOneOfRuleStatePrivate ValadocOneOfRuleStatePrivate;
enum  {
	VALADOC_ONE_OF_RULE_STATE_0_PROPERTY,
	VALADOC_ONE_OF_RULE_STATE_NUM_PROPERTIES
};
static GParamSpec* valadoc_one_of_rule_state_properties[VALADOC_ONE_OF_RULE_STATE_NUM_PROPERTIES];

struct _ValadocOneOfRule {
	ValadocRule parent_instance;
	ValadocOneOfRulePrivate * priv;
};

struct _ValadocOneOfRuleClass {
	ValadocRuleClass parent_class;
};

struct _ValadocOneOfRulePrivate {
	GObject** _scheme;
	gint _scheme_length1;
	gint __scheme_size_;
};

struct _ValadocOneOfRuleState {
	GObject parent_instance;
	gint selected;
	ValadocOneOfRuleStatePrivate * priv;
};

struct _ValadocOneOfRuleStateClass {
	GObjectClass parent_class;
};

static gint ValadocOneOfRule_private_offset;
static gpointer valadoc_one_of_rule_parent_class = NULL;
static gpointer valadoc_one_of_rule_state_parent_class = NULL;

 G_GNUC_INTERNAL GType valadoc_one_of_rule_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL ValadocOneOfRule* valadoc_one_of_rule_new (GObject** scheme,
                                           gint scheme_length1);
 G_GNUC_INTERNAL ValadocOneOfRule* valadoc_one_of_rule_construct (GType object_type,
                                                 GObject** scheme,
                                                 gint scheme_length1);
static GObject** _vala_array_dup2 (GObject** self,
                            gssize length);
static gboolean valadoc_one_of_rule_real_is_optional (ValadocRule* base);
static gboolean valadoc_one_of_rule_real_starts_with_token (ValadocRule* base,
                                                     ValadocToken* token);
static gboolean valadoc_one_of_rule_real_accept_token (ValadocRule* base,
                                                ValadocToken* token,
                                                ValadocParserCallback* parser,
                                                ValadocRuleForward forward,
                                                GError** error);
static GType valadoc_one_of_rule_state_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static ValadocOneOfRuleState* valadoc_one_of_rule_state_new (void);
static ValadocOneOfRuleState* valadoc_one_of_rule_state_construct (GType object_type);
static gboolean valadoc_one_of_rule_real_would_accept_token (ValadocRule* base,
                                                      ValadocToken* token,
                                                      GObject* state);
static gboolean valadoc_one_of_rule_real_would_reduce (ValadocRule* base,
                                                ValadocToken* token,
                                                GObject* rule_state);
static gchar* valadoc_one_of_rule_real_to_string (ValadocRule* base,
                                           GObject* rule_state);
static void valadoc_one_of_rule_state_finalize (GObject * obj);
static GType valadoc_one_of_rule_state_get_type_once (void);
static void valadoc_one_of_rule_finalize (GObject * obj);
static GType valadoc_one_of_rule_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
valadoc_one_of_rule_get_instance_private (ValadocOneOfRule* self)
{
	return G_STRUCT_MEMBER_P (self, ValadocOneOfRule_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static GObject**
_vala_array_dup2 (GObject** self,
                  gssize length)
{
	if (length >= 0) {
		GObject** result;
		gssize i;
		result = g_new0 (GObject*, length + 1);
		for (i = 0; i < length; i++) {
			GObject* _tmp0_;
			_tmp0_ = _g_object_ref0 (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

 G_GNUC_INTERNAL ValadocOneOfRule*
valadoc_one_of_rule_construct (GType object_type,
                               GObject** scheme,
                               gint scheme_length1)
{
	ValadocOneOfRule * self = NULL;
	GObject** _tmp0_;
	gint _tmp0__length1;
	self = (ValadocOneOfRule*) valadoc_rule_construct (object_type);
	_tmp0_ = (scheme != NULL) ? _vala_array_dup2 (scheme, scheme_length1) : scheme;
	_tmp0__length1 = scheme_length1;
	self->priv->_scheme = (_vala_array_free (self->priv->_scheme, self->priv->_scheme_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->_scheme = _tmp0_;
	self->priv->_scheme_length1 = _tmp0__length1;
	self->priv->__scheme_size_ = self->priv->_scheme_length1;
	return self;
}

 G_GNUC_INTERNAL ValadocOneOfRule*
valadoc_one_of_rule_new (GObject** scheme,
                         gint scheme_length1)
{
	return valadoc_one_of_rule_construct (VALADOC_TYPE_ONE_OF_RULE, scheme, scheme_length1);
}

static gboolean
valadoc_one_of_rule_real_is_optional (ValadocRule* base)
{
	ValadocOneOfRule * self;
	gboolean result;
	self = (ValadocOneOfRule*) base;
	result = FALSE;
	return result;
}

static gboolean
valadoc_one_of_rule_real_starts_with_token (ValadocRule* base,
                                            ValadocToken* token)
{
	ValadocOneOfRule * self;
	GObject** _tmp0_;
	gint _tmp0__length1;
	gboolean result;
	self = (ValadocOneOfRule*) base;
	g_return_val_if_fail (token != NULL, FALSE);
	_tmp0_ = self->priv->_scheme;
	_tmp0__length1 = self->priv->_scheme_length1;
	{
		GObject** scheme_element_collection = NULL;
		gint scheme_element_collection_length1 = 0;
		gint _scheme_element_collection_size_ = 0;
		gint scheme_element_it = 0;
		scheme_element_collection = _tmp0_;
		scheme_element_collection_length1 = _tmp0__length1;
		for (scheme_element_it = 0; scheme_element_it < scheme_element_collection_length1; scheme_element_it = scheme_element_it + 1) {
			GObject* _tmp1_;
			GObject* scheme_element = NULL;
			_tmp1_ = _g_object_ref0 (scheme_element_collection[scheme_element_it]);
			scheme_element = _tmp1_;
			{
				GObject* _tmp2_;
				_tmp2_ = scheme_element;
				if (valadoc_rule_has_start_token ((ValadocRule*) self, _tmp2_, token)) {
					result = TRUE;
					_g_object_unref0 (scheme_element);
					return result;
				}
				_g_object_unref0 (scheme_element);
			}
		}
	}
	result = FALSE;
	return result;
}

static gboolean
valadoc_one_of_rule_real_accept_token (ValadocRule* base,
                                       ValadocToken* token,
                                       ValadocParserCallback* parser,
                                       ValadocRuleForward forward,
                                       GError** error)
{
	ValadocOneOfRule * self;
	ValadocOneOfRuleState* state = NULL;
	GObject* _tmp0_;
	ValadocOneOfRuleState* _tmp1_;
	ValadocOneOfRuleState* _tmp2_;
	ValadocOneOfRuleState* _tmp5_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = (ValadocOneOfRule*) base;
	g_return_val_if_fail (token != NULL, FALSE);
	g_return_val_if_fail (parser != NULL, FALSE);
	_tmp0_ = valadoc_parser_callback_get_rule_state (parser);
	_tmp1_ = VALADOC_ONE_OF_RULE_IS_STATE (_tmp0_) ? ((ValadocOneOfRuleState*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	state = _tmp1_;
	_tmp2_ = state;
	if (_tmp2_ == NULL) {
		ValadocOneOfRuleState* _tmp3_;
		ValadocOneOfRuleState* _tmp4_;
		_tmp3_ = valadoc_one_of_rule_state_new ();
		_g_object_unref0 (state);
		state = _tmp3_;
		_tmp4_ = state;
		valadoc_parser_callback_set_rule_state (parser, (GObject*) _tmp4_);
	}
	_tmp5_ = state;
	if (_tmp5_->selected == -1) {
		gboolean handled = FALSE;
		valadoc_rule_do_start ((ValadocRule*) self, parser, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
				gboolean _tmp6_ = FALSE;
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (state);
				return _tmp6_;
			} else {
				gboolean _tmp7_ = FALSE;
				_g_object_unref0 (state);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return _tmp7_;
			}
		}
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp8_ = FALSE;
				_tmp8_ = TRUE;
				while (TRUE) {
					GObject** _tmp10_;
					gint _tmp10__length1;
					GObject* scheme_element = NULL;
					GObject** _tmp11_;
					gint _tmp11__length1;
					GObject* _tmp12_;
					GObject* _tmp13_;
					gboolean _tmp14_ = FALSE;
					GObject* _tmp15_;
					gboolean _tmp16_ = FALSE;
					gboolean _tmp17_;
					if (!_tmp8_) {
						gint _tmp9_;
						_tmp9_ = i;
						i = _tmp9_ + 1;
					}
					_tmp8_ = FALSE;
					_tmp10_ = self->priv->_scheme;
					_tmp10__length1 = self->priv->_scheme_length1;
					if (!(i < _tmp10__length1)) {
						break;
					}
					_tmp11_ = self->priv->_scheme;
					_tmp11__length1 = self->priv->_scheme_length1;
					_tmp12_ = _tmp11_[i];
					_tmp13_ = _g_object_ref0 (_tmp12_);
					scheme_element = _tmp13_;
					_tmp15_ = scheme_element;
					_tmp17_ = valadoc_rule_try_to_apply ((ValadocRule*) self, _tmp15_, token, parser, &_tmp16_, &_inner_error0_);
					handled = _tmp16_;
					_tmp14_ = _tmp17_;
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
							gboolean _tmp18_ = FALSE;
							g_propagate_error (error, _inner_error0_);
							_g_object_unref0 (scheme_element);
							_g_object_unref0 (state);
							return _tmp18_;
						} else {
							gboolean _tmp19_ = FALSE;
							_g_object_unref0 (scheme_element);
							_g_object_unref0 (state);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
							g_clear_error (&_inner_error0_);
							return _tmp19_;
						}
					}
					if (_tmp14_) {
						ValadocOneOfRuleState* _tmp20_;
						_tmp20_ = state;
						_tmp20_->selected = i;
						result = handled;
						_g_object_unref0 (scheme_element);
						_g_object_unref0 (state);
						return result;
					}
					_g_object_unref0 (scheme_element);
				}
			}
		}
	} else {
		valadoc_rule_do_reduce ((ValadocRule*) self, parser, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
				gboolean _tmp21_ = FALSE;
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (state);
				return _tmp21_;
			} else {
				gboolean _tmp22_ = FALSE;
				_g_object_unref0 (state);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return _tmp22_;
			}
		}
		result = FALSE;
		_g_object_unref0 (state);
		return result;
	}
	valadoc_parser_callback_error (parser, token, "unexpected token", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == VALADOC_PARSER_ERROR) {
			gboolean _tmp23_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (state);
			return _tmp23_;
		} else {
			gboolean _tmp24_ = FALSE;
			_g_object_unref0 (state);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp24_;
		}
	}
	g_assert_not_reached ();
}

static gboolean
valadoc_one_of_rule_real_would_accept_token (ValadocRule* base,
                                             ValadocToken* token,
                                             GObject* state)
{
	ValadocOneOfRule * self;
	gboolean result;
	self = (ValadocOneOfRule*) base;
	g_return_val_if_fail (token != NULL, FALSE);
	result = FALSE;
	return result;
}

static gboolean
valadoc_one_of_rule_real_would_reduce (ValadocRule* base,
                                       ValadocToken* token,
                                       GObject* rule_state)
{
	ValadocOneOfRule * self;
	ValadocOneOfRuleState* state = NULL;
	ValadocOneOfRuleState* _tmp0_;
	gboolean result;
	self = (ValadocOneOfRule*) base;
	g_return_val_if_fail (token != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (VALADOC_ONE_OF_RULE_IS_STATE (rule_state) ? ((ValadocOneOfRuleState*) rule_state) : NULL);
	state = _tmp0_;
	result = state->selected != -1;
	_g_object_unref0 (state);
	return result;
}

static gchar*
valadoc_one_of_rule_real_to_string (ValadocRule* base,
                                    GObject* rule_state)
{
	ValadocOneOfRule * self;
	ValadocOneOfRuleState* state = NULL;
	ValadocOneOfRuleState* _tmp0_;
	ValadocOneOfRuleState* _tmp1_;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	ValadocOneOfRuleState* _tmp8_;
	GObject** _tmp9_;
	gint _tmp9__length1;
	gchar* _tmp10_;
	gchar* result;
	self = (ValadocOneOfRule*) base;
	_tmp0_ = _g_object_ref0 (VALADOC_ONE_OF_RULE_IS_STATE (rule_state) ? ((ValadocOneOfRuleState*) rule_state) : NULL);
	state = _tmp0_;
	_tmp1_ = state;
	if (_tmp1_ == NULL) {
		ValadocOneOfRuleState* _tmp2_;
		_tmp2_ = valadoc_one_of_rule_state_new ();
		_g_object_unref0 (state);
		state = _tmp2_;
	}
	_tmp4_ = valadoc_rule_get_name ((ValadocRule*) self);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = valadoc_rule_get_name ((ValadocRule*) self);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_;
	} else {
		_tmp3_ = " ";
	}
	_tmp8_ = state;
	_tmp9_ = self->priv->_scheme;
	_tmp9__length1 = self->priv->_scheme_length1;
	_tmp10_ = g_strdup_printf ("%-15s%-15s(selected=%d/%d)", _tmp3_, "[one-of]", _tmp8_->selected, _tmp9__length1);
	result = _tmp10_;
	_g_object_unref0 (state);
	return result;
}

static ValadocOneOfRuleState*
valadoc_one_of_rule_state_construct (GType object_type)
{
	ValadocOneOfRuleState * self = NULL;
	self = (ValadocOneOfRuleState*) g_object_new (object_type, NULL);
	return self;
}

static ValadocOneOfRuleState*
valadoc_one_of_rule_state_new (void)
{
	return valadoc_one_of_rule_state_construct (VALADOC_ONE_OF_RULE_TYPE_STATE);
}

static void
valadoc_one_of_rule_state_class_init (ValadocOneOfRuleStateClass * klass,
                                      gpointer klass_data)
{
	valadoc_one_of_rule_state_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = valadoc_one_of_rule_state_finalize;
}

static void
valadoc_one_of_rule_state_instance_init (ValadocOneOfRuleState * self,
                                         gpointer klass)
{
	self->selected = -1;
}

static void
valadoc_one_of_rule_state_finalize (GObject * obj)
{
	ValadocOneOfRuleState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_ONE_OF_RULE_TYPE_STATE, ValadocOneOfRuleState);
	G_OBJECT_CLASS (valadoc_one_of_rule_state_parent_class)->finalize (obj);
}

static GType
valadoc_one_of_rule_state_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValadocOneOfRuleStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_one_of_rule_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocOneOfRuleState), 0, (GInstanceInitFunc) valadoc_one_of_rule_state_instance_init, NULL };
	GType valadoc_one_of_rule_state_type_id;
	valadoc_one_of_rule_state_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocOneOfRuleState", &g_define_type_info, 0);
	return valadoc_one_of_rule_state_type_id;
}

static GType
valadoc_one_of_rule_state_get_type (void)
{
	static volatile gsize valadoc_one_of_rule_state_type_id__once = 0;
	if (g_once_init_enter (&valadoc_one_of_rule_state_type_id__once)) {
		GType valadoc_one_of_rule_state_type_id;
		valadoc_one_of_rule_state_type_id = valadoc_one_of_rule_state_get_type_once ();
		g_once_init_leave (&valadoc_one_of_rule_state_type_id__once, valadoc_one_of_rule_state_type_id);
	}
	return valadoc_one_of_rule_state_type_id__once;
}

static void
valadoc_one_of_rule_class_init (ValadocOneOfRuleClass * klass,
                                gpointer klass_data)
{
	valadoc_one_of_rule_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ValadocOneOfRule_private_offset);
	((ValadocRuleClass *) klass)->is_optional = (gboolean (*) (ValadocRule*)) valadoc_one_of_rule_real_is_optional;
	((ValadocRuleClass *) klass)->starts_with_token = (gboolean (*) (ValadocRule*, ValadocToken*)) valadoc_one_of_rule_real_starts_with_token;
	((ValadocRuleClass *) klass)->accept_token = (gboolean (*) (ValadocRule*, ValadocToken*, ValadocParserCallback*, ValadocRuleForward, GError**)) valadoc_one_of_rule_real_accept_token;
	((ValadocRuleClass *) klass)->would_accept_token = (gboolean (*) (ValadocRule*, ValadocToken*, GObject*)) valadoc_one_of_rule_real_would_accept_token;
	((ValadocRuleClass *) klass)->would_reduce = (gboolean (*) (ValadocRule*, ValadocToken*, GObject*)) valadoc_one_of_rule_real_would_reduce;
	((ValadocRuleClass *) klass)->to_string = (gchar* (*) (ValadocRule*, GObject*)) valadoc_one_of_rule_real_to_string;
	G_OBJECT_CLASS (klass)->finalize = valadoc_one_of_rule_finalize;
}

static void
valadoc_one_of_rule_instance_init (ValadocOneOfRule * self,
                                   gpointer klass)
{
	self->priv = valadoc_one_of_rule_get_instance_private (self);
}

static void
valadoc_one_of_rule_finalize (GObject * obj)
{
	ValadocOneOfRule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_TYPE_ONE_OF_RULE, ValadocOneOfRule);
	self->priv->_scheme = (_vala_array_free (self->priv->_scheme, self->priv->_scheme_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (valadoc_one_of_rule_parent_class)->finalize (obj);
}

static GType
valadoc_one_of_rule_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValadocOneOfRuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_one_of_rule_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocOneOfRule), 0, (GInstanceInitFunc) valadoc_one_of_rule_instance_init, NULL };
	GType valadoc_one_of_rule_type_id;
	valadoc_one_of_rule_type_id = g_type_register_static (VALADOC_TYPE_RULE, "ValadocOneOfRule", &g_define_type_info, 0);
	ValadocOneOfRule_private_offset = g_type_add_instance_private (valadoc_one_of_rule_type_id, sizeof (ValadocOneOfRulePrivate));
	return valadoc_one_of_rule_type_id;
}

 G_GNUC_INTERNAL GType
valadoc_one_of_rule_get_type (void)
{
	static volatile gsize valadoc_one_of_rule_type_id__once = 0;
	if (g_once_init_enter (&valadoc_one_of_rule_type_id__once)) {
		GType valadoc_one_of_rule_type_id;
		valadoc_one_of_rule_type_id = valadoc_one_of_rule_get_type_once ();
		g_once_init_leave (&valadoc_one_of_rule_type_id__once, valadoc_one_of_rule_type_id);
	}
	return valadoc_one_of_rule_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

