collection

collection

Synopsis




#define             G_ARRAY_COPY                        (dest,src)
#define             G_ARRAY_REMOVE_ALL                  (array)
#define             G_PTR_ARRAY_REMOVE_ALL              (array)
gboolean            (*ForeachCallbackFunc)              (gpointer data,
                                                         gpointer userdata);
enum                SetType;
                    HashSet;
HashSet*            hashSet_new_auto                    (SetType type);
HashSet*            hashSet_new                         (SetType type,
                                                         GHashFunc hash_func,
                                                         GEqualFunc key_equal_func);
HashSet*            hashSet_new_full                    (SetType type,
                                                         GHashFunc hash_func,
                                                         GEqualFunc key_equal_func,
                                                         GDestroyNotify key_destroy_func,
                                                         GDestroyNotify value_destroy_func);
void                hashSet_reset                       (HashSet *s);
void                hashSet_copy                        (HashSet *dest,
                                                         HashSet *src);
guint               hashSet_get_size                    (HashSet *s);
gboolean            hashSet_has_element                 (HashSet *set,
                                                         gconstpointer key);
GList*              hashSet_get_elements                (HashSet *s);
gboolean            hashSet_add_element                 (HashSet *s,
                                                         gpointer key);
gboolean            hashSet_remove_element              (HashSet *s,
                                                         gconstpointer key);
void                hashSet_union                       (HashSet *result,
                                                         HashSet *s1,
                                                         HashSet *s2);
void                hashSet_interset                    (HashSet *result,
                                                         HashSet *s1,
                                                         HashSet *s2);
gchar*              hashSet_to_string                   (HashSet *s);
void                hashSet_destroy                     (HashSet *s);
gint                integer_compareFunc                 (gconstpointer a,
                                                         gconstpointer b);
gint                g_array_find                        (GArray *array,
                                                         gpointer key,
                                                         gint keySize,
                                                         GCompareFunc func);
GArray*             g_array_copy                        (GArray *dest,
                                                         GArray *src);

Description

Details

G_ARRAY_COPY()

#define G_ARRAY_COPY(dest,src) g_array_append_vals(dest,src->data,src->len)

dest :

src :


G_ARRAY_REMOVE_ALL()

#define G_ARRAY_REMOVE_ALL(array) if (array->len>0) g_array_remove_range(array,0,array->len)

array :


G_PTR_ARRAY_REMOVE_ALL()

#define G_PTR_ARRAY_REMOVE_ALL(array)if (array->len>0) g_ptr_array_remove_range(array,0,array->len)

array :


ForeachCallbackFunc ()

gboolean            (*ForeachCallbackFunc)              (gpointer data,
                                                         gpointer userdata);

A prototype for callback functions that used with foreach functions.

data :

the element in collection

userdata :

other option for the callback function.

Returns :

TRUE to continue, FALSE to break.

enum SetType

typedef enum{
    INTEGER_SET,
    STRING_SET,
    DIRECT_SET,
    CUSTOM_SET
} SetType;

Specify what will be stored in the set.

INTEGER_SET

STRING_SET

Specify that set elements are strings

DIRECT_SET

Specify that set elements are pointers

CUSTOM_SET

Used if non of above fit the need.

HashSet

typedef struct {
    GHashTable *hTable;
    SetType setType;
} HashSet;


hashSet_new_auto ()

HashSet*            hashSet_new_auto                    (SetType type);

type :

Returns :


hashSet_new ()

HashSet*            hashSet_new                         (SetType type,
                                                         GHashFunc hash_func,
                                                         GEqualFunc key_equal_func);

type :

hash_func :

key_equal_func :

Returns :


hashSet_new_full ()

HashSet*            hashSet_new_full                    (SetType type,
                                                         GHashFunc hash_func,
                                                         GEqualFunc key_equal_func,
                                                         GDestroyNotify key_destroy_func,
                                                         GDestroyNotify value_destroy_func);

type :

hash_func :

key_equal_func :

key_destroy_func :

value_destroy_func :

Returns :


hashSet_reset ()

void                hashSet_reset                       (HashSet *s);

s :


hashSet_copy ()

void                hashSet_copy                        (HashSet *dest,
                                                         HashSet *src);

dest :

src :


hashSet_get_size ()

guint               hashSet_get_size                    (HashSet *s);

s :

Returns :


hashSet_has_element ()

gboolean            hashSet_has_element                 (HashSet *set,
                                                         gconstpointer key);

set :

key :

Returns :


hashSet_get_elements ()

GList*              hashSet_get_elements                (HashSet *s);

s :

Returns :


hashSet_add_element ()

gboolean            hashSet_add_element                 (HashSet *s,
                                                         gpointer key);

s the HashSet key the element to be insert

s :

key :

Returns :


hashSet_remove_element ()

gboolean            hashSet_remove_element              (HashSet *s,
                                                         gconstpointer key);

s :

key :

Returns :


hashSet_union ()

void                hashSet_union                       (HashSet *result,
                                                         HashSet *s1,
                                                         HashSet *s2);

result :

s1 :

s2 :


hashSet_interset ()

void                hashSet_interset                    (HashSet *result,
                                                         HashSet *s1,
                                                         HashSet *s2);

result :

s1 :

s2 :


hashSet_to_string ()

gchar*              hashSet_to_string                   (HashSet *s);

s :

Returns :


hashSet_destroy ()

void                hashSet_destroy                     (HashSet *s);

s :


integer_compareFunc ()

gint                integer_compareFunc                 (gconstpointer a,
                                                         gconstpointer b);

a :

b :

Returns :


g_array_find ()

gint                g_array_find                        (GArray *array,
                                                         gpointer key,
                                                         gint keySize,
                                                         GCompareFunc func);

array :

key :

keySize :

func :

Returns :


g_array_copy ()

GArray*             g_array_copy                        (GArray *dest,
                                                         GArray *src);

dest :

src :

Returns :