Companion

object Companion

Functions

Link copied to clipboard
fun add(hashTable: HashTable, key: <Error class: unknown class>? = null): Boolean

This is a convenience function for using a #GHashTable as a set. It is equivalent to calling g_hash_table_replace() with @key as both the key and the value.

Link copied to clipboard
fun contains(hashTable: HashTable, key: <Error class: unknown class>? = null): Boolean

Checks if @key is in @hash_table.

Link copied to clipboard
fun destroy(hashTable: HashTable)

Destroys all keys and values in the #GHashTable and decrements its reference count by 1. If keys and/or values are dynamically allocated, you should either free them first or create the #GHashTable with destroy notifiers using g_hash_table_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values during the destruction phase.

Link copied to clipboard
fun find(hashTable: HashTable, predicate: HrFunc): <Error class: unknown class>?

Calls the given function for key/value pairs in the #GHashTable until @predicate returns true. The function is passed the key and value of each pair, and the given @user_data parameter. The hash table may not be modified while iterating over it (you can't add/remove items).

Link copied to clipboard
fun foreach(hashTable: HashTable, func: HFunc)

Calls the given function for each of the key/value pairs in the #GHashTable. The function is passed the key and value of each pair, and the given @user_data parameter. The hash table may not be modified while iterating over it (you can't add/remove items). To remove all items matching a predicate, use g_hash_table_foreach_remove().

Link copied to clipboard
fun foreachRemove(hashTable: HashTable, func: HrFunc): <Error class: unknown class>

Calls the given function for each key/value pair in the #GHashTable. If the function returns true, then the key/value pair is removed from the #GHashTable. If you supplied key or value destroy functions when creating the #GHashTable, they are used to free the memory allocated for the removed keys and values.

Link copied to clipboard
fun foreachSteal(hashTable: HashTable, func: HrFunc): <Error class: unknown class>

Calls the given function for each key/value pair in the #GHashTable. If the function returns true, then the key/value pair is removed from the #GHashTable, but no key or value destroy functions are called.

Link copied to clipboard
fun getKeys(hashTable: HashTable): List

Retrieves every key inside @hash_table. The returned data is valid until changes to the hash release those keys.

Link copied to clipboard
fun getType(): <Error class: unknown class>

Get the GType of HashTable

Link copied to clipboard
fun getValues(hashTable: HashTable): List

Retrieves every value inside @hash_table. The returned data is valid until @hash_table is modified.

Link copied to clipboard
fun insert(hashTable: HashTable, key: <Error class: unknown class>? = null, value: <Error class: unknown class>? = null): Boolean

Inserts a new key and value into a #GHashTable.

Link copied to clipboard
fun lookup(hashTable: HashTable, key: <Error class: unknown class>? = null): <Error class: unknown class>?

Looks up a key in a #GHashTable. Note that this function cannot distinguish between a key that is not present and one which is present and has the value null. If you need this distinction, use g_hash_table_lookup_extended().

Link copied to clipboard
fun newSimilar(otherHashTable: HashTable): HashTable

Creates a new #GHashTable like g_hash_table_new_full() with a reference count of 1.

Link copied to clipboard
fun ref(hashTable: HashTable): HashTable

Atomically increments the reference count of @hash_table by one. This function is MT-safe and may be called from any thread.

Link copied to clipboard
fun remove(hashTable: HashTable, key: <Error class: unknown class>? = null): Boolean

Removes a key and its associated value from a #GHashTable.

Link copied to clipboard
fun removeAll(hashTable: HashTable)

Removes all keys and their associated values from a #GHashTable.

Link copied to clipboard
fun replace(hashTable: HashTable, key: <Error class: unknown class>? = null, value: <Error class: unknown class>? = null): Boolean

Inserts a new key and value into a #GHashTable similar to g_hash_table_insert(). The difference is that if the key already exists in the #GHashTable, it gets replaced by the new key. If you supplied a @value_destroy_func when creating the #GHashTable, the old value is freed using that function. If you supplied a @key_destroy_func when creating the #GHashTable, the old key is freed using that function.

Link copied to clipboard
fun size(hashTable: HashTable): <Error class: unknown class>

Returns the number of elements contained in the #GHashTable.

Link copied to clipboard
fun steal(hashTable: HashTable, key: <Error class: unknown class>? = null): Boolean

Removes a key and its associated value from a #GHashTable without calling the key and value destroy functions.

Link copied to clipboard
fun stealAll(hashTable: HashTable)

Removes all keys and their associated values from a #GHashTable without calling the key and value destroy functions.

Link copied to clipboard
fun unref(hashTable: HashTable)

Atomically decrements the reference count of @hash_table by one. If the reference count drops to 0, all keys and values will be destroyed, and all memory allocated by the hash table is released. This function is MT-safe and may be called from any thread.