/* sqlheavy-cursor.c generated by valac 0.16.0, the Vala compiler
 * generated from sqlheavy-cursor.vala, do not modify */


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






/**
     * Move to the first entry
     */
void sql_heavy_cursor_first (SQLHeavyCursor* self, GError** error) {
	GError * _inner_error_ = NULL;
	sql_heavy_cursor_move_to (self, (gint64) 0, &_inner_error_);
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == SQL_HEAVY_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
}


/**
     * Move to the last entry
     */
void sql_heavy_cursor_last (SQLHeavyCursor* self, GError** error) {
	GError * _inner_error_ = NULL;
	while (TRUE) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_;
		_tmp0_ = sql_heavy_record_set_next ((SQLHeavyRecordSet*) self, &_inner_error_);
		_tmp1_ = _tmp0_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == SQL_HEAVY_ERROR) {
				g_propagate_error (error, _inner_error_);
				return;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		if (!_tmp1_) {
			break;
		}
	}
}


/**
     * Move to the previous entry
     *
     * @return whether the move was successful
     */
gboolean sql_heavy_cursor_previous (SQLHeavyCursor* self, GError** error) {
	g_return_val_if_fail (self != NULL, FALSE);
	return SQL_HEAVY_CURSOR_GET_INTERFACE (self)->previous (self, error);
}


/**
     * Retrieve the current record
     */
SQLHeavyRecord* sql_heavy_cursor_get (SQLHeavyCursor* self, GError** error) {
	g_return_val_if_fail (self != NULL, NULL);
	return SQL_HEAVY_CURSOR_GET_INTERFACE (self)->get (self, error);
}


/**
     * Move to a specific entry
     *
     * @param offset the numeric offset to move to
     * @return whether the move was successful
     */
gboolean sql_heavy_cursor_move_to (SQLHeavyCursor* self, gint64 offset, GError** error) {
	g_return_val_if_fail (self != NULL, FALSE);
	return SQL_HEAVY_CURSOR_GET_INTERFACE (self)->move_to (self, offset, error);
}


static void sql_heavy_cursor_base_init (SQLHeavyCursorIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


/**
   * Cursor which can move bidirectionally through a set of records
   */
GType sql_heavy_cursor_get_type (void) {
	static volatile gsize sql_heavy_cursor_type_id__volatile = 0;
	if (g_once_init_enter (&sql_heavy_cursor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SQLHeavyCursorIface), (GBaseInitFunc) sql_heavy_cursor_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType sql_heavy_cursor_type_id;
		sql_heavy_cursor_type_id = g_type_register_static (G_TYPE_INTERFACE, "SQLHeavyCursor", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (sql_heavy_cursor_type_id, SQL_HEAVY_TYPE_RECORD_SET);
		g_once_init_leave (&sql_heavy_cursor_type_id__volatile, sql_heavy_cursor_type_id);
	}
	return sql_heavy_cursor_type_id__volatile;
}



