{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GObject.Structs.ValueArray
(
ValueArray(..) ,
newZeroValueArray ,
noValueArray ,
#if defined(ENABLE_OVERLOADING)
ResolveValueArrayMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ValueArrayAppendMethodInfo ,
#endif
valueArrayAppend ,
#if defined(ENABLE_OVERLOADING)
ValueArrayCopyMethodInfo ,
#endif
valueArrayCopy ,
#if defined(ENABLE_OVERLOADING)
ValueArrayGetNthMethodInfo ,
#endif
valueArrayGetNth ,
#if defined(ENABLE_OVERLOADING)
ValueArrayInsertMethodInfo ,
#endif
valueArrayInsert ,
valueArrayNew ,
#if defined(ENABLE_OVERLOADING)
ValueArrayPrependMethodInfo ,
#endif
valueArrayPrepend ,
#if defined(ENABLE_OVERLOADING)
ValueArrayRemoveMethodInfo ,
#endif
valueArrayRemove ,
#if defined(ENABLE_OVERLOADING)
ValueArraySortMethodInfo ,
#endif
valueArraySort ,
getValueArrayNValues ,
setValueArrayNValues ,
#if defined(ENABLE_OVERLOADING)
valueArray_nValues ,
#endif
clearValueArrayValues ,
getValueArrayValues ,
setValueArrayValues ,
#if defined(ENABLE_OVERLOADING)
valueArray_values ,
#endif
) 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 qualified GI.GLib.Callbacks as GLib.Callbacks
newtype ValueArray = ValueArray (ManagedPtr ValueArray)
deriving (ValueArray -> ValueArray -> Bool
(ValueArray -> ValueArray -> Bool)
-> (ValueArray -> ValueArray -> Bool) -> Eq ValueArray
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValueArray -> ValueArray -> Bool
$c/= :: ValueArray -> ValueArray -> Bool
== :: ValueArray -> ValueArray -> Bool
$c== :: ValueArray -> ValueArray -> Bool
Eq)
foreign import ccall "g_value_array_get_type" c_g_value_array_get_type ::
IO GType
instance BoxedObject ValueArray where
boxedType :: ValueArray -> IO GType
boxedType _ = IO GType
c_g_value_array_get_type
instance B.GValue.IsGValue ValueArray where
toGValue :: ValueArray -> IO GValue
toGValue o :: ValueArray
o = do
GType
gtype <- IO GType
c_g_value_array_get_type
ValueArray -> (Ptr ValueArray -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ValueArray
o (GType
-> (GValue -> Ptr ValueArray -> IO ())
-> Ptr ValueArray
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr ValueArray -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO ValueArray
fromGValue gv :: GValue
gv = do
Ptr ValueArray
ptr <- GValue -> IO (Ptr ValueArray)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr ValueArray)
(ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray Ptr ValueArray
ptr
newZeroValueArray :: MonadIO m => m ValueArray
newZeroValueArray :: m ValueArray
newZeroValueArray = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr ValueArray)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 24 IO (Ptr ValueArray)
-> (Ptr ValueArray -> IO ValueArray) -> IO ValueArray
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ValueArray -> ValueArray
ValueArray
instance tag ~ 'AttrSet => Constructible ValueArray tag where
new :: (ManagedPtr ValueArray -> ValueArray)
-> [AttrOp ValueArray tag] -> m ValueArray
new _ attrs :: [AttrOp ValueArray tag]
attrs = do
ValueArray
o <- m ValueArray
forall (m :: * -> *). MonadIO m => m ValueArray
newZeroValueArray
ValueArray -> [AttrOp ValueArray 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set ValueArray
o [AttrOp ValueArray tag]
[AttrOp ValueArray 'AttrSet]
attrs
ValueArray -> m ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
o
noValueArray :: Maybe ValueArray
noValueArray :: Maybe ValueArray
noValueArray = Maybe ValueArray
forall a. Maybe a
Nothing
getValueArrayNValues :: MonadIO m => ValueArray -> m Word32
getValueArrayNValues :: ValueArray -> m Word32
getValueArrayNValues s :: ValueArray
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ ValueArray -> (Ptr ValueArray -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ValueArray
s ((Ptr ValueArray -> IO Word32) -> IO Word32)
-> (Ptr ValueArray -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ValueArray
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr ValueArray
ptr Ptr ValueArray -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setValueArrayNValues :: MonadIO m => ValueArray -> Word32 -> m ()
setValueArrayNValues :: ValueArray -> Word32 -> m ()
setValueArrayNValues s :: ValueArray
s val :: Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ValueArray -> (Ptr ValueArray -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ValueArray
s ((Ptr ValueArray -> IO ()) -> IO ())
-> (Ptr ValueArray -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ValueArray
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ValueArray
ptr Ptr ValueArray -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data ValueArrayNValuesFieldInfo
instance AttrInfo ValueArrayNValuesFieldInfo where
type AttrBaseTypeConstraint ValueArrayNValuesFieldInfo = (~) ValueArray
type AttrAllowedOps ValueArrayNValuesFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint ValueArrayNValuesFieldInfo = (~) Word32
type AttrTransferTypeConstraint ValueArrayNValuesFieldInfo = (~)Word32
type AttrTransferType ValueArrayNValuesFieldInfo = Word32
type AttrGetType ValueArrayNValuesFieldInfo = Word32
type AttrLabel ValueArrayNValuesFieldInfo = "n_values"
type AttrOrigin ValueArrayNValuesFieldInfo = ValueArray
attrGet = getValueArrayNValues
attrSet = setValueArrayNValues
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
valueArray_nValues :: AttrLabelProxy "nValues"
valueArray_nValues = AttrLabelProxy
#endif
getValueArrayValues :: MonadIO m => ValueArray -> m (Maybe GValue)
getValueArrayValues :: ValueArray -> m (Maybe GValue)
getValueArrayValues s :: ValueArray
s = IO (Maybe GValue) -> m (Maybe GValue)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe GValue) -> m (Maybe GValue))
-> IO (Maybe GValue) -> m (Maybe GValue)
forall a b. (a -> b) -> a -> b
$ ValueArray
-> (Ptr ValueArray -> IO (Maybe GValue)) -> IO (Maybe GValue)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ValueArray
s ((Ptr ValueArray -> IO (Maybe GValue)) -> IO (Maybe GValue))
-> (Ptr ValueArray -> IO (Maybe GValue)) -> IO (Maybe GValue)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ValueArray
ptr -> do
Ptr GValue
val <- Ptr (Ptr GValue) -> IO (Ptr GValue)
forall a. Storable a => Ptr a -> IO a
peek (Ptr ValueArray
ptr Ptr ValueArray -> Int -> Ptr (Ptr GValue)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO (Ptr GValue)
Maybe GValue
result <- Ptr GValue -> (Ptr GValue -> IO GValue) -> IO (Maybe GValue)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr GValue
val ((Ptr GValue -> IO GValue) -> IO (Maybe GValue))
-> (Ptr GValue -> IO GValue) -> IO (Maybe GValue)
forall a b. (a -> b) -> a -> b
$ \val' :: Ptr GValue
val' -> do
GValue
val'' <- ((ManagedPtr GValue -> GValue) -> Ptr GValue -> IO GValue
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GValue -> GValue
GValue) Ptr GValue
val'
GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
val''
Maybe GValue -> IO (Maybe GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GValue
result
setValueArrayValues :: MonadIO m => ValueArray -> Ptr GValue -> m ()
setValueArrayValues :: ValueArray -> Ptr GValue -> m ()
setValueArrayValues s :: ValueArray
s val :: Ptr GValue
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ValueArray -> (Ptr ValueArray -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ValueArray
s ((Ptr ValueArray -> IO ()) -> IO ())
-> (Ptr ValueArray -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ValueArray
ptr -> do
Ptr (Ptr GValue) -> Ptr GValue -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ValueArray
ptr Ptr ValueArray -> Int -> Ptr (Ptr GValue)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (Ptr GValue
val :: Ptr GValue)
clearValueArrayValues :: MonadIO m => ValueArray -> m ()
clearValueArrayValues :: ValueArray -> m ()
clearValueArrayValues s :: ValueArray
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ValueArray -> (Ptr ValueArray -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ValueArray
s ((Ptr ValueArray -> IO ()) -> IO ())
-> (Ptr ValueArray -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ValueArray
ptr -> do
Ptr (Ptr GValue) -> Ptr GValue -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ValueArray
ptr Ptr ValueArray -> Int -> Ptr (Ptr GValue)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (Ptr GValue
forall a. Ptr a
FP.nullPtr :: Ptr GValue)
#if defined(ENABLE_OVERLOADING)
data ValueArrayValuesFieldInfo
instance AttrInfo ValueArrayValuesFieldInfo where
type AttrBaseTypeConstraint ValueArrayValuesFieldInfo = (~) ValueArray
type AttrAllowedOps ValueArrayValuesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ValueArrayValuesFieldInfo = (~) (Ptr GValue)
type AttrTransferTypeConstraint ValueArrayValuesFieldInfo = (~)(Ptr GValue)
type AttrTransferType ValueArrayValuesFieldInfo = (Ptr GValue)
type AttrGetType ValueArrayValuesFieldInfo = Maybe GValue
type AttrLabel ValueArrayValuesFieldInfo = "values"
type AttrOrigin ValueArrayValuesFieldInfo = ValueArray
attrGet = getValueArrayValues
attrSet = setValueArrayValues
attrConstruct = undefined
attrClear = clearValueArrayValues
attrTransfer _ v = do
return v
valueArray_values :: AttrLabelProxy "values"
valueArray_values = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ValueArray
type instance O.AttributeList ValueArray = ValueArrayAttributeList
type ValueArrayAttributeList = ('[ '("nValues", ValueArrayNValuesFieldInfo), '("values", ValueArrayValuesFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_value_array_new" g_value_array_new ::
Word32 ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayNew ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_sized_new()/@ instead."] #-}
valueArrayNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> m ValueArray
valueArrayNew :: Word32 -> m ValueArray
valueArrayNew nPrealloced :: Word32
nPrealloced = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
result <- Word32 -> IO (Ptr ValueArray)
g_value_array_new Word32
nPrealloced
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayNew" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_value_array_append" g_value_array_append ::
Ptr ValueArray ->
Ptr GValue ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayAppend ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_append_val()/@ instead."] #-}
valueArrayAppend ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> Maybe (GValue)
-> m ValueArray
valueArrayAppend :: ValueArray -> Maybe GValue -> m ValueArray
valueArrayAppend valueArray :: ValueArray
valueArray value :: Maybe GValue
value = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr GValue
maybeValue <- case Maybe GValue
value of
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just jValue :: GValue
jValue -> do
Ptr GValue
jValue' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
jValue
Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
jValue'
Ptr ValueArray
result <- Ptr ValueArray -> Ptr GValue -> IO (Ptr ValueArray)
g_value_array_append Ptr ValueArray
valueArray' Ptr GValue
maybeValue
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayAppend" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
Maybe GValue -> (GValue -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GValue
value GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayAppendMethodInfo
instance (signature ~ (Maybe (GValue) -> m ValueArray), MonadIO m) => O.MethodInfo ValueArrayAppendMethodInfo ValueArray signature where
overloadedMethod = valueArrayAppend
#endif
foreign import ccall "g_value_array_copy" g_value_array_copy ::
Ptr ValueArray ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayCopy ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_ref()/@ instead."] #-}
valueArrayCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> m ValueArray
valueArrayCopy :: ValueArray -> m ValueArray
valueArrayCopy valueArray :: ValueArray
valueArray = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr ValueArray
result <- Ptr ValueArray -> IO (Ptr ValueArray)
g_value_array_copy Ptr ValueArray
valueArray'
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayCopy" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayCopyMethodInfo
instance (signature ~ (m ValueArray), MonadIO m) => O.MethodInfo ValueArrayCopyMethodInfo ValueArray signature where
overloadedMethod = valueArrayCopy
#endif
foreign import ccall "g_value_array_get_nth" g_value_array_get_nth ::
Ptr ValueArray ->
Word32 ->
IO (Ptr GValue)
{-# DEPRECATED valueArrayGetNth ["(Since version 2.32)","Use @/g_array_index()/@ instead."] #-}
valueArrayGetNth ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> Word32
-> m GValue
valueArrayGetNth :: ValueArray -> Word32 -> m GValue
valueArrayGetNth valueArray :: ValueArray
valueArray index_ :: Word32
index_ = IO GValue -> m GValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr GValue
result <- Ptr ValueArray -> Word32 -> IO (Ptr GValue)
g_value_array_get_nth Ptr ValueArray
valueArray' Word32
index_
Text -> Ptr GValue -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayGetNth" Ptr GValue
result
GValue
result' <- ((ManagedPtr GValue -> GValue) -> Ptr GValue -> IO GValue
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GValue -> GValue
GValue) Ptr GValue
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayGetNthMethodInfo
instance (signature ~ (Word32 -> m GValue), MonadIO m) => O.MethodInfo ValueArrayGetNthMethodInfo ValueArray signature where
overloadedMethod = valueArrayGetNth
#endif
foreign import ccall "g_value_array_insert" g_value_array_insert ::
Ptr ValueArray ->
Word32 ->
Ptr GValue ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayInsert ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_insert_val()/@ instead."] #-}
valueArrayInsert ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> Word32
-> Maybe (GValue)
-> m ValueArray
valueArrayInsert :: ValueArray -> Word32 -> Maybe GValue -> m ValueArray
valueArrayInsert valueArray :: ValueArray
valueArray index_ :: Word32
index_ value :: Maybe GValue
value = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr GValue
maybeValue <- case Maybe GValue
value of
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just jValue :: GValue
jValue -> do
Ptr GValue
jValue' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
jValue
Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
jValue'
Ptr ValueArray
result <- Ptr ValueArray -> Word32 -> Ptr GValue -> IO (Ptr ValueArray)
g_value_array_insert Ptr ValueArray
valueArray' Word32
index_ Ptr GValue
maybeValue
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayInsert" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
Maybe GValue -> (GValue -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GValue
value GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayInsertMethodInfo
instance (signature ~ (Word32 -> Maybe (GValue) -> m ValueArray), MonadIO m) => O.MethodInfo ValueArrayInsertMethodInfo ValueArray signature where
overloadedMethod = valueArrayInsert
#endif
foreign import ccall "g_value_array_prepend" g_value_array_prepend ::
Ptr ValueArray ->
Ptr GValue ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayPrepend ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_prepend_val()/@ instead."] #-}
valueArrayPrepend ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> Maybe (GValue)
-> m ValueArray
valueArrayPrepend :: ValueArray -> Maybe GValue -> m ValueArray
valueArrayPrepend valueArray :: ValueArray
valueArray value :: Maybe GValue
value = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr GValue
maybeValue <- case Maybe GValue
value of
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just jValue :: GValue
jValue -> do
Ptr GValue
jValue' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
jValue
Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
jValue'
Ptr ValueArray
result <- Ptr ValueArray -> Ptr GValue -> IO (Ptr ValueArray)
g_value_array_prepend Ptr ValueArray
valueArray' Ptr GValue
maybeValue
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayPrepend" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
Maybe GValue -> (GValue -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GValue
value GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayPrependMethodInfo
instance (signature ~ (Maybe (GValue) -> m ValueArray), MonadIO m) => O.MethodInfo ValueArrayPrependMethodInfo ValueArray signature where
overloadedMethod = valueArrayPrepend
#endif
foreign import ccall "g_value_array_remove" g_value_array_remove ::
Ptr ValueArray ->
Word32 ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArrayRemove ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_remove_index()/@ instead."] #-}
valueArrayRemove ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> Word32
-> m ValueArray
valueArrayRemove :: ValueArray -> Word32 -> m ValueArray
valueArrayRemove valueArray :: ValueArray
valueArray index_ :: Word32
index_ = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
Ptr ValueArray
result <- Ptr ValueArray -> Word32 -> IO (Ptr ValueArray)
g_value_array_remove Ptr ValueArray
valueArray' Word32
index_
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArrayRemove" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArrayRemoveMethodInfo
instance (signature ~ (Word32 -> m ValueArray), MonadIO m) => O.MethodInfo ValueArrayRemoveMethodInfo ValueArray signature where
overloadedMethod = valueArrayRemove
#endif
foreign import ccall "g_value_array_sort_with_data" g_value_array_sort_with_data ::
Ptr ValueArray ->
FunPtr GLib.Callbacks.C_CompareDataFunc ->
Ptr () ->
IO (Ptr ValueArray)
{-# DEPRECATED valueArraySort ["(Since version 2.32)","Use t'GI.GLib.Structs.Array.Array' and @/g_array_sort_with_data()/@."] #-}
valueArraySort ::
(B.CallStack.HasCallStack, MonadIO m) =>
ValueArray
-> GLib.Callbacks.CompareDataFunc
-> m ValueArray
valueArraySort :: ValueArray -> CompareDataFunc -> m ValueArray
valueArraySort valueArray :: ValueArray
valueArray compareFunc :: CompareDataFunc
compareFunc = IO ValueArray -> m ValueArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ValueArray -> m ValueArray) -> IO ValueArray -> m ValueArray
forall a b. (a -> b) -> a -> b
$ do
Ptr ValueArray
valueArray' <- ValueArray -> IO (Ptr ValueArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ValueArray
valueArray
FunPtr C_CompareDataFunc
compareFunc' <- C_CompareDataFunc -> IO (FunPtr C_CompareDataFunc)
GLib.Callbacks.mk_CompareDataFunc (Maybe (Ptr (FunPtr C_CompareDataFunc))
-> C_CompareDataFunc -> C_CompareDataFunc
GLib.Callbacks.wrap_CompareDataFunc Maybe (Ptr (FunPtr C_CompareDataFunc))
forall a. Maybe a
Nothing (CompareDataFunc -> C_CompareDataFunc
GLib.Callbacks.drop_closures_CompareDataFunc CompareDataFunc
compareFunc))
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr ValueArray
result <- Ptr ValueArray
-> FunPtr C_CompareDataFunc -> Ptr () -> IO (Ptr ValueArray)
g_value_array_sort_with_data Ptr ValueArray
valueArray' FunPtr C_CompareDataFunc
compareFunc' Ptr ()
forall a. Ptr a
userData
Text -> Ptr ValueArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "valueArraySort" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray) Ptr ValueArray
result
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_CompareDataFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_CompareDataFunc
compareFunc'
ValueArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ValueArray
valueArray
ValueArray -> IO ValueArray
forall (m :: * -> *) a. Monad m => a -> m a
return ValueArray
result'
#if defined(ENABLE_OVERLOADING)
data ValueArraySortMethodInfo
instance (signature ~ (GLib.Callbacks.CompareDataFunc -> m ValueArray), MonadIO m) => O.MethodInfo ValueArraySortMethodInfo ValueArray signature where
overloadedMethod = valueArraySort
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveValueArrayMethod (t :: Symbol) (o :: *) :: * where
ResolveValueArrayMethod "append" o = ValueArrayAppendMethodInfo
ResolveValueArrayMethod "copy" o = ValueArrayCopyMethodInfo
ResolveValueArrayMethod "insert" o = ValueArrayInsertMethodInfo
ResolveValueArrayMethod "prepend" o = ValueArrayPrependMethodInfo
ResolveValueArrayMethod "remove" o = ValueArrayRemoveMethodInfo
ResolveValueArrayMethod "sort" o = ValueArraySortMethodInfo
ResolveValueArrayMethod "getNth" o = ValueArrayGetNthMethodInfo
ResolveValueArrayMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveValueArrayMethod t ValueArray, O.MethodInfo info ValueArray p) => OL.IsLabel t (ValueArray -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif