#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Structs.DiffHunk
(
DiffHunk(..) ,
noDiffHunk ,
#if ENABLE_OVERLOADING
DiffHunkGetHeaderMethodInfo ,
#endif
diffHunkGetHeader ,
#if ENABLE_OVERLOADING
DiffHunkGetNewLinesMethodInfo ,
#endif
diffHunkGetNewLines ,
#if ENABLE_OVERLOADING
DiffHunkGetNewStartMethodInfo ,
#endif
diffHunkGetNewStart ,
#if ENABLE_OVERLOADING
DiffHunkGetOldLinesMethodInfo ,
#endif
diffHunkGetOldLines ,
#if ENABLE_OVERLOADING
DiffHunkGetOldStartMethodInfo ,
#endif
diffHunkGetOldStart ,
#if ENABLE_OVERLOADING
DiffHunkRefMethodInfo ,
#endif
diffHunkRef ,
#if ENABLE_OVERLOADING
DiffHunkUnrefMethodInfo ,
#endif
diffHunkUnref ,
) 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.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.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
newtype DiffHunk = DiffHunk (ManagedPtr DiffHunk)
foreign import ccall "ggit_diff_hunk_get_type" c_ggit_diff_hunk_get_type ::
IO GType
instance BoxedObject DiffHunk where
boxedType _ = c_ggit_diff_hunk_get_type
noDiffHunk :: Maybe DiffHunk
noDiffHunk = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList DiffHunk
type instance O.AttributeList DiffHunk = DiffHunkAttributeList
type DiffHunkAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_diff_hunk_get_header" ggit_diff_hunk_get_header ::
Ptr DiffHunk ->
IO CString
diffHunkGetHeader ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m T.Text
diffHunkGetHeader hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_get_header hunk'
checkUnexpectedReturnNULL "diffHunkGetHeader" result
result' <- cstringToText result
touchManagedPtr hunk
return result'
#if ENABLE_OVERLOADING
data DiffHunkGetHeaderMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo DiffHunkGetHeaderMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkGetHeader
#endif
foreign import ccall "ggit_diff_hunk_get_new_lines" ggit_diff_hunk_get_new_lines ::
Ptr DiffHunk ->
IO Int32
diffHunkGetNewLines ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m Int32
diffHunkGetNewLines hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_get_new_lines hunk'
touchManagedPtr hunk
return result
#if ENABLE_OVERLOADING
data DiffHunkGetNewLinesMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffHunkGetNewLinesMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkGetNewLines
#endif
foreign import ccall "ggit_diff_hunk_get_new_start" ggit_diff_hunk_get_new_start ::
Ptr DiffHunk ->
IO Int32
diffHunkGetNewStart ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m Int32
diffHunkGetNewStart hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_get_new_start hunk'
touchManagedPtr hunk
return result
#if ENABLE_OVERLOADING
data DiffHunkGetNewStartMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffHunkGetNewStartMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkGetNewStart
#endif
foreign import ccall "ggit_diff_hunk_get_old_lines" ggit_diff_hunk_get_old_lines ::
Ptr DiffHunk ->
IO Int32
diffHunkGetOldLines ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m Int32
diffHunkGetOldLines hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_get_old_lines hunk'
touchManagedPtr hunk
return result
#if ENABLE_OVERLOADING
data DiffHunkGetOldLinesMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffHunkGetOldLinesMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkGetOldLines
#endif
foreign import ccall "ggit_diff_hunk_get_old_start" ggit_diff_hunk_get_old_start ::
Ptr DiffHunk ->
IO Int32
diffHunkGetOldStart ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m Int32
diffHunkGetOldStart hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_get_old_start hunk'
touchManagedPtr hunk
return result
#if ENABLE_OVERLOADING
data DiffHunkGetOldStartMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffHunkGetOldStartMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkGetOldStart
#endif
foreign import ccall "ggit_diff_hunk_ref" ggit_diff_hunk_ref ::
Ptr DiffHunk ->
IO (Ptr DiffHunk)
diffHunkRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m (Maybe DiffHunk)
diffHunkRef hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
result <- ggit_diff_hunk_ref hunk'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed DiffHunk) result'
return result''
touchManagedPtr hunk
return maybeResult
#if ENABLE_OVERLOADING
data DiffHunkRefMethodInfo
instance (signature ~ (m (Maybe DiffHunk)), MonadIO m) => O.MethodInfo DiffHunkRefMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkRef
#endif
foreign import ccall "ggit_diff_hunk_unref" ggit_diff_hunk_unref ::
Ptr DiffHunk ->
IO ()
diffHunkUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffHunk
-> m ()
diffHunkUnref hunk = liftIO $ do
hunk' <- unsafeManagedPtrGetPtr hunk
ggit_diff_hunk_unref hunk'
touchManagedPtr hunk
return ()
#if ENABLE_OVERLOADING
data DiffHunkUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DiffHunkUnrefMethodInfo DiffHunk signature where
overloadedMethod _ = diffHunkUnref
#endif
#if ENABLE_OVERLOADING
type family ResolveDiffHunkMethod (t :: Symbol) (o :: *) :: * where
ResolveDiffHunkMethod "ref" o = DiffHunkRefMethodInfo
ResolveDiffHunkMethod "unref" o = DiffHunkUnrefMethodInfo
ResolveDiffHunkMethod "getHeader" o = DiffHunkGetHeaderMethodInfo
ResolveDiffHunkMethod "getNewLines" o = DiffHunkGetNewLinesMethodInfo
ResolveDiffHunkMethod "getNewStart" o = DiffHunkGetNewStartMethodInfo
ResolveDiffHunkMethod "getOldLines" o = DiffHunkGetOldLinesMethodInfo
ResolveDiffHunkMethod "getOldStart" o = DiffHunkGetOldStartMethodInfo
ResolveDiffHunkMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDiffHunkMethod t DiffHunk, O.MethodInfo info DiffHunk p) => OL.IsLabel t (DiffHunk -> 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