1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
* 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.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authors: Christopher James Lahey <clahey@umich.edu>
*/
#include <config.h>
#include "e-iterator.h"
enum {
INVALIDATE,
LAST_SIGNAL
};
static guint e_iterator_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (EIterator, e_iterator, G_TYPE_OBJECT)
static void
e_iterator_class_init (EIteratorClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
e_iterator_signals[INVALIDATE] = g_signal_new (
"invalidate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EIteratorClass, invalidate),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
/**
* e_iterator_init:
*/
static void
e_iterator_init (EIterator *card)
{
}
/*
* Virtual functions:
*
*/
/**
* e_iterator_get:
*
* Returns: (transfer none): the iterator.
*/
gconstpointer
e_iterator_get (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->get)
return E_ITERATOR_GET_CLASS (iterator)->get (iterator);
else
return NULL;
}
void
e_iterator_reset (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->reset)
E_ITERATOR_GET_CLASS (iterator)->reset (iterator);
}
void
e_iterator_last (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->last)
E_ITERATOR_GET_CLASS (iterator)->last (iterator);
}
gboolean
e_iterator_next (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->next)
return E_ITERATOR_GET_CLASS (iterator)->next (iterator);
else
return FALSE;
}
gboolean
e_iterator_prev (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->prev)
return E_ITERATOR_GET_CLASS (iterator)->prev (iterator);
else
return FALSE;
}
void
e_iterator_delete (EIterator *iterator)
{
if (E_ITERATOR_GET_CLASS (iterator)->remove)
E_ITERATOR_GET_CLASS (iterator)->remove (iterator);
}
void
e_iterator_insert (EIterator *iterator,
gconstpointer object,
gboolean before)
{
if (E_ITERATOR_GET_CLASS (iterator)->insert)
E_ITERATOR_GET_CLASS (iterator)->insert (iterator, object, before);
}
void
e_iterator_set (EIterator *iterator,
gconstpointer object)
{
if (E_ITERATOR_GET_CLASS (iterator)->set)
E_ITERATOR_GET_CLASS (iterator)->set (iterator, object);
}
gboolean
e_iterator_is_valid (EIterator *iterator)
{
if (!iterator)
return FALSE;
if (E_ITERATOR_GET_CLASS (iterator)->is_valid)
return E_ITERATOR_GET_CLASS (iterator)->is_valid (iterator);
else
return FALSE;
}
void
e_iterator_invalidate (EIterator *iterator)
{
g_return_if_fail (iterator != NULL);
g_return_if_fail (E_IS_ITERATOR (iterator));
g_signal_emit (iterator, e_iterator_signals[INVALIDATE], 0);
}
|