{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.VariantBuilder
(
VariantBuilder(..) ,
noVariantBuilder ,
#if defined(ENABLE_OVERLOADING)
ResolveVariantBuilderMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
VariantBuilderAddValueMethodInfo ,
#endif
variantBuilderAddValue ,
#if defined(ENABLE_OVERLOADING)
VariantBuilderCloseMethodInfo ,
#endif
variantBuilderClose ,
#if defined(ENABLE_OVERLOADING)
VariantBuilderEndMethodInfo ,
#endif
variantBuilderEnd ,
variantBuilderNew ,
#if defined(ENABLE_OVERLOADING)
VariantBuilderOpenMethodInfo ,
#endif
variantBuilderOpen ,
#if defined(ENABLE_OVERLOADING)
VariantBuilderRefMethodInfo ,
#endif
variantBuilderRef ,
#if defined(ENABLE_OVERLOADING)
VariantBuilderUnrefMethodInfo ,
#endif
variantBuilderUnref ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import {-# SOURCE #-} qualified GI.GLib.Structs.VariantType as GLib.VariantType
newtype VariantBuilder = VariantBuilder (ManagedPtr VariantBuilder)
deriving (VariantBuilder -> VariantBuilder -> Bool
(VariantBuilder -> VariantBuilder -> Bool)
-> (VariantBuilder -> VariantBuilder -> Bool) -> Eq VariantBuilder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VariantBuilder -> VariantBuilder -> Bool
$c/= :: VariantBuilder -> VariantBuilder -> Bool
== :: VariantBuilder -> VariantBuilder -> Bool
$c== :: VariantBuilder -> VariantBuilder -> Bool
Eq)
foreign import ccall "g_variant_builder_get_type" c_g_variant_builder_get_type ::
IO GType
instance BoxedObject VariantBuilder where
boxedType :: VariantBuilder -> IO GType
boxedType _ = IO GType
c_g_variant_builder_get_type
instance B.GValue.IsGValue VariantBuilder where
toGValue :: VariantBuilder -> IO GValue
toGValue o :: VariantBuilder
o = do
GType
gtype <- IO GType
c_g_variant_builder_get_type
VariantBuilder -> (Ptr VariantBuilder -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr VariantBuilder
o (GType
-> (GValue -> Ptr VariantBuilder -> IO ())
-> Ptr VariantBuilder
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr VariantBuilder -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO VariantBuilder
fromGValue gv :: GValue
gv = do
Ptr VariantBuilder
ptr <- GValue -> IO (Ptr VariantBuilder)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr VariantBuilder)
(ManagedPtr VariantBuilder -> VariantBuilder)
-> Ptr VariantBuilder -> IO VariantBuilder
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr VariantBuilder -> VariantBuilder
VariantBuilder Ptr VariantBuilder
ptr
noVariantBuilder :: Maybe VariantBuilder
noVariantBuilder :: Maybe VariantBuilder
noVariantBuilder = Maybe VariantBuilder
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList VariantBuilder
type instance O.AttributeList VariantBuilder = VariantBuilderAttributeList
type VariantBuilderAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_variant_builder_new" g_variant_builder_new ::
Ptr GLib.VariantType.VariantType ->
IO (Ptr VariantBuilder)
variantBuilderNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.VariantType.VariantType
-> m VariantBuilder
variantBuilderNew :: VariantType -> m VariantBuilder
variantBuilderNew type_ :: VariantType
type_ = IO VariantBuilder -> m VariantBuilder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VariantBuilder -> m VariantBuilder)
-> IO VariantBuilder -> m VariantBuilder
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantType
type_' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
type_
Ptr VariantBuilder
result <- Ptr VariantType -> IO (Ptr VariantBuilder)
g_variant_builder_new Ptr VariantType
type_'
Text -> Ptr VariantBuilder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "variantBuilderNew" Ptr VariantBuilder
result
VariantBuilder
result' <- ((ManagedPtr VariantBuilder -> VariantBuilder)
-> Ptr VariantBuilder -> IO VariantBuilder
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr VariantBuilder -> VariantBuilder
VariantBuilder) Ptr VariantBuilder
result
VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantType
type_
VariantBuilder -> IO VariantBuilder
forall (m :: * -> *) a. Monad m => a -> m a
return VariantBuilder
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_variant_builder_add_value" g_variant_builder_add_value ::
Ptr VariantBuilder ->
Ptr GVariant ->
IO ()
variantBuilderAddValue ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> GVariant
-> m ()
variantBuilderAddValue :: VariantBuilder -> GVariant -> m ()
variantBuilderAddValue builder :: VariantBuilder
builder value :: GVariant
value = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
Ptr VariantBuilder -> Ptr GVariant -> IO ()
g_variant_builder_add_value Ptr VariantBuilder
builder' Ptr GVariant
value'
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data VariantBuilderAddValueMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m) => O.MethodInfo VariantBuilderAddValueMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderAddValue
#endif
foreign import ccall "g_variant_builder_close" g_variant_builder_close ::
Ptr VariantBuilder ->
IO ()
variantBuilderClose ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> m ()
variantBuilderClose :: VariantBuilder -> m ()
variantBuilderClose builder :: VariantBuilder
builder = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
Ptr VariantBuilder -> IO ()
g_variant_builder_close Ptr VariantBuilder
builder'
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data VariantBuilderCloseMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo VariantBuilderCloseMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderClose
#endif
foreign import ccall "g_variant_builder_end" g_variant_builder_end ::
Ptr VariantBuilder ->
IO (Ptr GVariant)
variantBuilderEnd ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> m GVariant
variantBuilderEnd :: VariantBuilder -> m GVariant
variantBuilderEnd builder :: VariantBuilder
builder = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
Ptr GVariant
result <- Ptr VariantBuilder -> IO (Ptr GVariant)
g_variant_builder_end Ptr VariantBuilder
builder'
Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "variantBuilderEnd" Ptr GVariant
result
GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
result
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'
#if defined(ENABLE_OVERLOADING)
data VariantBuilderEndMethodInfo
instance (signature ~ (m GVariant), MonadIO m) => O.MethodInfo VariantBuilderEndMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderEnd
#endif
foreign import ccall "g_variant_builder_open" g_variant_builder_open ::
Ptr VariantBuilder ->
Ptr GLib.VariantType.VariantType ->
IO ()
variantBuilderOpen ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> GLib.VariantType.VariantType
-> m ()
variantBuilderOpen :: VariantBuilder -> VariantType -> m ()
variantBuilderOpen builder :: VariantBuilder
builder type_ :: VariantType
type_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
Ptr VariantType
type_' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
type_
Ptr VariantBuilder -> Ptr VariantType -> IO ()
g_variant_builder_open Ptr VariantBuilder
builder' Ptr VariantType
type_'
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantType
type_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data VariantBuilderOpenMethodInfo
instance (signature ~ (GLib.VariantType.VariantType -> m ()), MonadIO m) => O.MethodInfo VariantBuilderOpenMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderOpen
#endif
foreign import ccall "g_variant_builder_ref" g_variant_builder_ref ::
Ptr VariantBuilder ->
IO (Ptr VariantBuilder)
variantBuilderRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> m VariantBuilder
variantBuilderRef :: VariantBuilder -> m VariantBuilder
variantBuilderRef builder :: VariantBuilder
builder = IO VariantBuilder -> m VariantBuilder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VariantBuilder -> m VariantBuilder)
-> IO VariantBuilder -> m VariantBuilder
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantBuilder
builder
Ptr VariantBuilder
result <- Ptr VariantBuilder -> IO (Ptr VariantBuilder)
g_variant_builder_ref Ptr VariantBuilder
builder'
Text -> Ptr VariantBuilder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "variantBuilderRef" Ptr VariantBuilder
result
VariantBuilder
result' <- ((ManagedPtr VariantBuilder -> VariantBuilder)
-> Ptr VariantBuilder -> IO VariantBuilder
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr VariantBuilder -> VariantBuilder
VariantBuilder) Ptr VariantBuilder
result
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
VariantBuilder -> IO VariantBuilder
forall (m :: * -> *) a. Monad m => a -> m a
return VariantBuilder
result'
#if defined(ENABLE_OVERLOADING)
data VariantBuilderRefMethodInfo
instance (signature ~ (m VariantBuilder), MonadIO m) => O.MethodInfo VariantBuilderRefMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderRef
#endif
foreign import ccall "g_variant_builder_unref" g_variant_builder_unref ::
Ptr VariantBuilder ->
IO ()
variantBuilderUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
VariantBuilder
-> m ()
variantBuilderUnref :: VariantBuilder -> m ()
variantBuilderUnref builder :: VariantBuilder
builder = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr VariantBuilder
builder' <- VariantBuilder -> IO (Ptr VariantBuilder)
forall a. (HasCallStack, BoxedObject a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed VariantBuilder
builder
Ptr VariantBuilder -> IO ()
g_variant_builder_unref Ptr VariantBuilder
builder'
VariantBuilder -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantBuilder
builder
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data VariantBuilderUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo VariantBuilderUnrefMethodInfo VariantBuilder signature where
overloadedMethod = variantBuilderUnref
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveVariantBuilderMethod (t :: Symbol) (o :: *) :: * where
ResolveVariantBuilderMethod "addValue" o = VariantBuilderAddValueMethodInfo
ResolveVariantBuilderMethod "close" o = VariantBuilderCloseMethodInfo
ResolveVariantBuilderMethod "end" o = VariantBuilderEndMethodInfo
ResolveVariantBuilderMethod "open" o = VariantBuilderOpenMethodInfo
ResolveVariantBuilderMethod "ref" o = VariantBuilderRefMethodInfo
ResolveVariantBuilderMethod "unref" o = VariantBuilderUnrefMethodInfo
ResolveVariantBuilderMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveVariantBuilderMethod t VariantBuilder, O.MethodInfo info VariantBuilder p) => OL.IsLabel t (VariantBuilder -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif