IpatchIter

IpatchIter — Iterator instance

Stability Level

Stable, unless otherwise indicated

Functions

IpatchIter * ipatch_iter_alloc ()
void ipatch_iter_free ()
IpatchIter * ipatch_iter_duplicate ()
#define ipatch_iter_get()
#define ipatch_iter_next()
#define ipatch_iter_first()
#define ipatch_iter_last()
#define ipatch_iter_index()
#define ipatch_iter_insert()
#define ipatch_iter_remove()
#define ipatch_iter_count()
#define IPATCH_ITER_GSLIST_GET_LIST()
#define IPATCH_ITER_GSLIST_GET_POS()
#define IPATCH_ITER_GSLIST_SET_LIST()
#define IPATCH_ITER_GSLIST_SET_POS()
void ipatch_iter_GSList_init ()
gpointer ipatch_iter_GSList_get ()
gpointer ipatch_iter_GSList_next ()
gpointer ipatch_iter_GSList_first ()
gpointer ipatch_iter_GSList_last ()
gpointer ipatch_iter_GSList_index ()
void ipatch_iter_GSList_insert ()
void ipatch_iter_GSList_remove ()
int ipatch_iter_GSList_count ()
#define IPATCH_ITER_GLIST_GET_LIST()
#define IPATCH_ITER_GLIST_GET_POS()
#define IPATCH_ITER_GLIST_SET_LIST()
#define IPATCH_ITER_GLIST_SET_POS()
void ipatch_iter_GList_init ()
gpointer ipatch_iter_GList_get ()
gpointer ipatch_iter_GList_next ()
gpointer ipatch_iter_GList_first ()
gpointer ipatch_iter_GList_last ()
gpointer ipatch_iter_GList_index ()
void ipatch_iter_GList_insert ()
void ipatch_iter_GList_remove ()
int ipatch_iter_GList_count ()
#define IPATCH_ITER_ARRAY_GET_ARRAY()
#define IPATCH_ITER_ARRAY_GET_SIZE()
#define IPATCH_ITER_ARRAY_GET_POS()
#define IPATCH_ITER_ARRAY_SET_ARRAY()
#define IPATCH_ITER_ARRAY_SET_SIZE()
#define IPATCH_ITER_ARRAY_SET_POS()
void ipatch_iter_array_init ()
gpointer ipatch_iter_array_get ()
gpointer ipatch_iter_array_next ()
gpointer ipatch_iter_array_first ()
gpointer ipatch_iter_array_last ()
gpointer ipatch_iter_array_index ()
void ipatch_iter_array_insert ()
void ipatch_iter_array_remove ()
int ipatch_iter_array_count ()

Types and Values

Object Hierarchy

    GBoxed
    ╰── IpatchIter

Description

A boxed type (structure) used for abstracting manipulation of object lists.

Functions

ipatch_iter_alloc ()

IpatchIter *
ipatch_iter_alloc (void);

Allocates an item iterator. This function is seldom used since IpatchIter structures are usually allocated on the stack.

[skip]

Returns

Newly allocated item iterator. Should be freed with ipatch_iter_free() when finished with it.


ipatch_iter_free ()

void
ipatch_iter_free (IpatchIter *iter);

Frees an item iterator that was allocated with ipatch_iter_alloc(). Seldom used since IpatchIter structures are usually allocated on the stack.

[skip]

Parameters

iter

Item iterator

 

ipatch_iter_duplicate ()

IpatchIter *
ipatch_iter_duplicate (IpatchIter *iter);

Duplicates a patch iterator. Seldom used since IpatchIter structures are usually allocated on the stack and can be copied directly.

[skip]

Parameters

iter

Patch iterator to duplicate

 

Returns

Newly allocated patch iter identical to iter . Free it with ipatch_iter_free() when finished.


ipatch_iter_get()

#define ipatch_iter_get(iter) (((iter)->methods->get)(iter))

ipatch_iter_next()

#define ipatch_iter_next(iter) (((iter)->methods->next)(iter))

ipatch_iter_first()

#define ipatch_iter_first(iter) (((iter)->methods->first)(iter))

ipatch_iter_last()

#define ipatch_iter_last(iter) (((iter)->methods->last)(iter))

ipatch_iter_index()

#define ipatch_iter_index(iter, pos) (((iter)->methods->index)(iter, pos))

ipatch_iter_insert()

#define ipatch_iter_insert(iter, item) (((iter)->methods->insert)(iter, item))

ipatch_iter_remove()

#define ipatch_iter_remove(iter) (((iter)->methods->remove)(iter))

ipatch_iter_count()

#define ipatch_iter_count(iter) (((iter)->methods->count)(iter))

IPATCH_ITER_GSLIST_GET_LIST()

#define IPATCH_ITER_GSLIST_GET_LIST(iter) ((GSList **)(iter->data))

IPATCH_ITER_GSLIST_GET_POS()

#define IPATCH_ITER_GSLIST_GET_POS(iter) ((GSList *)(iter->data2))

IPATCH_ITER_GSLIST_SET_LIST()

#define IPATCH_ITER_GSLIST_SET_LIST(iter, list) (iter->data = list)

IPATCH_ITER_GSLIST_SET_POS()

#define IPATCH_ITER_GSLIST_SET_POS(iter, pos) (iter->data2 = pos)

ipatch_iter_GSList_init ()

void
ipatch_iter_GSList_init (IpatchIter *iter,
                         GSList **list);

Initialize an iterator to iterate over a GSList.

[skip]

Parameters

iter

Iterator to initialize

 

list

Pointer to root GSList pointer to initialize iterator to

 

ipatch_iter_GSList_get ()

gpointer
ipatch_iter_GSList_get (IpatchIter *iter);

GSList item iterator method to get the current item.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

Returns

Current item or NULL if no current item.


ipatch_iter_GSList_next ()

gpointer
ipatch_iter_GSList_next (IpatchIter *iter);

GSList item iterator method to get the next item and advance the iterator's position.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

Returns

Next item or NULL if no more items.


ipatch_iter_GSList_first ()

gpointer
ipatch_iter_GSList_first (IpatchIter *iter);

GSList item iterator method to get the first item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

Returns

First item or NULL if GSList is empty.


ipatch_iter_GSList_last ()

gpointer
ipatch_iter_GSList_last (IpatchIter *iter);

GSList item iterator method to get the last item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

Returns

Last item or NULL if GSList is empty.


ipatch_iter_GSList_index ()

gpointer
ipatch_iter_GSList_index (IpatchIter *iter,
                          int index);

GSList item iterator method to get an item at a given index and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

index

Index, from 0, of item to get

 

Returns

item at the index position or NULL if index is off the end of the GSList.


ipatch_iter_GSList_insert ()

void
ipatch_iter_GSList_insert (IpatchIter *iter,
                           gpointer item);

GSList item iterator method to insert an item pointer.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

item

Pointer to insert

 

ipatch_iter_GSList_remove ()

void
ipatch_iter_GSList_remove (IpatchIter *iter);

GSList item iterator method to remove the current item and advance the current position.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

ipatch_iter_GSList_count ()

int
ipatch_iter_GSList_count (IpatchIter *iter);

GSList item iterator method to get the count of items.

[skip]

Parameters

iter

Item iterator initialized with a GSList

 

Returns

Count of items in GSList iterator.


IPATCH_ITER_GLIST_GET_LIST()

#define IPATCH_ITER_GLIST_GET_LIST(iter) ((GList **)(iter->data))

IPATCH_ITER_GLIST_GET_POS()

#define IPATCH_ITER_GLIST_GET_POS(iter) ((GList *)(iter->data2))

IPATCH_ITER_GLIST_SET_LIST()

#define IPATCH_ITER_GLIST_SET_LIST(iter, list) (iter->data = list)

IPATCH_ITER_GLIST_SET_POS()

#define IPATCH_ITER_GLIST_SET_POS(iter, pos) (iter->data2 = pos)

ipatch_iter_GList_init ()

void
ipatch_iter_GList_init (IpatchIter *iter,
                        GList **list);

Initialize an iterator to iterate over a GList.

[skip]

Parameters

iter

Iterator to initialize

 

list

Pointer to root GList pointer to initialize iterator to

 

ipatch_iter_GList_get ()

gpointer
ipatch_iter_GList_get (IpatchIter *iter);

GList item iterator method to get the current item.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

Returns

Current item or NULL if no current item.


ipatch_iter_GList_next ()

gpointer
ipatch_iter_GList_next (IpatchIter *iter);

GList item iterator method to get the next item and advance the iterator's position.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

Returns

Next item or NULL if no more items.


ipatch_iter_GList_first ()

gpointer
ipatch_iter_GList_first (IpatchIter *iter);

GList item iterator method to get the first item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

Returns

First item or NULL if GList is empty.


ipatch_iter_GList_last ()

gpointer
ipatch_iter_GList_last (IpatchIter *iter);

GList item iterator method to get the last item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

Returns

Last item or NULL if GList is empty.


ipatch_iter_GList_index ()

gpointer
ipatch_iter_GList_index (IpatchIter *iter,
                         int index);

GList item iterator method to get an item at a given index and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

index

Index, from 0, of item to get

 

Returns

item at the index position or NULL if index is off the end of the GList.


ipatch_iter_GList_insert ()

void
ipatch_iter_GList_insert (IpatchIter *iter,
                          gpointer item);

GList item iterator method to insert an item pointer.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

item

Pointer to insert

 

ipatch_iter_GList_remove ()

void
ipatch_iter_GList_remove (IpatchIter *iter);

GList item iterator method to remove the current item and advance the current position.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

ipatch_iter_GList_count ()

int
ipatch_iter_GList_count (IpatchIter *iter);

GList item iterator method to get the count of items.

[skip]

Parameters

iter

Item iterator initialized with a GList

 

Returns

Count of items in GList iterator.


IPATCH_ITER_ARRAY_GET_ARRAY()

#define IPATCH_ITER_ARRAY_GET_ARRAY(iter) ((gpointer *)(iter->data))

IPATCH_ITER_ARRAY_GET_SIZE()

#define IPATCH_ITER_ARRAY_GET_SIZE(iter) (GPOINTER_TO_UINT (iter->data2))

IPATCH_ITER_ARRAY_GET_POS()

#define IPATCH_ITER_ARRAY_GET_POS(iter) (GPOINTER_TO_INT (iter->data3))

IPATCH_ITER_ARRAY_SET_ARRAY()

#define IPATCH_ITER_ARRAY_SET_ARRAY(iter, array) (iter->data = array)

IPATCH_ITER_ARRAY_SET_SIZE()

#define             IPATCH_ITER_ARRAY_SET_SIZE(iter, size)

IPATCH_ITER_ARRAY_SET_POS()

#define             IPATCH_ITER_ARRAY_SET_POS(iter, pos)

ipatch_iter_array_init ()

void
ipatch_iter_array_init (IpatchIter *iter,
                        gpointer *array,
                        guint size);

Initialize an iterator to iterate over an array (read only).

[skip]

Parameters

iter

Iterator to initialize

 

array

Pointer to an array of pointers

 

size

Count of elements in array .

 

ipatch_iter_array_get ()

gpointer
ipatch_iter_array_get (IpatchIter *iter);

Array item iterator method to get the current item.

[skip]

Parameters

iter

Item iterator initialized with an array

 

Returns

Current item or NULL if no current item.


ipatch_iter_array_next ()

gpointer
ipatch_iter_array_next (IpatchIter *iter);

Array item iterator method to get the next item and advance the iterator's position.

[skip]

Parameters

iter

Item iterator initialized with an array

 

Returns

Next item or NULL if no more items.


ipatch_iter_array_first ()

gpointer
ipatch_iter_array_first (IpatchIter *iter);

Array item iterator method to get the first item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with an array

 

Returns

First item or NULL if array is empty.


ipatch_iter_array_last ()

gpointer
ipatch_iter_array_last (IpatchIter *iter);

Array item iterator method to get the last item and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with an array

 

Returns

Last item or NULL if array is empty.


ipatch_iter_array_index ()

gpointer
ipatch_iter_array_index (IpatchIter *iter,
                         int index);

Array item iterator method to get an item at a given index and set the iterator's position to it.

[skip]

Parameters

iter

Item iterator initialized with an array

 

index

Index, from 0, of item to get

 

Returns

item at the index position or NULL if index is off the end of the array.


ipatch_iter_array_insert ()

void
ipatch_iter_array_insert (IpatchIter *iter,
                          gpointer item);

array item iterator method to insert an item pointer.

[skip]

Parameters

iter

Item iterator initialized with a array

 

item

Pointer to insert

 

ipatch_iter_array_remove ()

void
ipatch_iter_array_remove (IpatchIter *iter);

array item iterator method to remove the current item and advance the current position.

[skip]

Parameters

iter

Item iterator initialized with a array

 

ipatch_iter_array_count ()

int
ipatch_iter_array_count (IpatchIter *iter);

array item iterator method to get the count of items.

[skip]

Parameters

iter

Item iterator initialized with a array

 

Returns

Count of items in array iterator.

Types and Values

struct IpatchIterMethods

struct IpatchIterMethods {
    gpointer(*get)(IpatchIter *iter);  /* get item method */
    gpointer(*next)(IpatchIter *iter);  /* next item method */
    gpointer(*first)(IpatchIter *iter); /* first item method */
    gpointer(*last)(IpatchIter *iter);  /* last item method */
    gpointer(*index)(IpatchIter *iter, int index);  /* index item method */
    void (*insert)(IpatchIter *iter, gpointer item); /* insert item method */
    void (*remove)(IpatchIter *iter); /* remove current item method */
    int (*count)(IpatchIter *iter); /* count items method */
};