gi-glib-2.0.30: GLib bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Exported types

newtype StrvBuilder Source #

Memory-managed wrapper type.

Constructors

StrvBuilder (ManagedPtr StrvBuilder) 

Instances

Instances details
Eq StrvBuilder Source # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

GBoxed StrvBuilder Source # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

ManagedPtrNewtype StrvBuilder Source # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

Methods

toManagedPtr :: StrvBuilder -> ManagedPtr StrvBuilder

TypedObject StrvBuilder Source # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

Methods

glibType :: IO GType

HasParentTypes StrvBuilder Source # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

IsGValue (Maybe StrvBuilder) Source #

Convert StrvBuilder to and from GValue. See toGValue and fromGValue.

Instance details

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 # 
Instance details

Defined in GI.GLib.Structs.StrvBuilder

type ParentTypes StrvBuilder = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

add, addv, end, ref, take, unref.

Getters

None.

Setters

None.

add

strvBuilderAdd Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a StrvBuilder

-> Text

value: a string.

-> m () 

Add a string to the end of the array.

Since 2.68

addv

strvBuilderAddv Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a StrvBuilder

-> [Text]

value: the vector of strings to add

-> m () 

Appends all the strings in the given vector to the builder.

Since 2.70

end

strvBuilderEnd Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a 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

strvBuilderNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m StrvBuilder

Returns: the new StrvBuilder

Creates a new StrvBuilder with a reference count of 1. Use strvBuilderUnref on the returned value when no longer needed.

Since: 2.68

ref

strvBuilderRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a StrvBuilder

-> m StrvBuilder

Returns: The passed in StrvBuilder

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

strvBuilderTake Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a StrvBuilder

-> Text

value: a string. Ownership of the string is transferred to the StrvBuilder

-> 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

strvBuilderUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StrvBuilder

builder: a StrvBuilder allocated by strvBuilderNew

-> 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