gi-gobject-0.2.44.12: GI/GObject/Structs/ValueArray.hs
{- |
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 #GValueArray contains an array of #GValue elements.
-}
module GI.GObject.Structs.ValueArray
(
-- * Exported types
ValueArray(..) ,
noValueArray ,
-- * Methods
-- ** valueArrayAppend
valueArrayAppend ,
-- ** valueArrayCopy
valueArrayCopy ,
-- ** valueArrayFree
valueArrayFree ,
-- ** valueArrayGetNth
valueArrayGetNth ,
-- ** valueArrayInsert
valueArrayInsert ,
-- ** valueArrayNew
valueArrayNew ,
-- ** valueArrayPrepend
valueArrayPrepend ,
-- ** valueArrayRemove
valueArrayRemove ,
-- ** valueArraySort
valueArraySort ,
-- * Properties
-- ** NValues
valueArrayReadNValues ,
-- ** Values
valueArrayReadValues ,
) 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.GObject.Types
import GI.GObject.Callbacks
import qualified GI.GLib as GLib
newtype ValueArray = ValueArray (ForeignPtr ValueArray)
foreign import ccall "g_value_array_get_type" c_g_value_array_get_type ::
IO GType
instance BoxedObject ValueArray where
boxedType _ = c_g_value_array_get_type
noValueArray :: Maybe ValueArray
noValueArray = Nothing
valueArrayReadNValues :: ValueArray -> IO Word32
valueArrayReadNValues s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Word32
return val
valueArrayReadValues :: ValueArray -> IO GValue
valueArrayReadValues s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr GValue)
val' <- (newBoxed GValue) val
return val'
-- method ValueArray::new
-- method type : Constructor
-- Args : [Arg {argName = "n_prealloced", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "n_prealloced", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_new" g_value_array_new ::
Word32 -> -- n_prealloced : TBasicType TUInt32
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayNew ["(Since version 2.32)","Use #GArray and g_array_sized_new() instead."]#-}
valueArrayNew ::
(MonadIO m) =>
Word32 -> -- n_prealloced
m ValueArray
valueArrayNew n_prealloced = liftIO $ do
result <- g_value_array_new n_prealloced
checkUnexpectedReturnNULL "g_value_array_new" result
result' <- (wrapBoxed ValueArray) result
return result'
-- method ValueArray::append
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_append" g_value_array_append ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
Ptr GValue -> -- value : TInterface "GObject" "Value"
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayAppend ["(Since version 2.32)","Use #GArray and g_array_append_val() instead."]#-}
valueArrayAppend ::
(MonadIO m) =>
ValueArray -> -- _obj
Maybe (GValue) -> -- value
m ValueArray
valueArrayAppend _obj value = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
maybeValue <- case value of
Nothing -> return nullPtr
Just jValue -> do
let jValue' = unsafeManagedPtrGetPtr jValue
return jValue'
result <- g_value_array_append _obj' maybeValue
checkUnexpectedReturnNULL "g_value_array_append" result
result' <- (newBoxed ValueArray) result
touchManagedPtr _obj
whenJust value touchManagedPtr
return result'
-- method ValueArray::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_copy" g_value_array_copy ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayCopy ["(Since version 2.32)","Use #GArray and g_array_ref() instead."]#-}
valueArrayCopy ::
(MonadIO m) =>
ValueArray -> -- _obj
m ValueArray
valueArrayCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_value_array_copy _obj'
checkUnexpectedReturnNULL "g_value_array_copy" result
result' <- (wrapBoxed ValueArray) result
touchManagedPtr _obj
return result'
-- method ValueArray::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_free" g_value_array_free ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
IO ()
{-# DEPRECATED valueArrayFree ["(Since version 2.32)","Use #GArray and g_array_unref() instead."]#-}
valueArrayFree ::
(MonadIO m) =>
ValueArray -> -- _obj
m ()
valueArrayFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_value_array_free _obj'
touchManagedPtr _obj
return ()
-- method ValueArray::get_nth
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "Value"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_get_nth" g_value_array_get_nth ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
Word32 -> -- index_ : TBasicType TUInt32
IO (Ptr GValue)
{-# DEPRECATED valueArrayGetNth ["(Since version 2.32)","Use g_array_index() instead."]#-}
valueArrayGetNth ::
(MonadIO m) =>
ValueArray -> -- _obj
Word32 -> -- index_
m GValue
valueArrayGetNth _obj index_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_value_array_get_nth _obj' index_
checkUnexpectedReturnNULL "g_value_array_get_nth" result
result' <- (newBoxed GValue) result
touchManagedPtr _obj
return result'
-- method ValueArray::insert
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_insert" g_value_array_insert ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
Word32 -> -- index_ : TBasicType TUInt32
Ptr GValue -> -- value : TInterface "GObject" "Value"
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayInsert ["(Since version 2.32)","Use #GArray and g_array_insert_val() instead."]#-}
valueArrayInsert ::
(MonadIO m) =>
ValueArray -> -- _obj
Word32 -> -- index_
Maybe (GValue) -> -- value
m ValueArray
valueArrayInsert _obj index_ value = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
maybeValue <- case value of
Nothing -> return nullPtr
Just jValue -> do
let jValue' = unsafeManagedPtrGetPtr jValue
return jValue'
result <- g_value_array_insert _obj' index_ maybeValue
checkUnexpectedReturnNULL "g_value_array_insert" result
result' <- (newBoxed ValueArray) result
touchManagedPtr _obj
whenJust value touchManagedPtr
return result'
-- method ValueArray::prepend
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_prepend" g_value_array_prepend ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
Ptr GValue -> -- value : TInterface "GObject" "Value"
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayPrepend ["(Since version 2.32)","Use #GArray and g_array_prepend_val() instead."]#-}
valueArrayPrepend ::
(MonadIO m) =>
ValueArray -> -- _obj
Maybe (GValue) -> -- value
m ValueArray
valueArrayPrepend _obj value = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
maybeValue <- case value of
Nothing -> return nullPtr
Just jValue -> do
let jValue' = unsafeManagedPtrGetPtr jValue
return jValue'
result <- g_value_array_prepend _obj' maybeValue
checkUnexpectedReturnNULL "g_value_array_prepend" result
result' <- (newBoxed ValueArray) result
touchManagedPtr _obj
whenJust value touchManagedPtr
return result'
-- method ValueArray::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_remove" g_value_array_remove ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
Word32 -> -- index_ : TBasicType TUInt32
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayRemove ["(Since version 2.32)","Use #GArray and g_array_remove_index() instead."]#-}
valueArrayRemove ::
(MonadIO m) =>
ValueArray -> -- _obj
Word32 -> -- index_
m ValueArray
valueArrayRemove _obj index_ = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_value_array_remove _obj' index_
checkUnexpectedReturnNULL "g_value_array_remove" result
result' <- (newBoxed ValueArray) result
touchManagedPtr _obj
return result'
-- method ValueArray::sort
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "compare_func", argType = TInterface "GLib" "CompareDataFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GObject" "ValueArray", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "compare_func", argType = TInterface "GLib" "CompareDataFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "ValueArray"
-- throws : False
-- Skip return : False
foreign import ccall "g_value_array_sort_with_data" g_value_array_sort_with_data ::
Ptr ValueArray -> -- _obj : TInterface "GObject" "ValueArray"
FunPtr GLib.CompareDataFuncC -> -- compare_func : TInterface "GLib" "CompareDataFunc"
Ptr () -> -- user_data : TBasicType TVoid
IO (Ptr ValueArray)
{-# DEPRECATED valueArraySort ["(Since version 2.32)","Use #GArray and g_array_sort_with_data()."]#-}
valueArraySort ::
(MonadIO m) =>
ValueArray -> -- _obj
GLib.CompareDataFunc -> -- compare_func
m ValueArray
valueArraySort _obj compare_func = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
compare_func' <- GLib.mkCompareDataFunc (GLib.compareDataFuncWrapper Nothing compare_func)
let user_data = nullPtr
result <- g_value_array_sort_with_data _obj' compare_func' user_data
checkUnexpectedReturnNULL "g_value_array_sort_with_data" result
result' <- (newBoxed ValueArray) result
safeFreeFunPtr $ castFunPtrToPtr compare_func'
touchManagedPtr _obj
return result'