#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Structs.DiffLine
(
DiffLine(..) ,
noDiffLine ,
#if ENABLE_OVERLOADING
DiffLineGetContentMethodInfo ,
#endif
diffLineGetContent ,
#if ENABLE_OVERLOADING
DiffLineGetContentOffsetMethodInfo ,
#endif
diffLineGetContentOffset ,
#if ENABLE_OVERLOADING
DiffLineGetNewLinenoMethodInfo ,
#endif
diffLineGetNewLineno ,
#if ENABLE_OVERLOADING
DiffLineGetOldLinenoMethodInfo ,
#endif
diffLineGetOldLineno ,
#if ENABLE_OVERLOADING
DiffLineGetOriginMethodInfo ,
#endif
diffLineGetOrigin ,
#if ENABLE_OVERLOADING
DiffLineGetTextMethodInfo ,
#endif
diffLineGetText ,
#if ENABLE_OVERLOADING
DiffLineRefMethodInfo ,
#endif
diffLineRef ,
#if ENABLE_OVERLOADING
DiffLineUnrefMethodInfo ,
#endif
diffLineUnref ,
) 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
import {-# SOURCE #-} qualified GI.Ggit.Enums as Ggit.Enums
newtype DiffLine = DiffLine (ManagedPtr DiffLine)
foreign import ccall "ggit_diff_line_get_type" c_ggit_diff_line_get_type ::
IO GType
instance BoxedObject DiffLine where
boxedType _ = c_ggit_diff_line_get_type
noDiffLine :: Maybe DiffLine
noDiffLine = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList DiffLine
type instance O.AttributeList DiffLine = DiffLineAttributeList
type DiffLineAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_diff_line_get_content" ggit_diff_line_get_content ::
Ptr DiffLine ->
Ptr Word64 ->
IO (Ptr Word8)
diffLineGetContent ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m ByteString
diffLineGetContent line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
length_ <- allocMem :: IO (Ptr Word64)
result <- ggit_diff_line_get_content line' length_
length_' <- peek length_
checkUnexpectedReturnNULL "diffLineGetContent" result
result' <- (unpackByteStringWithLength length_') result
touchManagedPtr line
freeMem length_
return result'
#if ENABLE_OVERLOADING
data DiffLineGetContentMethodInfo
instance (signature ~ (m ByteString), MonadIO m) => O.MethodInfo DiffLineGetContentMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetContent
#endif
foreign import ccall "ggit_diff_line_get_content_offset" ggit_diff_line_get_content_offset ::
Ptr DiffLine ->
IO Int64
diffLineGetContentOffset ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m Int64
diffLineGetContentOffset line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_get_content_offset line'
touchManagedPtr line
return result
#if ENABLE_OVERLOADING
data DiffLineGetContentOffsetMethodInfo
instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo DiffLineGetContentOffsetMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetContentOffset
#endif
foreign import ccall "ggit_diff_line_get_new_lineno" ggit_diff_line_get_new_lineno ::
Ptr DiffLine ->
IO Int32
diffLineGetNewLineno ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m Int32
diffLineGetNewLineno line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_get_new_lineno line'
touchManagedPtr line
return result
#if ENABLE_OVERLOADING
data DiffLineGetNewLinenoMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffLineGetNewLinenoMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetNewLineno
#endif
foreign import ccall "ggit_diff_line_get_old_lineno" ggit_diff_line_get_old_lineno ::
Ptr DiffLine ->
IO Int32
diffLineGetOldLineno ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m Int32
diffLineGetOldLineno line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_get_old_lineno line'
touchManagedPtr line
return result
#if ENABLE_OVERLOADING
data DiffLineGetOldLinenoMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo DiffLineGetOldLinenoMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetOldLineno
#endif
foreign import ccall "ggit_diff_line_get_origin" ggit_diff_line_get_origin ::
Ptr DiffLine ->
IO CUInt
diffLineGetOrigin ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m Ggit.Enums.DiffLineType
diffLineGetOrigin line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_get_origin line'
let result' = (toEnum . fromIntegral) result
touchManagedPtr line
return result'
#if ENABLE_OVERLOADING
data DiffLineGetOriginMethodInfo
instance (signature ~ (m Ggit.Enums.DiffLineType), MonadIO m) => O.MethodInfo DiffLineGetOriginMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetOrigin
#endif
foreign import ccall "ggit_diff_line_get_text" ggit_diff_line_get_text ::
Ptr DiffLine ->
IO CString
diffLineGetText ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m (Maybe T.Text)
diffLineGetText line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_get_text line'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr line
return maybeResult
#if ENABLE_OVERLOADING
data DiffLineGetTextMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo DiffLineGetTextMethodInfo DiffLine signature where
overloadedMethod _ = diffLineGetText
#endif
foreign import ccall "ggit_diff_line_ref" ggit_diff_line_ref ::
Ptr DiffLine ->
IO (Ptr DiffLine)
diffLineRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m (Maybe DiffLine)
diffLineRef line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
result <- ggit_diff_line_ref line'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed DiffLine) result'
return result''
touchManagedPtr line
return maybeResult
#if ENABLE_OVERLOADING
data DiffLineRefMethodInfo
instance (signature ~ (m (Maybe DiffLine)), MonadIO m) => O.MethodInfo DiffLineRefMethodInfo DiffLine signature where
overloadedMethod _ = diffLineRef
#endif
foreign import ccall "ggit_diff_line_unref" ggit_diff_line_unref ::
Ptr DiffLine ->
IO ()
diffLineUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
DiffLine
-> m ()
diffLineUnref line = liftIO $ do
line' <- unsafeManagedPtrGetPtr line
ggit_diff_line_unref line'
touchManagedPtr line
return ()
#if ENABLE_OVERLOADING
data DiffLineUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DiffLineUnrefMethodInfo DiffLine signature where
overloadedMethod _ = diffLineUnref
#endif
#if ENABLE_OVERLOADING
type family ResolveDiffLineMethod (t :: Symbol) (o :: *) :: * where
ResolveDiffLineMethod "ref" o = DiffLineRefMethodInfo
ResolveDiffLineMethod "unref" o = DiffLineUnrefMethodInfo
ResolveDiffLineMethod "getContent" o = DiffLineGetContentMethodInfo
ResolveDiffLineMethod "getContentOffset" o = DiffLineGetContentOffsetMethodInfo
ResolveDiffLineMethod "getNewLineno" o = DiffLineGetNewLinenoMethodInfo
ResolveDiffLineMethod "getOldLineno" o = DiffLineGetOldLinenoMethodInfo
ResolveDiffLineMethod "getOrigin" o = DiffLineGetOriginMethodInfo
ResolveDiffLineMethod "getText" o = DiffLineGetTextMethodInfo
ResolveDiffLineMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDiffLineMethod t DiffLine, O.MethodInfo info DiffLine p) => OL.IsLabel t (DiffLine -> 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