module GI.Ggit.Structs.Reflog
(
Reflog(..) ,
noReflog ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogAppendMethodInfo ,
#endif
reflogAppend ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogGetEntryCountMethodInfo ,
#endif
reflogGetEntryCount ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogGetEntryFromIndexMethodInfo ,
#endif
reflogGetEntryFromIndex ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogRefMethodInfo ,
#endif
reflogRef ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogRenameMethodInfo ,
#endif
reflogRename ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogUnrefMethodInfo ,
#endif
reflogUnref ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
ReflogWriteMethodInfo ,
#endif
reflogWrite ,
) 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.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 qualified GI.Ggit.Objects.Signature as Ggit.Signature
import qualified GI.Ggit.Structs.OId as Ggit.OId
import qualified GI.Ggit.Structs.ReflogEntry as Ggit.ReflogEntry
newtype Reflog = Reflog (ManagedPtr Reflog)
foreign import ccall "ggit_reflog_get_type" c_ggit_reflog_get_type ::
IO GType
instance BoxedObject Reflog where
boxedType _ = c_ggit_reflog_get_type
noReflog :: Maybe Reflog
noReflog = Nothing
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Reflog
type instance O.AttributeList Reflog = ReflogAttributeList
type ReflogAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_reflog_append" ggit_reflog_append ::
Ptr Reflog ->
Ptr Ggit.OId.OId ->
Ptr Ggit.Signature.Signature ->
CString ->
Ptr (Ptr GError) ->
IO CInt
reflogAppend ::
(B.CallStack.HasCallStack, MonadIO m, Ggit.Signature.IsSignature a) =>
Reflog
-> Ggit.OId.OId
-> a
-> T.Text
-> m ()
reflogAppend reflog oid committer message = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
oid' <- unsafeManagedPtrGetPtr oid
committer' <- unsafeManagedPtrCastPtr committer
message' <- textToCString message
onException (do
_ <- propagateGError $ ggit_reflog_append reflog' oid' committer' message'
touchManagedPtr reflog
touchManagedPtr oid
touchManagedPtr committer
freeMem message'
return ()
) (do
freeMem message'
)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogAppendMethodInfo
instance (signature ~ (Ggit.OId.OId -> a -> T.Text -> m ()), MonadIO m, Ggit.Signature.IsSignature a) => O.MethodInfo ReflogAppendMethodInfo Reflog signature where
overloadedMethod _ = reflogAppend
#endif
foreign import ccall "ggit_reflog_get_entry_count" ggit_reflog_get_entry_count ::
Ptr Reflog ->
IO Word32
reflogGetEntryCount ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> m Word32
reflogGetEntryCount reflog = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
result <- ggit_reflog_get_entry_count reflog'
touchManagedPtr reflog
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogGetEntryCountMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo ReflogGetEntryCountMethodInfo Reflog signature where
overloadedMethod _ = reflogGetEntryCount
#endif
foreign import ccall "ggit_reflog_get_entry_from_index" ggit_reflog_get_entry_from_index ::
Ptr Reflog ->
Word32 ->
IO (Ptr Ggit.ReflogEntry.ReflogEntry)
reflogGetEntryFromIndex ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> Word32
-> m Ggit.ReflogEntry.ReflogEntry
reflogGetEntryFromIndex reflog idx = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
result <- ggit_reflog_get_entry_from_index reflog' idx
checkUnexpectedReturnNULL "reflogGetEntryFromIndex" result
result' <- (wrapBoxed Ggit.ReflogEntry.ReflogEntry) result
touchManagedPtr reflog
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogGetEntryFromIndexMethodInfo
instance (signature ~ (Word32 -> m Ggit.ReflogEntry.ReflogEntry), MonadIO m) => O.MethodInfo ReflogGetEntryFromIndexMethodInfo Reflog signature where
overloadedMethod _ = reflogGetEntryFromIndex
#endif
foreign import ccall "ggit_reflog_ref" ggit_reflog_ref ::
Ptr Reflog ->
IO (Ptr Reflog)
reflogRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> m Reflog
reflogRef reflog = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
result <- ggit_reflog_ref reflog'
checkUnexpectedReturnNULL "reflogRef" result
result' <- (newBoxed Reflog) result
touchManagedPtr reflog
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogRefMethodInfo
instance (signature ~ (m Reflog), MonadIO m) => O.MethodInfo ReflogRefMethodInfo Reflog signature where
overloadedMethod _ = reflogRef
#endif
foreign import ccall "ggit_reflog_rename" ggit_reflog_rename ::
Ptr Reflog ->
CString ->
Ptr (Ptr GError) ->
IO CInt
reflogRename ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> T.Text
-> m ()
reflogRename reflog newName = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
newName' <- textToCString newName
onException (do
_ <- propagateGError $ ggit_reflog_rename reflog' newName'
touchManagedPtr reflog
freeMem newName'
return ()
) (do
freeMem newName'
)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogRenameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo ReflogRenameMethodInfo Reflog signature where
overloadedMethod _ = reflogRename
#endif
foreign import ccall "ggit_reflog_unref" ggit_reflog_unref ::
Ptr Reflog ->
IO ()
reflogUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> m ()
reflogUnref reflog = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
ggit_reflog_unref reflog'
touchManagedPtr reflog
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo ReflogUnrefMethodInfo Reflog signature where
overloadedMethod _ = reflogUnref
#endif
foreign import ccall "ggit_reflog_write" ggit_reflog_write ::
Ptr Reflog ->
Ptr (Ptr GError) ->
IO CInt
reflogWrite ::
(B.CallStack.HasCallStack, MonadIO m) =>
Reflog
-> m ()
reflogWrite reflog = liftIO $ do
reflog' <- unsafeManagedPtrGetPtr reflog
onException (do
_ <- propagateGError $ ggit_reflog_write reflog'
touchManagedPtr reflog
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogWriteMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo ReflogWriteMethodInfo Reflog signature where
overloadedMethod _ = reflogWrite
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveReflogMethod (t :: Symbol) (o :: *) :: * where
ResolveReflogMethod "append" o = ReflogAppendMethodInfo
ResolveReflogMethod "ref" o = ReflogRefMethodInfo
ResolveReflogMethod "rename" o = ReflogRenameMethodInfo
ResolveReflogMethod "unref" o = ReflogUnrefMethodInfo
ResolveReflogMethod "write" o = ReflogWriteMethodInfo
ResolveReflogMethod "getEntryCount" o = ReflogGetEntryCountMethodInfo
ResolveReflogMethod "getEntryFromIndex" o = ReflogGetEntryFromIndexMethodInfo
ResolveReflogMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveReflogMethod t Reflog, O.MethodInfo info Reflog p) => O.IsLabelProxy t (Reflog -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveReflogMethod t Reflog, O.MethodInfo info Reflog p) => O.IsLabel t (Reflog -> 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