{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) The 'GI.GLib.Structs.SequenceIter.SequenceIter' struct is an opaque data type representing an iterator pointing into a 'GI.GLib.Structs.Sequence.Sequence'. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GLib.Structs.SequenceIter ( -- * Exported types SequenceIter(..) , noSequenceIter , -- * Methods -- ** compare #method:compare# #if ENABLE_OVERLOADING SequenceIterCompareMethodInfo , #endif sequenceIterCompare , -- ** getPosition #method:getPosition# #if ENABLE_OVERLOADING SequenceIterGetPositionMethodInfo , #endif sequenceIterGetPosition , -- ** getSequence #method:getSequence# #if ENABLE_OVERLOADING SequenceIterGetSequenceMethodInfo , #endif sequenceIterGetSequence , -- ** isBegin #method:isBegin# #if ENABLE_OVERLOADING SequenceIterIsBeginMethodInfo , #endif sequenceIterIsBegin , -- ** isEnd #method:isEnd# #if ENABLE_OVERLOADING SequenceIterIsEndMethodInfo , #endif sequenceIterIsEnd , -- ** move #method:move# #if ENABLE_OVERLOADING SequenceIterMoveMethodInfo , #endif sequenceIterMove , -- ** next #method:next# #if ENABLE_OVERLOADING SequenceIterNextMethodInfo , #endif sequenceIterNext , -- ** prev #method:prev# #if ENABLE_OVERLOADING SequenceIterPrevMethodInfo , #endif sequenceIterPrev , ) 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.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.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import {-# SOURCE #-} qualified GI.GLib.Structs.Sequence as GLib.Sequence -- | Memory-managed wrapper type. newtype SequenceIter = SequenceIter (ManagedPtr SequenceIter) -- XXX Wrapping a foreign struct/union with no known destructor or size, leak? instance WrappedPtr SequenceIter where wrappedPtrCalloc = return nullPtr wrappedPtrCopy = return wrappedPtrFree = Nothing -- | A convenience alias for `Nothing` :: `Maybe` `SequenceIter`. noSequenceIter :: Maybe SequenceIter noSequenceIter = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList SequenceIter type instance O.AttributeList SequenceIter = SequenceIterAttributeList type SequenceIterAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method SequenceIter::compare -- method type : OrdinaryMethod -- 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 : Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_compare" g_sequence_iter_compare :: Ptr SequenceIter -> -- a : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) Ptr SequenceIter -> -- b : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO Int32 {- | Returns a negative number if /@a@/ comes before /@b@/, 0 if they are equal, and a positive number if /@a@/ comes after /@b@/. The /@a@/ and /@b@/ iterators must point into the same sequence. /Since: 2.14/ -} sequenceIterCompare :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@a@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> SequenceIter {- ^ /@b@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m Int32 {- ^ __Returns:__ a negative number if /@a@/ comes before /@b@/, 0 if they are equal, and a positive number if /@a@/ comes after /@b@/ -} sequenceIterCompare a b = liftIO $ do a' <- unsafeManagedPtrGetPtr a b' <- unsafeManagedPtrGetPtr b result <- g_sequence_iter_compare a' b' touchManagedPtr a touchManagedPtr b return result #if ENABLE_OVERLOADING data SequenceIterCompareMethodInfo instance (signature ~ (SequenceIter -> m Int32), MonadIO m) => O.MethodInfo SequenceIterCompareMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterCompare #endif -- method SequenceIter::get_position -- method type : OrdinaryMethod -- 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 TInt) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_get_position" g_sequence_iter_get_position :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO Int32 {- | Returns the position of /@iter@/ /Since: 2.14/ -} sequenceIterGetPosition :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m Int32 {- ^ __Returns:__ the position of /@iter@/ -} sequenceIterGetPosition iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_get_position iter' touchManagedPtr iter return result #if ENABLE_OVERLOADING data SequenceIterGetPositionMethodInfo instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo SequenceIterGetPositionMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterGetPosition #endif -- method SequenceIter::get_sequence -- method type : OrdinaryMethod -- 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 (TInterface (Name {namespace = "GLib", name = "Sequence"})) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_get_sequence" g_sequence_iter_get_sequence :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO (Ptr GLib.Sequence.Sequence) {- | Returns the 'GI.GLib.Structs.Sequence.Sequence' that /@iter@/ points into. /Since: 2.14/ -} sequenceIterGetSequence :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m GLib.Sequence.Sequence {- ^ __Returns:__ the 'GI.GLib.Structs.Sequence.Sequence' that /@iter@/ points into -} sequenceIterGetSequence iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_get_sequence iter' checkUnexpectedReturnNULL "sequenceIterGetSequence" result result' <- (newPtr GLib.Sequence.Sequence) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterGetSequenceMethodInfo instance (signature ~ (m GLib.Sequence.Sequence), MonadIO m) => O.MethodInfo SequenceIterGetSequenceMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterGetSequence #endif -- method SequenceIter::is_begin -- method type : OrdinaryMethod -- 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 TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_is_begin" g_sequence_iter_is_begin :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO CInt {- | Returns whether /@iter@/ is the begin iterator /Since: 2.14/ -} sequenceIterIsBegin :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m Bool {- ^ __Returns:__ whether /@iter@/ is the begin iterator -} sequenceIterIsBegin iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_is_begin iter' let result' = (/= 0) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterIsBeginMethodInfo instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo SequenceIterIsBeginMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterIsBegin #endif -- method SequenceIter::is_end -- method type : OrdinaryMethod -- 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 TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_is_end" g_sequence_iter_is_end :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO CInt {- | Returns whether /@iter@/ is the end iterator /Since: 2.14/ -} sequenceIterIsEnd :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m Bool {- ^ __Returns:__ Whether /@iter@/ is the end iterator -} sequenceIterIsEnd iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_is_end iter' let result' = (/= 0) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterIsEndMethodInfo instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo SequenceIterIsEndMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterIsEnd #endif -- method SequenceIter::move -- method type : OrdinaryMethod -- 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 = "delta", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A positive or negative number indicating how many positions away\n from @iter the returned #GSequenceIter will be", 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_iter_move" g_sequence_iter_move :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) Int32 -> -- delta : TBasicType TInt IO (Ptr SequenceIter) {- | Returns the 'GI.GLib.Structs.SequenceIter.SequenceIter' which is /@delta@/ positions away from /@iter@/. If /@iter@/ is closer than -/@delta@/ positions to the beginning of the sequence, the begin iterator is returned. If /@iter@/ is closer than /@delta@/ positions to the end of the sequence, the end iterator is returned. /Since: 2.14/ -} sequenceIterMove :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> Int32 {- ^ /@delta@/: A positive or negative number indicating how many positions away from /@iter@/ the returned 'GI.GLib.Structs.SequenceIter.SequenceIter' will be -} -> m SequenceIter {- ^ __Returns:__ a 'GI.GLib.Structs.SequenceIter.SequenceIter' which is /@delta@/ positions away from /@iter@/ -} sequenceIterMove iter delta = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_move iter' delta checkUnexpectedReturnNULL "sequenceIterMove" result result' <- (newPtr SequenceIter) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterMoveMethodInfo instance (signature ~ (Int32 -> m SequenceIter), MonadIO m) => O.MethodInfo SequenceIterMoveMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterMove #endif -- method SequenceIter::next -- method type : OrdinaryMethod -- 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 (TInterface (Name {namespace = "GLib", name = "SequenceIter"})) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_next" g_sequence_iter_next :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO (Ptr SequenceIter) {- | Returns an iterator pointing to the next position after /@iter@/. If /@iter@/ is the end iterator, the end iterator is returned. /Since: 2.14/ -} sequenceIterNext :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m SequenceIter {- ^ __Returns:__ a 'GI.GLib.Structs.SequenceIter.SequenceIter' pointing to the next position after /@iter@/ -} sequenceIterNext iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_next iter' checkUnexpectedReturnNULL "sequenceIterNext" result result' <- (newPtr SequenceIter) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterNextMethodInfo instance (signature ~ (m SequenceIter), MonadIO m) => O.MethodInfo SequenceIterNextMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterNext #endif -- method SequenceIter::prev -- method type : OrdinaryMethod -- 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 (TInterface (Name {namespace = "GLib", name = "SequenceIter"})) -- throws : False -- Skip return : False foreign import ccall "g_sequence_iter_prev" g_sequence_iter_prev :: Ptr SequenceIter -> -- iter : TInterface (Name {namespace = "GLib", name = "SequenceIter"}) IO (Ptr SequenceIter) {- | Returns an iterator pointing to the previous position before /@iter@/. If /@iter@/ is the begin iterator, the begin iterator is returned. /Since: 2.14/ -} sequenceIterPrev :: (B.CallStack.HasCallStack, MonadIO m) => SequenceIter {- ^ /@iter@/: a 'GI.GLib.Structs.SequenceIter.SequenceIter' -} -> m SequenceIter {- ^ __Returns:__ a 'GI.GLib.Structs.SequenceIter.SequenceIter' pointing to the previous position before /@iter@/ -} sequenceIterPrev iter = liftIO $ do iter' <- unsafeManagedPtrGetPtr iter result <- g_sequence_iter_prev iter' checkUnexpectedReturnNULL "sequenceIterPrev" result result' <- (newPtr SequenceIter) result touchManagedPtr iter return result' #if ENABLE_OVERLOADING data SequenceIterPrevMethodInfo instance (signature ~ (m SequenceIter), MonadIO m) => O.MethodInfo SequenceIterPrevMethodInfo SequenceIter signature where overloadedMethod _ = sequenceIterPrev #endif #if ENABLE_OVERLOADING type family ResolveSequenceIterMethod (t :: Symbol) (o :: *) :: * where ResolveSequenceIterMethod "compare" o = SequenceIterCompareMethodInfo ResolveSequenceIterMethod "isBegin" o = SequenceIterIsBeginMethodInfo ResolveSequenceIterMethod "isEnd" o = SequenceIterIsEndMethodInfo ResolveSequenceIterMethod "move" o = SequenceIterMoveMethodInfo ResolveSequenceIterMethod "next" o = SequenceIterNextMethodInfo ResolveSequenceIterMethod "prev" o = SequenceIterPrevMethodInfo ResolveSequenceIterMethod "getPosition" o = SequenceIterGetPositionMethodInfo ResolveSequenceIterMethod "getSequence" o = SequenceIterGetSequenceMethodInfo ResolveSequenceIterMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveSequenceIterMethod t SequenceIter, O.MethodInfo info SequenceIter p) => O.IsLabelProxy t (SequenceIter -> p) where fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveSequenceIterMethod t SequenceIter, O.MethodInfo info SequenceIter p) => O.IsLabel t (SequenceIter -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif #endif