{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) A utility type for constructing container-type #GVariant instances. This is an opaque structure and may only be accessed using the following functions. #GVariantBuilder is not threadsafe in any way. Do not attempt to access it from more than one thread. -} module GI.GLib.Structs.VariantBuilder ( -- * Exported types VariantBuilder(..) , noVariantBuilder , -- * Methods -- ** variantBuilderAddValue variantBuilderAddValue , -- ** variantBuilderClose variantBuilderClose , -- ** variantBuilderEnd variantBuilderEnd , -- ** variantBuilderNew variantBuilderNew , -- ** variantBuilderOpen variantBuilderOpen , -- ** variantBuilderRef variantBuilderRef , -- ** variantBuilderUnref variantBuilderUnref , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.GLib.Types import GI.GLib.Callbacks newtype VariantBuilder = VariantBuilder (ForeignPtr VariantBuilder) foreign import ccall "g_variant_builder_get_type" c_g_variant_builder_get_type :: IO GType instance BoxedObject VariantBuilder where boxedType _ = c_g_variant_builder_get_type noVariantBuilder :: Maybe VariantBuilder noVariantBuilder = Nothing -- method VariantBuilder::new -- method type : Constructor -- Args : [Arg {argName = "type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "VariantBuilder" -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_new" g_variant_builder_new :: Ptr VariantType -> -- type : TInterface "GLib" "VariantType" IO (Ptr VariantBuilder) variantBuilderNew :: (MonadIO m) => VariantType -> -- type m VariantBuilder variantBuilderNew type_ = liftIO $ do let type_' = unsafeManagedPtrGetPtr type_ result <- g_variant_builder_new type_' checkUnexpectedReturnNULL "g_variant_builder_new" result result' <- (wrapBoxed VariantBuilder) result touchManagedPtr type_ return result' -- method VariantBuilder::add_value -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_add_value" g_variant_builder_add_value :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" Ptr GVariant -> -- value : TVariant IO () variantBuilderAddValue :: (MonadIO m) => VariantBuilder -> -- _obj GVariant -> -- value m () variantBuilderAddValue _obj value = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let value' = unsafeManagedPtrGetPtr value g_variant_builder_add_value _obj' value' touchManagedPtr _obj return () -- method VariantBuilder::close -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_close" g_variant_builder_close :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" IO () variantBuilderClose :: (MonadIO m) => VariantBuilder -> -- _obj m () variantBuilderClose _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_variant_builder_close _obj' touchManagedPtr _obj return () -- method VariantBuilder::end -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TVariant -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_end" g_variant_builder_end :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" IO (Ptr GVariant) variantBuilderEnd :: (MonadIO m) => VariantBuilder -> -- _obj m GVariant variantBuilderEnd _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_variant_builder_end _obj' checkUnexpectedReturnNULL "g_variant_builder_end" result result' <- newGVariantFromPtr result touchManagedPtr _obj return result' -- method VariantBuilder::open -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "GLib" "VariantType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_open" g_variant_builder_open :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" Ptr VariantType -> -- type : TInterface "GLib" "VariantType" IO () variantBuilderOpen :: (MonadIO m) => VariantBuilder -> -- _obj VariantType -> -- type m () variantBuilderOpen _obj type_ = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let type_' = unsafeManagedPtrGetPtr type_ g_variant_builder_open _obj' type_' touchManagedPtr _obj touchManagedPtr type_ return () -- method VariantBuilder::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "VariantBuilder" -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_ref" g_variant_builder_ref :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" IO (Ptr VariantBuilder) variantBuilderRef :: (MonadIO m) => VariantBuilder -> -- _obj m VariantBuilder variantBuilderRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_variant_builder_ref _obj' checkUnexpectedReturnNULL "g_variant_builder_ref" result result' <- (wrapBoxed VariantBuilder) result touchManagedPtr _obj return result' -- method VariantBuilder::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "VariantBuilder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_variant_builder_unref" g_variant_builder_unref :: Ptr VariantBuilder -> -- _obj : TInterface "GLib" "VariantBuilder" IO () variantBuilderUnref :: (MonadIO m) => VariantBuilder -> -- _obj m () variantBuilderUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_variant_builder_unref _obj' touchManagedPtr _obj return ()