142 GDestroyNotify element_destroy_func) ;
335 #define G_PTR_ARRAY_REMOVE_ALL(array) if (array->len>0) g_ptr_array_remove_range(array,0,array->len)
346 #define G_ARRAY_CONCAT(dest,src) g_array_append_vals(dest,src->data,src->len)
354 #define G_ARRAY_REMOVE_ALL(array) if (array->len>0) g_array_remove_range(array,0,array->len)
373 int g_array_find(GArray *array, gpointer element, gint elementSize,GCompareFunc func);
ElementType setType
Element type of key.
Definition: collection.h:69
Specify that collection elements are user-defined type.
Definition: collection.h:47
void hashSet_destroy(HashSet *hashSet)
Free the hashSet instance.
GArray * g_array_copy(GArray *dest, GArray *src)
Copy from another GArray.
int g_array_find(GArray *array, gpointer element, gint elementSize, GCompareFunc func)
Find an element in a GArray.
HashSet * hashSet_new_full(ElementType type, GHashFunc hash_func, GEqualFunc element_equal_func, GDestroyNotify element_destroy_func)
New a HashSet instance, while specifying element destroy function.
GHashTable * hTable
The backing GHashTable.
Definition: collection.h:68
void hashSet_union(HashSet *result, HashSet *hashSet1, HashSet *hashSet2)
Union two sets.
Specify that collection elements are pointers.
Definition: collection.h:46
HashSet * hashSet_new_default(ElementType type)
New a HashSet instance with default handling functions.
int integer_compareFunc(gconstpointer a, gconstpointer b)
GCompareFunc that compares two intergers.
void hashSet_steal_all(HashSet *hashSet)
Steal all elements in the set.
HashSet: A set which backed by Hash Table.
Definition: collection.h:67
gboolean hashSet_steal_element(HashSet *hashSet, gconstpointer element)
Steal an element to the HashSet.
gboolean hashSet_add_element(HashSet *hashSet, gpointer element)
Add an element to the HashSet.
HashSet * hashSet_new(ElementType type, GHashFunc hash_func, GEqualFunc element_equal_func)
New a HashSet instance.
Specify that collection elements are integers.
Definition: collection.h:44
guint hashSet_get_size(HashSet *hashSet)
Get the number of elements in the HashSet.
void hashSet_copy(HashSet *dest, HashSet *src)
Copy from another HashSet.
void hashSet_remove_all(HashSet *hashSet)
Remove all elements in the set.
void hashSet_intersect(HashSet *result, HashSet *hashSet1, HashSet *hashSet2)
Intersect two sets.
Specify that collection elements are strings.
Definition: collection.h:45
gboolean(* ForeachCallbackFunc)(gpointer data, gpointer userdata)
Foreach callback function prototype.
Definition: collection.h:82
char * hashSet_to_string(HashSet *hashSet)
New a string representation for the content of the HashSet.
ElementType
Enumeration of element types which the collection stores.
Definition: collection.h:43
gboolean hashSet_remove_element(HashSet *hashSet, gconstpointer element)
Remove an element to the HashSet.
gboolean hashSet_has_element(HashSet *hashSet, gconstpointer element)
Whether a element is in the HashSet.