![]() |
![]() |
![]() |
libInstPatch Reference Manual | ![]() |
---|---|---|---|---|
IpatchIter; IpatchIterMethods; #define IPATCH_TYPE_ITER GType ipatch_iter_get_type (void); IpatchIter* ipatch_iter_alloc (void); void ipatch_iter_free (IpatchIter *iter); IpatchIter* ipatch_iter_duplicate (IpatchIter *iter); #define ipatch_iter_get (iter) #define ipatch_iter_next (iter) #define ipatch_iter_first (iter) #define ipatch_iter_last (iter) #define ipatch_iter_index (iter, pos) #define ipatch_iter_insert (iter, item) #define ipatch_iter_remove (iter) #define ipatch_iter_count (iter) void ipatch_iter_GSList_init (IpatchIter *iter, GSList **list); gpointer ipatch_iter_GSList_get (IpatchIter *iter); gpointer ipatch_iter_GSList_next (IpatchIter *iter); gpointer ipatch_iter_GSList_first (IpatchIter *iter); gpointer ipatch_iter_GSList_last (IpatchIter *iter); gpointer ipatch_iter_GSList_index (IpatchIter *iter, int index); void ipatch_iter_GSList_insert (IpatchIter *iter, gpointer item); void ipatch_iter_GSList_remove (IpatchIter *iter); int ipatch_iter_GSList_count (IpatchIter *iter); void ipatch_iter_GList_init (IpatchIter *iter, GList **list); gpointer ipatch_iter_GList_get (IpatchIter *iter); gpointer ipatch_iter_GList_next (IpatchIter *iter); gpointer ipatch_iter_GList_first (IpatchIter *iter); gpointer ipatch_iter_GList_last (IpatchIter *iter); gpointer ipatch_iter_GList_index (IpatchIter *iter, int index); void ipatch_iter_GList_insert (IpatchIter *iter, gpointer item); void ipatch_iter_GList_remove (IpatchIter *iter); int ipatch_iter_GList_count (IpatchIter *iter);
Iterators provide a common high performance low level interface to lists of data of possibly differing underlying structure. This allows for future backwards compatible changes to the underlying structure, as long as this interface is used. If high performance is not of concern then the IpatchList object is probably a better option (which itself can use the IpatchIter interface). Certain IpatchIter lists require locking during usage, including most IpatchContainer child lists.
Examples of lists covered by this interface include: IpatchContainer child lists, IpatchList objects, and IpatchSF2Zone generator arrays.
typedef struct { } IpatchIter;
Object iterator structure. All fields are public and can be freely manipulated
as long as any objects added to the list are ref'd and any objects removed
are unref'd. Also, the pos
field should be set to NULL if it points to a
list node that gets removed.
typedef struct { 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 */ } IpatchIterMethods;
#define IPATCH_TYPE_ITER (ipatch_iter_get_type ())
Gets the GType of patch iterators (GBoxed type).
GType ipatch_iter_get_type (void);
Gets the GBoxed derived type for IpatchIter structures.
Returns : | GType of IpatchIter structures. |
IpatchIter* ipatch_iter_alloc (void);
Allocates an item iterator. This function is seldom used since IpatchIter structures are usually allocated on the stack.
Returns : | Newly allocated item iterator. Should be freed with
ipatch_iter_free() when finished with it.
|
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.
iter : |
Item iterator |
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.
iter : |
Patch iterator to duplicate |
Returns : | Newly allocated patch iter identical to iter . Free it with
ipatch_iter_free() when finished.
|
#define ipatch_iter_first(iter) (((iter)->methods->first)(iter))
iter : |
|
Returns : |
#define ipatch_iter_index(iter, pos) (((iter)->methods->index)(iter, pos))
iter : |
|
pos : |
#define ipatch_iter_insert(iter, item) (((iter)->methods->insert)(iter, item))
iter : |
|
item : |
void ipatch_iter_GSList_init (IpatchIter *iter, GSList **list);
Initialize an iterator to iterate over a GSList.
iter : |
Iterator to initialize |
list : |
Pointer to root GSList pointer to initialize iterator to |
gpointer ipatch_iter_GSList_get (IpatchIter *iter);
GSList item iterator method to get the current item.
iter : |
Item iterator initialized with a GSList |
Returns : | Current item or NULL if no current item.
|
gpointer ipatch_iter_GSList_next (IpatchIter *iter);
GSList item iterator method to get the next item and advance the iterator's position.
iter : |
Item iterator initialized with a GSList |
Returns : | Next item or NULL if no more items.
|
gpointer ipatch_iter_GSList_first (IpatchIter *iter);
GSList item iterator method to get the first item and set the iterator's position to it.
iter : |
Item iterator initialized with a GSList |
Returns : | First item or NULL if GSList is empty.
|
gpointer ipatch_iter_GSList_last (IpatchIter *iter);
GSList item iterator method to get the last item and set the iterator's position to it.
iter : |
Item iterator initialized with a GSList |
Returns : | Last item or NULL if GSList is empty.
|
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.
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.
|
void ipatch_iter_GSList_insert (IpatchIter *iter, gpointer item);
GSList item iterator method to insert an item pointer.
iter : |
Item iterator initialized with a GSList |
item : |
Pointer to insert |
void ipatch_iter_GSList_remove (IpatchIter *iter);
GSList item iterator method to remove the current item and advance the current position.
iter : |
Item iterator initialized with a GSList |
int ipatch_iter_GSList_count (IpatchIter *iter);
GSList item iterator method to get the count of items.
iter : |
Item iterator initialized with a GSList |
Returns : | Count of items in GSList iterator. |
void ipatch_iter_GList_init (IpatchIter *iter, GList **list);
Initialize an iterator to iterate over a GList.
iter : |
Iterator to initialize |
list : |
Pointer to root GList pointer to initialize iterator to |
gpointer ipatch_iter_GList_get (IpatchIter *iter);
GList item iterator method to get the current item.
iter : |
Item iterator initialized with a GList |
Returns : | Current item or NULL if no current item.
|
gpointer ipatch_iter_GList_next (IpatchIter *iter);
GList item iterator method to get the next item and advance the iterator's position.
iter : |
Item iterator initialized with a GList |
Returns : | Next item or NULL if no more items.
|
gpointer ipatch_iter_GList_first (IpatchIter *iter);
GList item iterator method to get the first item and set the iterator's position to it.
iter : |
Item iterator initialized with a GList |
Returns : | First item or NULL if GList is empty.
|
gpointer ipatch_iter_GList_last (IpatchIter *iter);
GList item iterator method to get the last item and set the iterator's position to it.
iter : |
Item iterator initialized with a GList |
Returns : | Last item or NULL if GList is empty.
|
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.
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.
|
void ipatch_iter_GList_insert (IpatchIter *iter, gpointer item);
GList item iterator method to insert an item pointer.
iter : |
Item iterator initialized with a GList |
item : |
Pointer to insert |
void ipatch_iter_GList_remove (IpatchIter *iter);
GList item iterator method to remove the current item and advance the current position.
iter : |
Item iterator initialized with a GList |
int ipatch_iter_GList_count (IpatchIter *iter);
GList item iterator method to get the count of items.
iter : |
Item iterator initialized with a GList |
Returns : | Count of items in GList iterator. |