{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Ggit.Structs.RefSpec
(
RefSpec(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveRefSpecMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RefSpecGetDestinationMethodInfo ,
#endif
refSpecGetDestination ,
#if defined(ENABLE_OVERLOADING)
RefSpecGetSourceMethodInfo ,
#endif
refSpecGetSource ,
#if defined(ENABLE_OVERLOADING)
RefSpecIsForcedMethodInfo ,
#endif
refSpecIsForced ,
#if defined(ENABLE_OVERLOADING)
RefSpecRefMethodInfo ,
#endif
refSpecRef ,
#if defined(ENABLE_OVERLOADING)
RefSpecUnrefMethodInfo ,
#endif
refSpecUnref ,
) 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
newtype RefSpec = RefSpec (SP.ManagedPtr RefSpec)
deriving (RefSpec -> RefSpec -> Bool
(RefSpec -> RefSpec -> Bool)
-> (RefSpec -> RefSpec -> Bool) -> Eq RefSpec
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefSpec -> RefSpec -> Bool
$c/= :: RefSpec -> RefSpec -> Bool
== :: RefSpec -> RefSpec -> Bool
$c== :: RefSpec -> RefSpec -> Bool
Eq)
instance SP.ManagedPtrNewtype RefSpec where
toManagedPtr :: RefSpec -> ManagedPtr RefSpec
toManagedPtr (RefSpec ManagedPtr RefSpec
p) = ManagedPtr RefSpec
p
foreign import ccall "ggit_ref_spec_get_type" c_ggit_ref_spec_get_type ::
IO GType
type instance O.ParentTypes RefSpec = '[]
instance O.HasParentTypes RefSpec
instance B.Types.TypedObject RefSpec where
glibType :: IO GType
glibType = IO GType
c_ggit_ref_spec_get_type
instance B.Types.GBoxed RefSpec
instance B.GValue.IsGValue (Maybe RefSpec) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ggit_ref_spec_get_type
gvalueSet_ :: Ptr GValue -> Maybe RefSpec -> IO ()
gvalueSet_ Ptr GValue
gv Maybe RefSpec
P.Nothing = Ptr GValue -> Ptr RefSpec -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr RefSpec
forall a. Ptr a
FP.nullPtr :: FP.Ptr RefSpec)
gvalueSet_ Ptr GValue
gv (P.Just RefSpec
obj) = RefSpec -> (Ptr RefSpec -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RefSpec
obj (Ptr GValue -> Ptr RefSpec -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe RefSpec)
gvalueGet_ Ptr GValue
gv = do
Ptr RefSpec
ptr <- Ptr GValue -> IO (Ptr RefSpec)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr RefSpec)
if Ptr RefSpec
ptr Ptr RefSpec -> Ptr RefSpec -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr RefSpec
forall a. Ptr a
FP.nullPtr
then RefSpec -> Maybe RefSpec
forall a. a -> Maybe a
P.Just (RefSpec -> Maybe RefSpec) -> IO RefSpec -> IO (Maybe RefSpec)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr RefSpec -> RefSpec) -> Ptr RefSpec -> IO RefSpec
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr RefSpec -> RefSpec
RefSpec Ptr RefSpec
ptr
else Maybe RefSpec -> IO (Maybe RefSpec)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RefSpec
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RefSpec
type instance O.AttributeList RefSpec = RefSpecAttributeList
type RefSpecAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_ref_spec_get_destination" ggit_ref_spec_get_destination ::
Ptr RefSpec ->
IO CString
refSpecGetDestination ::
(B.CallStack.HasCallStack, MonadIO m) =>
RefSpec
-> m (Maybe T.Text)
refSpecGetDestination :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RefSpec -> m (Maybe Text)
refSpecGetDestination RefSpec
refspec = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr RefSpec
refspec' <- RefSpec -> IO (Ptr RefSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RefSpec
refspec
CString
result <- Ptr RefSpec -> IO CString
ggit_ref_spec_get_destination Ptr RefSpec
refspec'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
RefSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RefSpec
refspec
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data RefSpecGetDestinationMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod RefSpecGetDestinationMethodInfo RefSpec signature where
overloadedMethod = refSpecGetDestination
instance O.OverloadedMethodInfo RefSpecGetDestinationMethodInfo RefSpec where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Ggit.Structs.RefSpec.refSpecGetDestination",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ggit-1.0.10/docs/GI-Ggit-Structs-RefSpec.html#v:refSpecGetDestination"
}
#endif
foreign import ccall "ggit_ref_spec_get_source" ggit_ref_spec_get_source ::
Ptr RefSpec ->
IO CString
refSpecGetSource ::
(B.CallStack.HasCallStack, MonadIO m) =>
RefSpec
-> m (Maybe T.Text)
refSpecGetSource :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RefSpec -> m (Maybe Text)
refSpecGetSource RefSpec
refspec = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr RefSpec
refspec' <- RefSpec -> IO (Ptr RefSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RefSpec
refspec
CString
result <- Ptr RefSpec -> IO CString
ggit_ref_spec_get_source Ptr RefSpec
refspec'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
RefSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RefSpec
refspec
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data RefSpecGetSourceMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod RefSpecGetSourceMethodInfo RefSpec signature where
overloadedMethod = refSpecGetSource
instance O.OverloadedMethodInfo RefSpecGetSourceMethodInfo RefSpec where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Ggit.Structs.RefSpec.refSpecGetSource",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ggit-1.0.10/docs/GI-Ggit-Structs-RefSpec.html#v:refSpecGetSource"
}
#endif
foreign import ccall "ggit_ref_spec_is_forced" ggit_ref_spec_is_forced ::
Ptr RefSpec ->
IO CInt
refSpecIsForced ::
(B.CallStack.HasCallStack, MonadIO m) =>
RefSpec
-> m Bool
refSpecIsForced :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RefSpec -> m Bool
refSpecIsForced RefSpec
refspec = 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 RefSpec
refspec' <- RefSpec -> IO (Ptr RefSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RefSpec
refspec
CInt
result <- Ptr RefSpec -> IO CInt
ggit_ref_spec_is_forced Ptr RefSpec
refspec'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
RefSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RefSpec
refspec
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RefSpecIsForcedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod RefSpecIsForcedMethodInfo RefSpec signature where
overloadedMethod = refSpecIsForced
instance O.OverloadedMethodInfo RefSpecIsForcedMethodInfo RefSpec where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Ggit.Structs.RefSpec.refSpecIsForced",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ggit-1.0.10/docs/GI-Ggit-Structs-RefSpec.html#v:refSpecIsForced"
}
#endif
foreign import ccall "ggit_ref_spec_ref" ggit_ref_spec_ref ::
Ptr RefSpec ->
IO (Ptr RefSpec)
refSpecRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
RefSpec
-> m (Maybe RefSpec)
refSpecRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RefSpec -> m (Maybe RefSpec)
refSpecRef RefSpec
refspec = IO (Maybe RefSpec) -> m (Maybe RefSpec)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe RefSpec) -> m (Maybe RefSpec))
-> IO (Maybe RefSpec) -> m (Maybe RefSpec)
forall a b. (a -> b) -> a -> b
$ do
Ptr RefSpec
refspec' <- RefSpec -> IO (Ptr RefSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RefSpec
refspec
Ptr RefSpec
result <- Ptr RefSpec -> IO (Ptr RefSpec)
ggit_ref_spec_ref Ptr RefSpec
refspec'
Maybe RefSpec
maybeResult <- Ptr RefSpec -> (Ptr RefSpec -> IO RefSpec) -> IO (Maybe RefSpec)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr RefSpec
result ((Ptr RefSpec -> IO RefSpec) -> IO (Maybe RefSpec))
-> (Ptr RefSpec -> IO RefSpec) -> IO (Maybe RefSpec)
forall a b. (a -> b) -> a -> b
$ \Ptr RefSpec
result' -> do
RefSpec
result'' <- ((ManagedPtr RefSpec -> RefSpec) -> Ptr RefSpec -> IO RefSpec
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr RefSpec -> RefSpec
RefSpec) Ptr RefSpec
result'
RefSpec -> IO RefSpec
forall (m :: * -> *) a. Monad m => a -> m a
return RefSpec
result''
RefSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RefSpec
refspec
Maybe RefSpec -> IO (Maybe RefSpec)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe RefSpec
maybeResult
#if defined(ENABLE_OVERLOADING)
data RefSpecRefMethodInfo
instance (signature ~ (m (Maybe RefSpec)), MonadIO m) => O.OverloadedMethod RefSpecRefMethodInfo RefSpec signature where
overloadedMethod = refSpecRef
instance O.OverloadedMethodInfo RefSpecRefMethodInfo RefSpec where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Ggit.Structs.RefSpec.refSpecRef",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ggit-1.0.10/docs/GI-Ggit-Structs-RefSpec.html#v:refSpecRef"
}
#endif
foreign import ccall "ggit_ref_spec_unref" ggit_ref_spec_unref ::
Ptr RefSpec ->
IO ()
refSpecUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
RefSpec
-> m ()
refSpecUnref :: forall (m :: * -> *). (HasCallStack, MonadIO m) => RefSpec -> m ()
refSpecUnref RefSpec
refspec = 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 RefSpec
refspec' <- RefSpec -> IO (Ptr RefSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RefSpec
refspec
Ptr RefSpec -> IO ()
ggit_ref_spec_unref Ptr RefSpec
refspec'
RefSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RefSpec
refspec
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data RefSpecUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod RefSpecUnrefMethodInfo RefSpec signature where
overloadedMethod = refSpecUnref
instance O.OverloadedMethodInfo RefSpecUnrefMethodInfo RefSpec where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Ggit.Structs.RefSpec.refSpecUnref",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-ggit-1.0.10/docs/GI-Ggit-Structs-RefSpec.html#v:refSpecUnref"
}
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRefSpecMethod (t :: Symbol) (o :: *) :: * where
ResolveRefSpecMethod "isForced" o = RefSpecIsForcedMethodInfo
ResolveRefSpecMethod "ref" o = RefSpecRefMethodInfo
ResolveRefSpecMethod "unref" o = RefSpecUnrefMethodInfo
ResolveRefSpecMethod "getDestination" o = RefSpecGetDestinationMethodInfo
ResolveRefSpecMethod "getSource" o = RefSpecGetSourceMethodInfo
ResolveRefSpecMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRefSpecMethod t RefSpec, O.OverloadedMethod info RefSpec p) => OL.IsLabel t (RefSpec -> 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 ~ ResolveRefSpecMethod t RefSpec, O.OverloadedMethod info RefSpec p, R.HasField t RefSpec p) => R.HasField t RefSpec p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRefSpecMethod t RefSpec, O.OverloadedMethodInfo info RefSpec) => OL.IsLabel t (O.MethodProxy info RefSpec) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif