KatzeArray

KatzeArray — A type aware item container

Functions

Types and Values

extern GList* kalistglobal

Includes

#include <katze/katze.h>

Description

KatzeArray is a type aware container for items.

Functions

katze_array_new ()

KatzeArray *
katze_array_new (GType type);

Creates a new KatzeArray for type items.

The array will keep a reference on each object until it is removed from the array.

Parameters

type

the expected item type

 

Returns

a new KatzeArray.

[transfer full]


katze_array_is_a ()

gboolean
katze_array_is_a (KatzeArray *array,
                  GType is_a_type);

Checks whether the array is compatible with items of the specified type.

Parameters

array

a KatzeArray

 

is_a_type

type to compare with

 

Returns

TRUE if array is compatible with is_a_type


katze_array_add_item ()

void
katze_array_add_item (KatzeArray *array,
                      gpointer item);

Adds an item to the array.

If item is a KatzeItem its parent is set accordingly.

Parameters

array

a KatzeArray

 

item

an item.

[type GObject][transfer none]

katze_array_remove_item ()

void
katze_array_remove_item (KatzeArray *array,
                         gpointer item);

Removes an item from the array.

If item is a KatzeItem its parent is unset accordingly.

Parameters

array

a KatzeArray

 

item

an item.

[type GObject]

katze_array_get_nth_item ()

gpointer
katze_array_get_nth_item (KatzeArray *array,
                          guint n);

Retrieves the item in array at the position n .

Parameters

array

a KatzeArray

 

n

an index in the array

 

Returns

an item, or NULL.

[type GObject][transfer none]


katze_array_is_empty ()

gboolean
katze_array_is_empty (KatzeArray *array);

Determines whether array is empty.

Parameters

array

a KatzeArray

 

Returns

TRUE if the array is empty


katze_array_get_item_index ()

gint
katze_array_get_item_index (KatzeArray *array,
                            gpointer item);

Retrieves the index of the item in array .

Parameters

array

a KatzeArray

 

item

an item in the array.

[type GObject]

Returns

the index of the item, or -1 if the item is not present in the array


katze_array_find_token ()

gpointer
katze_array_find_token (KatzeArray *array,
                        const gchar *token);

Looks up an item in the array which has the specified token.

This function will fail and return NULL if the KatzeArray's element type is not based on KatzeItem.

Note that token is by definition unique to one item.

Since 0.4.4 token can be a "token keywords" string.

Parameters

array

a KatzeArray

 

token

a token string, or "token keywords" string

 

Returns

an item, or NULL.

[type GObject][transfer none]


katze_array_find_uri ()

gpointer
katze_array_find_uri (KatzeArray *array,
                      const gchar *uri);

Looks up an item in the array which has the specified URI.

This function will fail and return NULL if the KatzeArray's element type is not based on KatzeItem.

Parameters

array

a KatzeArray

 

uri

an URI

 

Returns

an item, or NULL.

[type GObject][transfer none]

Since: 0.2.0


katze_array_get_length ()

guint
katze_array_get_length (KatzeArray *array);

Retrieves the number of items in array .

Parameters

array

a KatzeArray

 

Returns

the length of the KatzeArray


katze_array_move_item ()

void
katze_array_move_item (KatzeArray *array,
                       gpointer item,
                       gint position);

Moves item to the position position .

Parameters

array

a KatzeArray

 

item

the item being moved.

[type GObject]

position

the new position of the item

 

Since: 0.1.6


katze_array_get_items ()

GList *
katze_array_get_items (KatzeArray *array);

Retrieves the items as a list.

Parameters

array

a KatzeArray

 

Returns

a newly allocated GList of items.

[element-type GObject][transfer container]

Since: 0.2.5


katze_array_peek_items ()

GList *
katze_array_peek_items (KatzeArray *array);

Peeks at the KatzeArray's internal list of items.

Parameters

array

a KatzeArray

 

Returns

the KatzeArray's internal GList of items.

[element-type GObject][transfer none]


KATZE_ARRAY_FOREACH_ITEM()

#define             KATZE_ARRAY_FOREACH_ITEM(kaitem, kaarray)

KATZE_ARRAY_FOREACH_ITEM_L()

#define             KATZE_ARRAY_FOREACH_ITEM_L(kaitem, kaarray, kalist)

katze_array_clear ()

void
katze_array_clear (KatzeArray *array);

Deletes all items currently contained in array .

Parameters

array

a KatzeArray

 

katze_array_update ()

void
katze_array_update (KatzeArray *array);

Indicates that the array changed and any display widgets should be updated.

Parameters

array

a KatzeArray

 

Since: 0.3.0

Types and Values

kalistglobal

extern GList* kalistglobal;

See Also

KatzeList