| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GLib.Structs.HashTableIter
Description
A GHashTableIter structure represents an iterator that can be used
to iterate over the elements of a HashTable. GHashTableIter
structures are typically allocated on the stack and then initialized
with hashTableIterInit.
The iteration order of a HashTableIter over the keys/values in a hash
table is not defined.
Synopsis
- newtype HashTableIter = HashTableIter (ManagedPtr HashTableIter)
- newZeroHashTableIter :: MonadIO m => m HashTableIter
- type family ResolveHashTableIterMethod (t :: Symbol) o where ...
- data HashTableIterGetHashTableMethodInfo
- hashTableIterGetHashTable :: (HasCallStack, MonadIO m) => HashTableIter -> m (Map (Ptr ()) (Ptr ()))
- data HashTableIterInitMethodInfo
- hashTableIterInit :: (HasCallStack, MonadIO m) => HashTableIter -> Map (Ptr ()) (Ptr ()) -> m ()
- data HashTableIterNextMethodInfo
- hashTableIterNext :: (HasCallStack, MonadIO m) => HashTableIter -> m (Bool, Ptr (), Ptr ())
- data HashTableIterRemoveMethodInfo
- hashTableIterRemove :: (HasCallStack, MonadIO m) => HashTableIter -> m ()
- data HashTableIterReplaceMethodInfo
- hashTableIterReplace :: (HasCallStack, MonadIO m) => HashTableIter -> Ptr () -> m ()
- data HashTableIterStealMethodInfo
- hashTableIterSteal :: (HasCallStack, MonadIO m) => HashTableIter -> m ()
Exported types
newtype HashTableIter Source #
Memory-managed wrapper type.
Constructors
| HashTableIter (ManagedPtr HashTableIter) |
Instances
newZeroHashTableIter :: MonadIO m => m HashTableIter Source #
Construct a HashTableIter struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
type family ResolveHashTableIterMethod (t :: Symbol) o where ... Source #
Equations
| ResolveHashTableIterMethod "init" o = HashTableIterInitMethodInfo | |
| ResolveHashTableIterMethod "next" o = HashTableIterNextMethodInfo | |
| ResolveHashTableIterMethod "remove" o = HashTableIterRemoveMethodInfo | |
| ResolveHashTableIterMethod "replace" o = HashTableIterReplaceMethodInfo | |
| ResolveHashTableIterMethod "steal" o = HashTableIterStealMethodInfo | |
| ResolveHashTableIterMethod "getHashTable" o = HashTableIterGetHashTableMethodInfo | |
| ResolveHashTableIterMethod l o = MethodResolutionFailed l o :: Type |
getHashTable
data HashTableIterGetHashTableMethodInfo Source #
Instances
| (signature ~ m (Map (Ptr ()) (Ptr ())), MonadIO m) => OverloadedMethod HashTableIterGetHashTableMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterGetHashTableMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
hashTableIterGetHashTable Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> m (Map (Ptr ()) (Ptr ())) | Returns: the |
Returns the HashTable associated with iter.
Since: 2.16
init
data HashTableIterInitMethodInfo Source #
Instances
| (signature ~ (Map (Ptr ()) (Ptr ()) -> m ()), MonadIO m) => OverloadedMethod HashTableIterInitMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterInitMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> Map (Ptr ()) (Ptr ()) |
|
| -> m () |
Initializes a key/value pair iterator and associates it with
hashTable. Modifying the hash table after calling this function
invalidates the returned iterator.
The iteration order of a HashTableIter over the keys/values in a hash
table is not defined.
C code
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, hash_table);
while (g_hash_table_iter_next (&iter, &key, &value))
{
// do something with key and value
}Since: 2.16
next
data HashTableIterNextMethodInfo Source #
Instances
| (signature ~ m (Bool, Ptr (), Ptr ()), MonadIO m) => OverloadedMethod HashTableIterNextMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterNextMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> m (Bool, Ptr (), Ptr ()) | Returns: |
Advances iter and retrieves the key and/or value that are now
pointed to as a result of this advancement. If False is returned,
key and value are not set, and the iterator becomes invalid.
Since: 2.16
remove
data HashTableIterRemoveMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod HashTableIterRemoveMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterRemoveMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> m () |
Removes the key/value pair currently pointed to by the iterator
from its associated HashTable. Can only be called after
hashTableIterNext returned True, and cannot be called
more than once for the same key/value pair.
If the HashTable was created using g_hash_table_new_full(),
the key and value are freed using the supplied destroy functions,
otherwise you have to make sure that any dynamically allocated
values are freed yourself.
It is safe to continue iterating the HashTable afterward:
C code
while (g_hash_table_iter_next (&iter, &key, &value))
{
if (condition)
g_hash_table_iter_remove (&iter);
}Since: 2.16
replace
data HashTableIterReplaceMethodInfo Source #
Instances
| (signature ~ (Ptr () -> m ()), MonadIO m) => OverloadedMethod HashTableIterReplaceMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterReplaceMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> Ptr () |
|
| -> m () |
Replaces the value currently pointed to by the iterator
from its associated HashTable. Can only be called after
hashTableIterNext returned True.
If you supplied a valueDestroyFunc when creating the
HashTable, the old value is freed using that function.
Since: 2.30
steal
data HashTableIterStealMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod HashTableIterStealMethodInfo HashTableIter signature Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods overloadedMethod :: HashTableIter -> signature # | |
| OverloadedMethodInfo HashTableIterStealMethodInfo HashTableIter Source # | |
Defined in GI.GLib.Structs.HashTableIter Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => HashTableIter |
|
| -> m () |
Removes the key/value pair currently pointed to by the
iterator from its associated HashTable, without calling
the key and value destroy functions. Can only be called
after hashTableIterNext returned True, and cannot
be called more than once for the same key/value pair.
Since: 2.16