{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.GLib.Structs.Sequence.Sequence' struct is an opaque data type representing a
-- [sequence][glib-Sequences] data type.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GLib.Structs.Sequence
    ( 

-- * Exported types
    Sequence(..)                            ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveSequenceMethod                   ,
#endif


-- ** append #method:append#

#if defined(ENABLE_OVERLOADING)
    SequenceAppendMethodInfo                ,
#endif
    sequenceAppend                          ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    SequenceFreeMethodInfo                  ,
#endif
    sequenceFree                            ,


-- ** get #method:get#

    sequenceGet                             ,


-- ** getBeginIter #method:getBeginIter#

#if defined(ENABLE_OVERLOADING)
    SequenceGetBeginIterMethodInfo          ,
#endif
    sequenceGetBeginIter                    ,


-- ** getEndIter #method:getEndIter#

#if defined(ENABLE_OVERLOADING)
    SequenceGetEndIterMethodInfo            ,
#endif
    sequenceGetEndIter                      ,


-- ** getIterAtPos #method:getIterAtPos#

#if defined(ENABLE_OVERLOADING)
    SequenceGetIterAtPosMethodInfo          ,
#endif
    sequenceGetIterAtPos                    ,


-- ** getLength #method:getLength#

#if defined(ENABLE_OVERLOADING)
    SequenceGetLengthMethodInfo             ,
#endif
    sequenceGetLength                       ,


-- ** insertBefore #method:insertBefore#

    sequenceInsertBefore                    ,


-- ** isEmpty #method:isEmpty#

#if defined(ENABLE_OVERLOADING)
    SequenceIsEmptyMethodInfo               ,
#endif
    sequenceIsEmpty                         ,


-- ** move #method:move#

    sequenceMove                            ,


-- ** moveRange #method:moveRange#

    sequenceMoveRange                       ,


-- ** prepend #method:prepend#

#if defined(ENABLE_OVERLOADING)
    SequencePrependMethodInfo               ,
#endif
    sequencePrepend                         ,


-- ** rangeGetMidpoint #method:rangeGetMidpoint#

    sequenceRangeGetMidpoint                ,


-- ** remove #method:remove#

    sequenceRemove                          ,


-- ** removeRange #method:removeRange#

    sequenceRemoveRange                     ,


-- ** set #method:set#

    sequenceSet                             ,


-- ** swap #method:swap#

    sequenceSwap                            ,




    ) 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.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 {-# SOURCE #-} qualified GI.GLib.Structs.SequenceIter as GLib.SequenceIter

-- | Memory-managed wrapper type.
newtype Sequence = Sequence (SP.ManagedPtr Sequence)
    deriving (Sequence -> Sequence -> Bool
(Sequence -> Sequence -> Bool)
-> (Sequence -> Sequence -> Bool) -> Eq Sequence
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sequence -> Sequence -> Bool
$c/= :: Sequence -> Sequence -> Bool
== :: Sequence -> Sequence -> Bool
$c== :: Sequence -> Sequence -> Bool
Eq)

instance SP.ManagedPtrNewtype Sequence where
    toManagedPtr :: Sequence -> ManagedPtr Sequence
toManagedPtr (Sequence ManagedPtr Sequence
p) = ManagedPtr Sequence
p

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr Sequence where
    boxedPtrCopy :: Sequence -> IO Sequence
boxedPtrCopy = Sequence -> IO Sequence
forall (m :: * -> *) a. Monad m => a -> m a
return
    boxedPtrFree :: Sequence -> IO ()
boxedPtrFree = \Sequence
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Sequence
type instance O.AttributeList Sequence = SequenceAttributeList
type SequenceAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method Sequence::append
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data for the new item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_append" g_sequence_append :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Adds a new item to the end of /@seq@/.
-- 
-- /Since: 2.14/
sequenceAppend ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> Ptr ()
    -- ^ /@data@/: the data for the new item
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ an iterator pointing to the new item
sequenceAppend :: Sequence -> Ptr () -> m SequenceIter
sequenceAppend Sequence
seq Ptr ()
data_ = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr SequenceIter
result <- Ptr Sequence -> Ptr () -> IO (Ptr SequenceIter)
g_sequence_append Ptr Sequence
seq' Ptr ()
data_
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceAppend" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
data SequenceAppendMethodInfo
instance (signature ~ (Ptr () -> m GLib.SequenceIter.SequenceIter), MonadIO m) => O.MethodInfo SequenceAppendMethodInfo Sequence signature where
    overloadedMethod = sequenceAppend

#endif

-- method Sequence::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_free" g_sequence_free :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    IO ()

-- | Frees the memory allocated for /@seq@/. If /@seq@/ has a data destroy
-- function associated with it, that function is called on all items
-- in /@seq@/.
-- 
-- /Since: 2.14/
sequenceFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> m ()
sequenceFree :: Sequence -> m ()
sequenceFree Sequence
seq = 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 Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr Sequence -> IO ()
g_sequence_free Ptr Sequence
seq'
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SequenceFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo SequenceFreeMethodInfo Sequence signature where
    overloadedMethod = sequenceFree

#endif

-- method Sequence::get_begin_iter
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_get_begin_iter" g_sequence_get_begin_iter :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Returns the begin iterator for /@seq@/.
-- 
-- /Since: 2.14/
sequenceGetBeginIter ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ the begin iterator for /@seq@/.
sequenceGetBeginIter :: Sequence -> m SequenceIter
sequenceGetBeginIter Sequence
seq = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr SequenceIter
result <- Ptr Sequence -> IO (Ptr SequenceIter)
g_sequence_get_begin_iter Ptr Sequence
seq'
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceGetBeginIter" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
data SequenceGetBeginIterMethodInfo
instance (signature ~ (m GLib.SequenceIter.SequenceIter), MonadIO m) => O.MethodInfo SequenceGetBeginIterMethodInfo Sequence signature where
    overloadedMethod = sequenceGetBeginIter

#endif

-- method Sequence::get_end_iter
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_get_end_iter" g_sequence_get_end_iter :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Returns the end iterator for /@seg@/
-- 
-- /Since: 2.14/
sequenceGetEndIter ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ the end iterator for /@seq@/
sequenceGetEndIter :: Sequence -> m SequenceIter
sequenceGetEndIter Sequence
seq = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr SequenceIter
result <- Ptr Sequence -> IO (Ptr SequenceIter)
g_sequence_get_end_iter Ptr Sequence
seq'
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceGetEndIter" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
data SequenceGetEndIterMethodInfo
instance (signature ~ (m GLib.SequenceIter.SequenceIter), MonadIO m) => O.MethodInfo SequenceGetEndIterMethodInfo Sequence signature where
    overloadedMethod = sequenceGetEndIter

#endif

-- method Sequence::get_iter_at_pos
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pos"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a position in @seq, or -1 for the end"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_get_iter_at_pos" g_sequence_get_iter_at_pos :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    Int32 ->                                -- pos : TBasicType TInt
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Returns the iterator at position /@pos@/. If /@pos@/ is negative or larger
-- than the number of items in /@seq@/, the end iterator is returned.
-- 
-- /Since: 2.14/
sequenceGetIterAtPos ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> Int32
    -- ^ /@pos@/: a position in /@seq@/, or -1 for the end
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ The t'GI.GLib.Structs.SequenceIter.SequenceIter' at position /@pos@/
sequenceGetIterAtPos :: Sequence -> Int32 -> m SequenceIter
sequenceGetIterAtPos Sequence
seq Int32
pos = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr SequenceIter
result <- Ptr Sequence -> Int32 -> IO (Ptr SequenceIter)
g_sequence_get_iter_at_pos Ptr Sequence
seq' Int32
pos
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceGetIterAtPos" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
data SequenceGetIterAtPosMethodInfo
instance (signature ~ (Int32 -> m GLib.SequenceIter.SequenceIter), MonadIO m) => O.MethodInfo SequenceGetIterAtPosMethodInfo Sequence signature where
    overloadedMethod = sequenceGetIterAtPos

#endif

-- method Sequence::get_length
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_get_length" g_sequence_get_length :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    IO Int32

-- | Returns the length of /@seq@/. Note that this method is O(h) where \`h\' is the
-- height of the tree. It is thus more efficient to use 'GI.GLib.Structs.Sequence.sequenceIsEmpty'
-- when comparing the length to zero.
-- 
-- /Since: 2.14/
sequenceGetLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> m Int32
    -- ^ __Returns:__ the length of /@seq@/
sequenceGetLength :: Sequence -> m Int32
sequenceGetLength Sequence
seq = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Int32
result <- Ptr Sequence -> IO Int32
g_sequence_get_length Ptr Sequence
seq'
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data SequenceGetLengthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo SequenceGetLengthMethodInfo Sequence signature where
    overloadedMethod = sequenceGetLength

#endif

-- method Sequence::is_empty
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_is_empty" g_sequence_is_empty :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    IO CInt

-- | Returns 'P.True' if the sequence contains zero items.
-- 
-- This function is functionally identical to checking the result of
-- 'GI.GLib.Structs.Sequence.sequenceGetLength' being equal to zero. However this function is
-- implemented in O(1) running time.
-- 
-- /Since: 2.48/
sequenceIsEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the sequence is empty, otherwise 'P.False'.
sequenceIsEmpty :: Sequence -> m Bool
sequenceIsEmpty Sequence
seq = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    CInt
result <- Ptr Sequence -> IO CInt
g_sequence_is_empty Ptr Sequence
seq'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data SequenceIsEmptyMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo SequenceIsEmptyMethodInfo Sequence signature where
    overloadedMethod = sequenceIsEmpty

#endif

-- method Sequence::prepend
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "seq"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Sequence" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequence" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data for the new item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_prepend" g_sequence_prepend :: 
    Ptr Sequence ->                         -- seq : TInterface (Name {namespace = "GLib", name = "Sequence"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Adds a new item to the front of /@seq@/
-- 
-- /Since: 2.14/
sequencePrepend ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sequence
    -- ^ /@seq@/: a t'GI.GLib.Structs.Sequence.Sequence'
    -> Ptr ()
    -- ^ /@data@/: the data for the new item
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ an iterator pointing to the new item
sequencePrepend :: Sequence -> Ptr () -> m SequenceIter
sequencePrepend Sequence
seq Ptr ()
data_ = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sequence
seq' <- Sequence -> IO (Ptr Sequence)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sequence
seq
    Ptr SequenceIter
result <- Ptr Sequence -> Ptr () -> IO (Ptr SequenceIter)
g_sequence_prepend Ptr Sequence
seq' Ptr ()
data_
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequencePrepend" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    Sequence -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Sequence
seq
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
data SequencePrependMethodInfo
instance (signature ~ (Ptr () -> m GLib.SequenceIter.SequenceIter), MonadIO m) => O.MethodInfo SequencePrependMethodInfo Sequence signature where
    overloadedMethod = sequencePrepend

#endif

-- method Sequence::get
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "iter"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_get" g_sequence_get :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO (Ptr ())

-- | Returns the data that /@iter@/ points to.
-- 
-- /Since: 2.14/
sequenceGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@iter@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m (Ptr ())
    -- ^ __Returns:__ the data that /@iter@/ points to
sequenceGet :: SequenceIter -> m (Ptr ())
sequenceGet SequenceIter
iter = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr SequenceIter
iter' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
iter
    Ptr ()
result <- Ptr SequenceIter -> IO (Ptr ())
g_sequence_get Ptr SequenceIter
iter'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
iter
    Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::insert_before
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "iter"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data for the new item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_insert_before" g_sequence_insert_before :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Inserts a new item just before the item pointed to by /@iter@/.
-- 
-- /Since: 2.14/
sequenceInsertBefore ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@iter@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> Ptr ()
    -- ^ /@data@/: the data for the new item
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ an iterator pointing to the new item
sequenceInsertBefore :: SequenceIter -> Ptr () -> m SequenceIter
sequenceInsertBefore SequenceIter
iter Ptr ()
data_ = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr SequenceIter
iter' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
iter
    Ptr SequenceIter
result <- Ptr SequenceIter -> Ptr () -> IO (Ptr SequenceIter)
g_sequence_insert_before Ptr SequenceIter
iter' Ptr ()
data_
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceInsertBefore" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
iter
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::move
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "src"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter pointing to the item to move"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dest"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GSequenceIter pointing to the position to which\n    the item is moved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_move" g_sequence_move :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- src : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- dest : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO ()

-- | Moves the item pointed to by /@src@/ to the position indicated by /@dest@/.
-- After calling this function /@dest@/ will point to the position immediately
-- after /@src@/. It is allowed for /@src@/ and /@dest@/ to point into different
-- sequences.
-- 
-- /Since: 2.14/
sequenceMove ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@src@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter' pointing to the item to move
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@dest@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter' pointing to the position to which
    --     the item is moved
    -> m ()
sequenceMove :: SequenceIter -> SequenceIter -> m ()
sequenceMove SequenceIter
src SequenceIter
dest = 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 SequenceIter
src' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
src
    Ptr SequenceIter
dest' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
dest
    Ptr SequenceIter -> Ptr SequenceIter -> IO ()
g_sequence_move Ptr SequenceIter
src' Ptr SequenceIter
dest'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
src
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
dest
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::move_range
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "dest"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "begin"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_move_range" g_sequence_move_range :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- dest : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- begin : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- end : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO ()

-- | Inserts the (/@begin@/, /@end@/) range at the destination pointed to by /@dest@/.
-- The /@begin@/ and /@end@/ iters must point into the same sequence. It is
-- allowed for /@dest@/ to point to a different sequence than the one pointed
-- into by /@begin@/ and /@end@/.
-- 
-- If /@dest@/ is 'P.Nothing', the range indicated by /@begin@/ and /@end@/ is
-- removed from the sequence. If /@dest@/ points to a place within
-- the (/@begin@/, /@end@/) range, the range does not move.
-- 
-- /Since: 2.14/
sequenceMoveRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@dest@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@begin@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@end@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m ()
sequenceMoveRange :: SequenceIter -> SequenceIter -> SequenceIter -> m ()
sequenceMoveRange SequenceIter
dest SequenceIter
begin SequenceIter
end = 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 SequenceIter
dest' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
dest
    Ptr SequenceIter
begin' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
begin
    Ptr SequenceIter
end' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
end
    Ptr SequenceIter -> Ptr SequenceIter -> Ptr SequenceIter -> IO ()
g_sequence_move_range Ptr SequenceIter
dest' Ptr SequenceIter
begin' Ptr SequenceIter
end'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
dest
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
begin
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
end
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::range_get_midpoint
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "begin"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "SequenceIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_range_get_midpoint" g_sequence_range_get_midpoint :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- begin : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- end : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO (Ptr GLib.SequenceIter.SequenceIter)

-- | Finds an iterator somewhere in the range (/@begin@/, /@end@/). This
-- iterator will be close to the middle of the range, but is not
-- guaranteed to be exactly in the middle.
-- 
-- The /@begin@/ and /@end@/ iterators must both point to the same sequence
-- and /@begin@/ must come before or be equal to /@end@/ in the sequence.
-- 
-- /Since: 2.14/
sequenceRangeGetMidpoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@begin@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@end@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m GLib.SequenceIter.SequenceIter
    -- ^ __Returns:__ a t'GI.GLib.Structs.SequenceIter.SequenceIter' pointing somewhere in the
    --    (/@begin@/, /@end@/) range
sequenceRangeGetMidpoint :: SequenceIter -> SequenceIter -> m SequenceIter
sequenceRangeGetMidpoint SequenceIter
begin SequenceIter
end = IO SequenceIter -> m SequenceIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SequenceIter -> m SequenceIter)
-> IO SequenceIter -> m SequenceIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr SequenceIter
begin' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
begin
    Ptr SequenceIter
end' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
end
    Ptr SequenceIter
result <- Ptr SequenceIter -> Ptr SequenceIter -> IO (Ptr SequenceIter)
g_sequence_range_get_midpoint Ptr SequenceIter
begin' Ptr SequenceIter
end'
    Text -> Ptr SequenceIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sequenceRangeGetMidpoint" Ptr SequenceIter
result
    SequenceIter
result' <- ((ManagedPtr SequenceIter -> SequenceIter)
-> Ptr SequenceIter -> IO SequenceIter
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr SequenceIter -> SequenceIter
GLib.SequenceIter.SequenceIter) Ptr SequenceIter
result
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
begin
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
end
    SequenceIter -> IO SequenceIter
forall (m :: * -> *) a. Monad m => a -> m a
return SequenceIter
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::remove
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "iter"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_remove" g_sequence_remove :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO ()

-- | Removes the item pointed to by /@iter@/. It is an error to pass the
-- end iterator to this function.
-- 
-- If the sequence has a data destroy function associated with it, this
-- function is called on the data for the removed item.
-- 
-- /Since: 2.14/
sequenceRemove ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@iter@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m ()
sequenceRemove :: SequenceIter -> m ()
sequenceRemove SequenceIter
iter = 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 SequenceIter
iter' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
iter
    Ptr SequenceIter -> IO ()
g_sequence_remove Ptr SequenceIter
iter'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
iter
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::remove_range
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "begin"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_remove_range" g_sequence_remove_range :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- begin : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- end : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO ()

-- | Removes all items in the (/@begin@/, /@end@/) range.
-- 
-- If the sequence has a data destroy function associated with it, this
-- function is called on the data for the removed items.
-- 
-- /Since: 2.14/
sequenceRemoveRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@begin@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@end@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m ()
sequenceRemoveRange :: SequenceIter -> SequenceIter -> m ()
sequenceRemoveRange SequenceIter
begin SequenceIter
end = 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 SequenceIter
begin' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
begin
    Ptr SequenceIter
end' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
end
    Ptr SequenceIter -> Ptr SequenceIter -> IO ()
g_sequence_remove_range Ptr SequenceIter
begin' Ptr SequenceIter
end'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
begin
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
end
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::set
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "iter"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "new data for the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_set" g_sequence_set :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO ()

-- | Changes the data for the item pointed to by /@iter@/ to be /@data@/. If
-- the sequence has a data destroy function associated with it, that
-- function is called on the existing data that /@iter@/ pointed to.
-- 
-- /Since: 2.14/
sequenceSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@iter@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> Ptr ()
    -- ^ /@data@/: new data for the item
    -> m ()
sequenceSet :: SequenceIter -> Ptr () -> m ()
sequenceSet SequenceIter
iter Ptr ()
data_ = 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 SequenceIter
iter' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
iter
    Ptr SequenceIter -> Ptr () -> IO ()
g_sequence_set Ptr SequenceIter
iter' Ptr ()
data_
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
iter
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sequence::swap
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "SequenceIter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSequenceIter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_sequence_swap" g_sequence_swap :: 
    Ptr GLib.SequenceIter.SequenceIter ->   -- a : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    Ptr GLib.SequenceIter.SequenceIter ->   -- b : TInterface (Name {namespace = "GLib", name = "SequenceIter"})
    IO ()

-- | Swaps the items pointed to by /@a@/ and /@b@/. It is allowed for /@a@/ and /@b@/
-- to point into difference sequences.
-- 
-- /Since: 2.14/
sequenceSwap ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.SequenceIter.SequenceIter
    -- ^ /@a@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> GLib.SequenceIter.SequenceIter
    -- ^ /@b@/: a t'GI.GLib.Structs.SequenceIter.SequenceIter'
    -> m ()
sequenceSwap :: SequenceIter -> SequenceIter -> m ()
sequenceSwap SequenceIter
a SequenceIter
b = 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 SequenceIter
a' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
a
    Ptr SequenceIter
b' <- SequenceIter -> IO (Ptr SequenceIter)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SequenceIter
b
    Ptr SequenceIter -> Ptr SequenceIter -> IO ()
g_sequence_swap Ptr SequenceIter
a' Ptr SequenceIter
b'
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
a
    SequenceIter -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SequenceIter
b
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSequenceMethod (t :: Symbol) (o :: *) :: * where
    ResolveSequenceMethod "append" o = SequenceAppendMethodInfo
    ResolveSequenceMethod "free" o = SequenceFreeMethodInfo
    ResolveSequenceMethod "isEmpty" o = SequenceIsEmptyMethodInfo
    ResolveSequenceMethod "prepend" o = SequencePrependMethodInfo
    ResolveSequenceMethod "getBeginIter" o = SequenceGetBeginIterMethodInfo
    ResolveSequenceMethod "getEndIter" o = SequenceGetEndIterMethodInfo
    ResolveSequenceMethod "getIterAtPos" o = SequenceGetIterAtPosMethodInfo
    ResolveSequenceMethod "getLength" o = SequenceGetLengthMethodInfo
    ResolveSequenceMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSequenceMethod t Sequence, O.MethodInfo info Sequence p) => OL.IsLabel t (Sequence -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif