OobsList

OobsList — Object to deal with several configuration elements.

Synopsis




#define             OOBS_TYPE_LIST_ITER
                    OobsListIter;
                    OobsList;
gboolean            oobs_list_get_iter_first            (OobsList *list,
                                                         OobsListIter *iter);
gboolean            oobs_list_iter_next                 (OobsList *list,
                                                         OobsListIter *iter);
gboolean            oobs_list_remove                    (OobsList *list,
                                                         OobsListIter *iter);
void                oobs_list_append                    (OobsList *list,
                                                         OobsListIter *iter);
void                oobs_list_prepend                   (OobsList *list,
                                                         OobsListIter *iter);
void                oobs_list_insert_after              (OobsList *list,
                                                         OobsListIter *anchor,
                                                         OobsListIter *iter);
void                oobs_list_insert_before             (OobsList *list,
                                                         OobsListIter *anchor,
                                                         OobsListIter *iter);
GObject*            oobs_list_get                       (OobsList *list,
                                                         OobsListIter *iter);
void                oobs_list_set                       (OobsList *list,
                                                         OobsListIter *iter,
                                                         gpointer data);
void                oobs_list_clear                     (OobsList *list);
OobsListIter*       oobs_list_iter_copy                 (OobsListIter *iter);
void                oobs_list_iter_free                 (OobsListIter *iter);
gint                oobs_list_get_n_items               (OobsList *list);

Object Hierarchy


  GObject
   +----OobsList

Properties


  "contained-type"           gpointer              : Write / Construct Only

Description

OobsList is a list object designed to store configuration elements. it provides "security" mechanisms to avoid elements corruption when i.e. underlying configuration is updated. OobsLists are created only by configuration objects, API users are only allowed to modify it.

Some configuration objects (for example, OobsServicesConfig) will provide a locked down list, users will be able to modify the contained elements, but not to add/delete elements, nor to modify the list element at that position with oobs_list_set().

Details

OOBS_TYPE_LIST_ITER

#define OOBS_TYPE_LIST_ITER    (oobs_list_iter_get_type ())


OobsListIter

typedef struct {
  guint stamp;
  gpointer data;
} OobsListIter;

OobsListIter is the element used to iterate through lists and to get/modify elements in it. Fields are not supposed to be modified by the user.

guint stamp; stamp to catch invalid iterators.
gpointer data; iterator data.

OobsList

typedef struct _OobsList OobsList;


oobs_list_get_iter_first ()

gboolean            oobs_list_get_iter_first            (OobsList *list,
                                                         OobsListIter *iter);

Initializes iter the iterator pointing to the first element in list. if list is empty, then FALSE is returned, and iter is not initialized.

list : An OobsList
iter : An uninitialized OobsListIter
Returns : TRUE if iter was set

oobs_list_iter_next ()

gboolean            oobs_list_iter_next                 (OobsList *list,
                                                         OobsListIter *iter);

Sets iter to point to the element following it. If there's no next iter, of if iter was invalid for list, FALSE is returned, and iter is set to invalid.

list : An OobsList
iter : A valid OobsListIter pointing to an element in list
Returns : TRUE if iter has been correctly changed to the next element

oobs_list_remove ()

gboolean            oobs_list_remove                    (OobsList *list,
                                                         OobsListIter *iter);

Removes an element pointed by iter from list. This function will not be effective if list is locked, or if iter doesn't point to an element contained in list.

list : An OobsList
iter : A valid OobsListIter pointing to an element in list
Returns : TRUE if the element was correctly removed

oobs_list_append ()

void                oobs_list_append                    (OobsList *list,
                                                         OobsListIter *iter);

Appends a new element to list. iter will be changed to point to this element, to fill in values, you need to call oobs_list_set().

list : An OobsList
iter : An unset OobsListIter to set to the new element

oobs_list_prepend ()

void                oobs_list_prepend                   (OobsList *list,
                                                         OobsListIter *iter);

Prepends a new element to list. iter will be changed to point to this element, to fill in values, you need to call oobs_list_set().

list : An OobsList
iter : An unset OobsListIter to set to the new element

oobs_list_insert_after ()

void                oobs_list_insert_after              (OobsList *list,
                                                         OobsListIter *anchor,
                                                         OobsListIter *iter);

Inserts a new element after anchor. iter will be changed to point to this element, to fill in values, you need to call oobs_list_set().

list : An OobsList
anchor : A valid OobsListIter
iter : An unset OobsListIter to set to the new element

oobs_list_insert_before ()

void                oobs_list_insert_before             (OobsList *list,
                                                         OobsListIter *anchor,
                                                         OobsListIter *iter);

Inserts a new element before anchor. iter will be changed to point to this element, to fill in values, you need to call oobs_list_set().

list : An OobsList
anchor : A valid OobsListIter
iter : An unset OobsListIter to set to the new element

oobs_list_get ()

GObject*            oobs_list_get                       (OobsList *list,
                                                         OobsListIter *iter);

Retrieves a reference to the element referenced by OobsListIter.

list : an OobsList
iter : a valid OobsListIter for the element being get
Returns : the element referenced by iter

oobs_list_set ()

void                oobs_list_set                       (OobsList *list,
                                                         OobsListIter *iter,
                                                         gpointer data);

Sets the data for the element referenced by OobsListIter. This function will not be effective if the list is locked, or if data GType is different to the data contained in OobsList.

list : an OobsList
iter : a valid OobsListIter for the element being set
data : a pointer to the data being set

oobs_list_clear ()

void                oobs_list_clear                     (OobsList *list);

Removes all contents from an OobsList. This function will not be effective if the list is locked.

list : an OobsList

oobs_list_iter_copy ()

OobsListIter*       oobs_list_iter_copy                 (OobsListIter *iter);

Returns a newly allocated copy of the given iterator. This function is not intended for use in applications, because you can just copy the structs by value (OobsListIter new_iter = iter;). You must free this iter with oobs_list_iter_free().

iter : An OobsListIter.
Returns : A newly allocated iterator.

oobs_list_iter_free ()

void                oobs_list_iter_free                 (OobsListIter *iter);

Frees an iterator that has been allocated in the heap.

iter : An OobsListIter.

oobs_list_get_n_items ()

gint                oobs_list_get_n_items               (OobsList *list);

Returns the number of elements that the list contains.

list : An OobsList.
Returns : the number of elements.

Property Details

The "contained-type" property

  "contained-type"           gpointer              : Write / Construct Only

GType contained in the list.