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

/* bidiriterator.vala
 *
 * Copyright (C) 2009  Didier Villevalois, Maciej Piechotka
 *
 * 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:
 * 	Maciej Piechotka <uzytkownik2@gmail.com>
 */

#include "gee.h"
#include <glib-object.h>
#include <glib.h>

static GType gee_bidir_iterator_get_type_once (void);

/**
 * Rewinds to the previous element in the iteration.
 *
 * @return ``true`` if the iterator has a previous element
 */
gboolean
gee_bidir_iterator_previous (GeeBidirIterator* self)
{
	GeeBidirIteratorIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GEE_BIDIR_ITERATOR_GET_INTERFACE (self);
	if (_iface_->previous) {
		return _iface_->previous (self);
	}
	return FALSE;
}

/**
 * Checks whether there is a previous element in the iteration.
 *
 * @return ``true`` if the iterator has a previous element
 */
gboolean
gee_bidir_iterator_has_previous (GeeBidirIterator* self)
{
	GeeBidirIteratorIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GEE_BIDIR_ITERATOR_GET_INTERFACE (self);
	if (_iface_->has_previous) {
		return _iface_->has_previous (self);
	}
	return FALSE;
}

/**
 * Rewinds to the first element in the iteration.
 *
 * @return ``true`` if the iterator has a first element
 */
gboolean
gee_bidir_iterator_first (GeeBidirIterator* self)
{
	GeeBidirIteratorIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GEE_BIDIR_ITERATOR_GET_INTERFACE (self);
	if (_iface_->first) {
		return _iface_->first (self);
	}
	return FALSE;
}

/**
 * Advances to the last element in the iteration.
 *
 * @return ``true`` if the iterator has a last element
 */
gboolean
gee_bidir_iterator_last (GeeBidirIterator* self)
{
	GeeBidirIteratorIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GEE_BIDIR_ITERATOR_GET_INTERFACE (self);
	if (_iface_->last) {
		return _iface_->last (self);
	}
	return FALSE;
}

static void
gee_bidir_iterator_default_init (GeeBidirIteratorIface * iface,
                                 gpointer iface_data)
{
}

/**
 * A bi-directional iterator.
 */
static GType
gee_bidir_iterator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GeeBidirIteratorIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_bidir_iterator_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gee_bidir_iterator_type_id;
	gee_bidir_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeBidirIterator", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gee_bidir_iterator_type_id, GEE_TYPE_ITERATOR);
	return gee_bidir_iterator_type_id;
}

GType
gee_bidir_iterator_get_type (void)
{
	static volatile gsize gee_bidir_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gee_bidir_iterator_type_id__volatile)) {
		GType gee_bidir_iterator_type_id;
		gee_bidir_iterator_type_id = gee_bidir_iterator_get_type_once ();
		g_once_init_leave (&gee_bidir_iterator_type_id__volatile, gee_bidir_iterator_type_id);
	}
	return gee_bidir_iterator_type_id__volatile;
}

