Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.GLib.Structs.StrvBuilder
Description
GStrvBuilder
is a helper object to build a Nothing
-terminated string arrays.
The following example shows how to build a two element array:
c code
g_autoptr(GStrvBuilder) builder = g_strv_builder_new (); g_strv_builder_add (builder, "hello"); g_strv_builder_add (builder, "world"); g_auto(GStrv) array = g_strv_builder_end (builder);
Since: 2.68
Synopsis
- newtype StrvBuilder = StrvBuilder (ManagedPtr StrvBuilder)
- strvBuilderAdd :: (HasCallStack, MonadIO m) => StrvBuilder -> Text -> m ()
- strvBuilderAddv :: (HasCallStack, MonadIO m) => StrvBuilder -> [Text] -> m ()
- strvBuilderEnd :: (HasCallStack, MonadIO m) => StrvBuilder -> m [Text]
- strvBuilderNew :: (HasCallStack, MonadIO m) => m StrvBuilder
- strvBuilderRef :: (HasCallStack, MonadIO m) => StrvBuilder -> m StrvBuilder
- strvBuilderTake :: (HasCallStack, MonadIO m) => StrvBuilder -> Text -> m ()
- strvBuilderUnref :: (HasCallStack, MonadIO m) => StrvBuilder -> m ()
Exported types
newtype StrvBuilder Source #
Memory-managed wrapper type.
Constructors
StrvBuilder (ManagedPtr StrvBuilder) |
Instances
Eq StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder | |
GBoxed StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder | |
ManagedPtrNewtype StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder Methods toManagedPtr :: StrvBuilder -> ManagedPtr StrvBuilder | |
TypedObject StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder | |
HasParentTypes StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder | |
IsGValue (Maybe StrvBuilder) Source # | Convert |
Defined in GI.GLib.Structs.StrvBuilder Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe StrvBuilder -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe StrvBuilder) | |
type ParentTypes StrvBuilder Source # | |
Defined in GI.GLib.Structs.StrvBuilder |
Methods
Click to display all available methods, including inherited ones
add
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> Text |
|
-> m () |
Add a string to the end of the array.
Since 2.68
addv
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> [Text] |
|
-> m () |
Appends all the strings in the given vector to the builder.
Since 2.70
end
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> m [Text] | Returns: the constructed string array. Since 2.68 |
Ends the builder process and returns the constructed NULL-terminated string
array. The returned value should be freed with strfreev
when no longer
needed.
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> m StrvBuilder | Returns: the new |
Creates a new StrvBuilder
with a reference count of 1.
Use strvBuilderUnref
on the returned value when no longer needed.
Since: 2.68
ref
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> m StrvBuilder | Returns: The passed in |
Atomically increments the reference count of builder
by one.
This function is thread-safe and may be called from any thread.
Since: 2.68
take
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> Text |
|
-> m () |
Add a string to the end of the array. After value
belongs to the
StrvBuilder
and may no longer be modified by the caller.
Since 2.80
unref
Arguments
:: (HasCallStack, MonadIO m) | |
=> StrvBuilder |
|
-> m () |
Decreases the reference count on builder
.
In the event that there are no more references, releases all memory
associated with the StrvBuilder
.
Since: 2.68