Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
GI.GLib.Structs.VariantBuilder
Description
A utility type for constructing container-type GVariant
instances.
This is an opaque structure and may only be accessed using the following functions.
VariantBuilder
is not threadsafe in any way. Do not attempt to
access it from more than one thread.
- newtype VariantBuilder = VariantBuilder (ManagedPtr VariantBuilder)
- noVariantBuilder :: Maybe VariantBuilder
- data VariantBuilderAddValueMethodInfo
- variantBuilderAddValue :: (HasCallStack, MonadIO m) => VariantBuilder -> GVariant -> m ()
- data VariantBuilderCloseMethodInfo
- variantBuilderClose :: (HasCallStack, MonadIO m) => VariantBuilder -> m ()
- data VariantBuilderEndMethodInfo
- variantBuilderEnd :: (HasCallStack, MonadIO m) => VariantBuilder -> m GVariant
- variantBuilderNew :: (HasCallStack, MonadIO m) => VariantType -> m VariantBuilder
- data VariantBuilderOpenMethodInfo
- variantBuilderOpen :: (HasCallStack, MonadIO m) => VariantBuilder -> VariantType -> m ()
- data VariantBuilderRefMethodInfo
- variantBuilderRef :: (HasCallStack, MonadIO m) => VariantBuilder -> m VariantBuilder
- data VariantBuilderUnrefMethodInfo
- variantBuilderUnref :: (HasCallStack, MonadIO m) => VariantBuilder -> m ()
Exported types
newtype VariantBuilder Source #
Constructors
VariantBuilder (ManagedPtr VariantBuilder) |
Instances
Methods
addValue
data VariantBuilderAddValueMethodInfo Source #
Instances
((~) * signature (GVariant -> m ()), MonadIO m) => MethodInfo * VariantBuilderAddValueMethodInfo VariantBuilder signature Source # | |
variantBuilderAddValue Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> GVariant |
|
-> m () |
Adds value
to builder
.
It is an error to call this function in any way that would create an inconsistent value to be constructed. Some examples of this are putting different types of items into an array, putting the wrong types or number of items in a tuple, putting more than one value into a variant, etc.
If value
is a floating reference (see variantRefSink
),
the builder
instance takes ownership of value
.
Since: 2.24
close
data VariantBuilderCloseMethodInfo Source #
Instances
((~) * signature (m ()), MonadIO m) => MethodInfo * VariantBuilderCloseMethodInfo VariantBuilder signature Source # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> m () |
Closes the subcontainer inside the given builder
that was opened by
the most recent call to variantBuilderOpen
.
It is an error to call this function in any way that would create an inconsistent value to be constructed (ie: too few values added to the subcontainer).
Since: 2.24
end
data VariantBuilderEndMethodInfo Source #
Instances
((~) * signature (m GVariant), MonadIO m) => MethodInfo * VariantBuilderEndMethodInfo VariantBuilder signature Source # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> m GVariant | Returns: a new, floating, |
Ends the builder process and returns the constructed value.
It is not permissible to use builder
in any way after this call
except for reference counting operations (in the case of a
heap-allocated VariantBuilder
) or by reinitialising it with
g_variant_builder_init()
(in the case of stack-allocated). This
means that for the stack-allocated builders there is no need to
call g_variant_builder_clear()
after the call to
variantBuilderEnd
.
It is an error to call this function in any way that would create an inconsistent value to be constructed (ie: insufficient number of items added to a container with a specific number of children required). It is also an error to call this function if the builder was created with an indefinite array or maybe type and no children have been added; in this case it is impossible to infer the type of the empty array.
Since: 2.24
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantType |
|
-> m VariantBuilder | Returns: a |
Allocates and initialises a new VariantBuilder
.
You should call variantBuilderUnref
on the return value when it
is no longer needed. The memory will not be automatically freed by
any other call.
In most cases it is easier to place a VariantBuilder
directly on
the stack of the calling function and initialise it with
g_variant_builder_init()
.
Since: 2.24
open
data VariantBuilderOpenMethodInfo Source #
Instances
((~) * signature (VariantType -> m ()), MonadIO m) => MethodInfo * VariantBuilderOpenMethodInfo VariantBuilder signature Source # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> VariantType |
|
-> m () |
Opens a subcontainer inside the given builder
. When done adding
items to the subcontainer, variantBuilderClose
must be called.
It is an error to call this function in any way that would cause an inconsistent value to be constructed (ie: adding too many values or a value of an incorrect type).
Since: 2.24
ref
data VariantBuilderRefMethodInfo Source #
Instances
((~) * signature (m VariantBuilder), MonadIO m) => MethodInfo * VariantBuilderRefMethodInfo VariantBuilder signature Source # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> m VariantBuilder | Returns: a new reference to |
Increases the reference count on builder
.
Don't call this on stack-allocated VariantBuilder
instances or bad
things will happen.
Since: 2.24
unref
data VariantBuilderUnrefMethodInfo Source #
Instances
((~) * signature (m ()), MonadIO m) => MethodInfo * VariantBuilderUnrefMethodInfo VariantBuilder signature Source # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> VariantBuilder |
|
-> m () |
Decreases the reference count on builder
.
In the event that there are no more references, releases all memory
associated with the VariantBuilder
.
Don't call this on stack-allocated VariantBuilder
instances or bad
things will happen.
Since: 2.24