{-# 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 ,
#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
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 GHC.Records as R
import qualified GI.GLib.Callbacks as GLib.Callbacks
newtype ValueArray = ValueArray (SP.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)
instance SP.ManagedPtrNewtype ValueArray where
toManagedPtr :: ValueArray -> ManagedPtr ValueArray
toManagedPtr (ValueArray ManagedPtr ValueArray
p) = ManagedPtr ValueArray
p
foreign import ccall "g_value_array_get_type" c_g_value_array_get_type ::
IO GType
type instance O.ParentTypes ValueArray = '[]
instance O.HasParentTypes ValueArray
instance B.Types.TypedObject ValueArray where
glibType :: IO GType
glibType = IO GType
c_g_value_array_get_type
instance B.Types.GBoxed ValueArray
instance B.GValue.IsGValue (Maybe ValueArray) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_value_array_get_type
gvalueSet_ :: Ptr GValue -> Maybe ValueArray -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ValueArray
P.Nothing = Ptr GValue -> Ptr ValueArray -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr ValueArray
forall a. Ptr a
FP.nullPtr :: FP.Ptr ValueArray)
gvalueSet_ Ptr GValue
gv (P.Just ValueArray
obj) = ValueArray -> (Ptr ValueArray -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ValueArray
obj (Ptr GValue -> Ptr ValueArray -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ValueArray)
gvalueGet_ Ptr GValue
gv = do
Ptr ValueArray
ptr <- Ptr GValue -> IO (Ptr ValueArray)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr ValueArray)
if Ptr ValueArray
ptr Ptr ValueArray -> Ptr ValueArray -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ValueArray
forall a. Ptr a
FP.nullPtr
then ValueArray -> Maybe ValueArray
forall a. a -> Maybe a
P.Just (ValueArray -> Maybe ValueArray)
-> IO ValueArray -> IO (Maybe ValueArray)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr ValueArray -> ValueArray
ValueArray Ptr ValueArray
ptr
else Maybe ValueArray -> IO (Maybe ValueArray)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ValueArray
forall a. Maybe a
P.Nothing
newZeroValueArray :: MonadIO m => m ValueArray
newZeroValueArray :: forall (m :: * -> *). MonadIO m => 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. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
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, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ValueArray -> ValueArray
ValueArray
instance tag ~ 'AttrSet => Constructible ValueArray tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr ValueArray -> ValueArray)
-> [AttrOp ValueArray tag] -> m ValueArray
new ManagedPtr ValueArray -> ValueArray
_ [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
getValueArrayNValues :: MonadIO m => ValueArray -> m Word32
getValueArrayNValues :: forall (m :: * -> *). MonadIO m => ValueArray -> m Word32
getValueArrayNValues 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 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` Int
0) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setValueArrayNValues :: MonadIO m => ValueArray -> Word32 -> m ()
setValueArrayNValues :: forall (m :: * -> *). MonadIO m => ValueArray -> Word32 -> m ()
setValueArrayNValues ValueArray
s 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 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` Int
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 :: forall (m :: * -> *). MonadIO m => ValueArray -> m (Maybe GValue)
getValueArrayValues 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 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` Int
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
$ \Ptr GValue
val' -> do
GValue
val'' <- Ptr GValue -> IO GValue
B.GValue.newGValueFromPtr 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 :: forall (m :: * -> *). MonadIO m => ValueArray -> Ptr GValue -> m ()
setValueArrayValues ValueArray
s 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 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` Int
8) (Ptr GValue
val :: Ptr GValue)
clearValueArrayValues :: MonadIO m => ValueArray -> m ()
clearValueArrayValues :: forall (m :: * -> *). MonadIO m => ValueArray -> m ()
clearValueArrayValues 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 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` Int
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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> m ValueArray
valueArrayNew 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 Text
"valueArrayNew" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> Maybe GValue -> m ValueArray
valueArrayAppend ValueArray
valueArray 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
Maybe GValue
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just 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 Text
"valueArrayAppend" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArrayAppendMethodInfo ValueArray signature where
overloadedMethod = valueArrayAppend
instance O.OverloadedMethodInfo ValueArrayAppendMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayAppend",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> m ValueArray
valueArrayCopy 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 Text
"valueArrayCopy" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArrayCopyMethodInfo ValueArray signature where
overloadedMethod = valueArrayCopy
instance O.OverloadedMethodInfo ValueArrayCopyMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayCopy",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> Word32 -> m GValue
valueArrayGetNth ValueArray
valueArray 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 Text
"valueArrayGetNth" Ptr GValue
result
GValue
result' <- Ptr GValue -> IO GValue
B.GValue.newGValueFromPtr 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.OverloadedMethod ValueArrayGetNthMethodInfo ValueArray signature where
overloadedMethod = valueArrayGetNth
instance O.OverloadedMethodInfo ValueArrayGetNthMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayGetNth",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> Word32 -> Maybe GValue -> m ValueArray
valueArrayInsert ValueArray
valueArray Word32
index_ 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
Maybe GValue
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just 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 Text
"valueArrayInsert" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArrayInsertMethodInfo ValueArray signature where
overloadedMethod = valueArrayInsert
instance O.OverloadedMethodInfo ValueArrayInsertMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayInsert",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> Maybe GValue -> m ValueArray
valueArrayPrepend ValueArray
valueArray 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
Maybe GValue
Nothing -> Ptr GValue -> IO (Ptr GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GValue
forall a. Ptr a
nullPtr
Just 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 Text
"valueArrayPrepend" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArrayPrependMethodInfo ValueArray signature where
overloadedMethod = valueArrayPrepend
instance O.OverloadedMethodInfo ValueArrayPrependMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayPrepend",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> Word32 -> m ValueArray
valueArrayRemove ValueArray
valueArray 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 Text
"valueArrayRemove" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArrayRemoveMethodInfo ValueArray signature where
overloadedMethod = valueArrayRemove
instance O.OverloadedMethodInfo ValueArrayRemoveMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArrayRemove",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ValueArray -> CompareDataFunc -> m ValueArray
valueArraySort ValueArray
valueArray 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 Text
"valueArraySort" Ptr ValueArray
result
ValueArray
result' <- ((ManagedPtr ValueArray -> ValueArray)
-> Ptr ValueArray -> IO ValueArray
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod ValueArraySortMethodInfo ValueArray signature where
overloadedMethod = valueArraySort
instance O.OverloadedMethodInfo ValueArraySortMethodInfo ValueArray where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.GObject.Structs.ValueArray.valueArraySort",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gobject-2.0.26/docs/GI-GObject-Structs-ValueArray.html#v: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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveValueArrayMethod t ValueArray, O.OverloadedMethod info ValueArray p, R.HasField t ValueArray p) => R.HasField t ValueArray p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveValueArrayMethod t ValueArray, O.OverloadedMethodInfo info ValueArray) => OL.IsLabel t (O.MethodProxy info ValueArray) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif