grim/gplate
Clone
Summary
Browse
Changes
Graph
some more testing migration stuff.
2012-09-04, Gary Kramlich
7f8e0e4f250f
some more testing migration stuff.
Variables aren't done yet
/*
* GPlate - GObject based templating library
* Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.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, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
#include
<gplate/gplate-iterator.h>
/******************************************************************************
* GPlateIterator API
*****************************************************************************/
GType
gplate_iterator_get_gtype
(
void
)
{
static
GType
type
=
0
;
if
(
type
==
0
)
{
static
const
GTypeInfo
info
=
{
sizeof
(
GPlateIteratorIface
),
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
0
,
NULL
,
};
type
=
g_type_register_static
(
G_TYPE_INTERFACE
,
"GPlateIterator"
,
&
info
,
0
);
}
return
type
;
}
/**
* gplate_iterator_has_next:
* @iter: The #GPlateIterator.
*
* Checks whether or not the iterator has another element.
*
* Return Value: TRUE if there is another element, otherwise FALSE.
*/
gboolean
gplate_iterator_has_next
(
const
GPlateIterator
*
iter
)
{
GPlateIteratorIface
*
iface
=
NULL
;
g_return_val_if_fail
(
GPLATE_IS_ITERATOR
(
iter
),
FALSE
);
iface
=
GPLATE_ITERATOR_GET_IFACE
(
iter
);
if
(
iface
&&
iface
->
has_next
)
return
iface
->
has_next
(
iter
);
return
FALSE
;
}
/**
* gplate_iterator_next:
* @iter: The #GPlateIterator.
*
* Advances @iter to the next element and returns that element.
*
* Return Value: The next element in the iteration or NULL.
*/
GPlateVariable
*
gplate_iterator_next
(
GPlateIterator
*
iter
)
{
GPlateIteratorIface
*
iface
=
NULL
;
g_return_val_if_fail
(
GPLATE_IS_ITERATOR
(
iter
),
NULL
);
if
(
!
gplate_iterator_has_next
(
iter
))
return
NULL
;
iface
=
GPLATE_ITERATOR_GET_IFACE
(
iter
);
if
(
iface
&&
iface
->
next
)
return
iface
->
next
(
iter
);
return
NULL
;
}