{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Ggit.Structs.DiffLine
(
DiffLine(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveDiffLineMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DiffLineGetContentMethodInfo ,
#endif
diffLineGetContent ,
#if defined(ENABLE_OVERLOADING)
DiffLineGetContentOffsetMethodInfo ,
#endif
diffLineGetContentOffset ,
#if defined(ENABLE_OVERLOADING)
DiffLineGetNewLinenoMethodInfo ,
#endif
diffLineGetNewLineno ,
#if defined(ENABLE_OVERLOADING)
DiffLineGetOldLinenoMethodInfo ,
#endif
diffLineGetOldLineno ,
#if defined(ENABLE_OVERLOADING)
DiffLineGetOriginMethodInfo ,
#endif
diffLineGetOrigin ,
#if defined(ENABLE_OVERLOADING)
DiffLineGetTextMethodInfo ,
#endif
diffLineGetText ,
#if defined(ENABLE_OVERLOADING)
DiffLineRefMethodInfo ,
#endif
diffLineRef ,
#if defined(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.BasicTypes as B.Types
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.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 {-# SOURCE #-} qualified GI.Ggit.Enums as Ggit.Enums
newtype DiffLine = DiffLine (SP.ManagedPtr DiffLine)
deriving (DiffLine -> DiffLine -> Bool
(DiffLine -> DiffLine -> Bool)
-> (DiffLine -> DiffLine -> Bool) -> Eq DiffLine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiffLine -> DiffLine -> Bool
$c/= :: DiffLine -> DiffLine -> Bool
== :: DiffLine -> DiffLine -> Bool
$c== :: DiffLine -> DiffLine -> Bool
Eq)
instance SP.ManagedPtrNewtype DiffLine where
toManagedPtr :: DiffLine -> ManagedPtr DiffLine
toManagedPtr (DiffLine ManagedPtr DiffLine
p) = ManagedPtr DiffLine
p
foreign import ccall "ggit_diff_line_get_type" c_ggit_diff_line_get_type ::
IO GType
type instance O.ParentTypes DiffLine = '[]
instance O.HasParentTypes DiffLine
instance B.Types.TypedObject DiffLine where
glibType :: IO GType
glibType = IO GType
c_ggit_diff_line_get_type
instance B.Types.GBoxed DiffLine
instance B.GValue.IsGValue DiffLine where
toGValue :: DiffLine -> IO GValue
toGValue DiffLine
o = do
GType
gtype <- IO GType
c_ggit_diff_line_get_type
DiffLine -> (Ptr DiffLine -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DiffLine
o (GType
-> (GValue -> Ptr DiffLine -> IO ()) -> Ptr DiffLine -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr DiffLine -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO DiffLine
fromGValue GValue
gv = do
Ptr DiffLine
ptr <- GValue -> IO (Ptr DiffLine)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr DiffLine)
(ManagedPtr DiffLine -> DiffLine) -> Ptr DiffLine -> IO DiffLine
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr DiffLine -> DiffLine
DiffLine Ptr DiffLine
ptr
#if defined(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 :: DiffLine -> m ByteString
diffLineGetContent DiffLine
line = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
Ptr Word8
result <- Ptr DiffLine -> Ptr Word64 -> IO (Ptr Word8)
ggit_diff_line_get_content Ptr DiffLine
line' Ptr Word64
length_
Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"diffLineGetContent" Ptr Word8
result
ByteString
result' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
length_') Ptr Word8
result
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'
#if defined(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 :: DiffLine -> m Int64
diffLineGetContentOffset DiffLine
line = IO Int64 -> m Int64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Int64
result <- Ptr DiffLine -> IO Int64
ggit_diff_line_get_content_offset Ptr DiffLine
line'
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
#if defined(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 :: DiffLine -> m Int32
diffLineGetNewLineno DiffLine
line = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Int32
result <- Ptr DiffLine -> IO Int32
ggit_diff_line_get_new_lineno Ptr DiffLine
line'
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(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 :: DiffLine -> m Int32
diffLineGetOldLineno DiffLine
line = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Int32
result <- Ptr DiffLine -> IO Int32
ggit_diff_line_get_old_lineno Ptr DiffLine
line'
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(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 :: DiffLine -> m DiffLineType
diffLineGetOrigin DiffLine
line = IO DiffLineType -> m DiffLineType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DiffLineType -> m DiffLineType)
-> IO DiffLineType -> m DiffLineType
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
CUInt
result <- Ptr DiffLine -> IO CUInt
ggit_diff_line_get_origin Ptr DiffLine
line'
let result' :: DiffLineType
result' = (Int -> DiffLineType
forall a. Enum a => Int -> a
toEnum (Int -> DiffLineType) -> (CUInt -> Int) -> CUInt -> DiffLineType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
DiffLineType -> IO DiffLineType
forall (m :: * -> *) a. Monad m => a -> m a
return DiffLineType
result'
#if defined(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 :: DiffLine -> m (Maybe Text)
diffLineGetText DiffLine
line = 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 DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
CString
result <- Ptr DiffLine -> IO CString
ggit_diff_line_get_text Ptr DiffLine
line'
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''
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(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 :: DiffLine -> m (Maybe DiffLine)
diffLineRef DiffLine
line = IO (Maybe DiffLine) -> m (Maybe DiffLine)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DiffLine) -> m (Maybe DiffLine))
-> IO (Maybe DiffLine) -> m (Maybe DiffLine)
forall a b. (a -> b) -> a -> b
$ do
Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Ptr DiffLine
result <- Ptr DiffLine -> IO (Ptr DiffLine)
ggit_diff_line_ref Ptr DiffLine
line'
Maybe DiffLine
maybeResult <- Ptr DiffLine
-> (Ptr DiffLine -> IO DiffLine) -> IO (Maybe DiffLine)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DiffLine
result ((Ptr DiffLine -> IO DiffLine) -> IO (Maybe DiffLine))
-> (Ptr DiffLine -> IO DiffLine) -> IO (Maybe DiffLine)
forall a b. (a -> b) -> a -> b
$ \Ptr DiffLine
result' -> do
DiffLine
result'' <- ((ManagedPtr DiffLine -> DiffLine) -> Ptr DiffLine -> IO DiffLine
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr DiffLine -> DiffLine
DiffLine) Ptr DiffLine
result'
DiffLine -> IO DiffLine
forall (m :: * -> *) a. Monad m => a -> m a
return DiffLine
result''
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
Maybe DiffLine -> IO (Maybe DiffLine)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DiffLine
maybeResult
#if defined(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 :: DiffLine -> m ()
diffLineUnref DiffLine
line = 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 DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
Ptr DiffLine -> IO ()
ggit_diff_line_unref Ptr DiffLine
line'
DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data DiffLineUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DiffLineUnrefMethodInfo DiffLine signature where
overloadedMethod = diffLineUnref
#endif
#if defined(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 @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif