{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Represents the changes done to one file. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Ggit.Structs.DiffDelta ( -- * Exported types DiffDelta(..) , noDiffDelta , -- * Methods -- ** getFlags #method:getFlags# #if ENABLE_OVERLOADING DiffDeltaGetFlagsMethodInfo , #endif diffDeltaGetFlags , -- ** getNewFile #method:getNewFile# #if ENABLE_OVERLOADING DiffDeltaGetNewFileMethodInfo , #endif diffDeltaGetNewFile , -- ** getOldFile #method:getOldFile# #if ENABLE_OVERLOADING DiffDeltaGetOldFileMethodInfo , #endif diffDeltaGetOldFile , -- ** getSimilarity #method:getSimilarity# #if ENABLE_OVERLOADING DiffDeltaGetSimilarityMethodInfo , #endif diffDeltaGetSimilarity , -- ** getStatus #method:getStatus# #if ENABLE_OVERLOADING DiffDeltaGetStatusMethodInfo , #endif diffDeltaGetStatus , -- ** ref #method:ref# #if ENABLE_OVERLOADING DiffDeltaRefMethodInfo , #endif diffDeltaRef , -- ** unref #method:unref# #if ENABLE_OVERLOADING DiffDeltaUnrefMethodInfo , #endif diffDeltaUnref , ) 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 import {-# SOURCE #-} qualified GI.Ggit.Flags as Ggit.Flags import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffFile as Ggit.DiffFile -- | Memory-managed wrapper type. newtype DiffDelta = DiffDelta (ManagedPtr DiffDelta) foreign import ccall "ggit_diff_delta_get_type" c_ggit_diff_delta_get_type :: IO GType instance BoxedObject DiffDelta where boxedType _ = c_ggit_diff_delta_get_type -- | A convenience alias for `Nothing` :: `Maybe` `DiffDelta`. noDiffDelta :: Maybe DiffDelta noDiffDelta = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList DiffDelta type instance O.AttributeList DiffDelta = DiffDeltaAttributeList type DiffDeltaAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method DiffDelta::get_flags -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "DiffFlag"})) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_get_flags" ggit_diff_delta_get_flags :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO CUInt {- | Gets flags for /@delta@/. -} diffDeltaGetFlags :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m [Ggit.Flags.DiffFlag] {- ^ __Returns:__ the delta flags -} diffDeltaGetFlags delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_get_flags delta' let result' = wordToGFlags result touchManagedPtr delta return result' #if ENABLE_OVERLOADING data DiffDeltaGetFlagsMethodInfo instance (signature ~ (m [Ggit.Flags.DiffFlag]), MonadIO m) => O.MethodInfo DiffDeltaGetFlagsMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaGetFlags #endif -- method DiffDelta::get_new_file -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "DiffFile"})) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_get_new_file" ggit_diff_delta_get_new_file :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO (Ptr Ggit.DiffFile.DiffFile) {- | Gets the new file for /@delta@/. -} diffDeltaGetNewFile :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m (Maybe Ggit.DiffFile.DiffFile) {- ^ __Returns:__ the delta\'s new file or 'Nothing'. -} diffDeltaGetNewFile delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_get_new_file delta' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newBoxed Ggit.DiffFile.DiffFile) result' return result'' touchManagedPtr delta return maybeResult #if ENABLE_OVERLOADING data DiffDeltaGetNewFileMethodInfo instance (signature ~ (m (Maybe Ggit.DiffFile.DiffFile)), MonadIO m) => O.MethodInfo DiffDeltaGetNewFileMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaGetNewFile #endif -- method DiffDelta::get_old_file -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "DiffFile"})) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_get_old_file" ggit_diff_delta_get_old_file :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO (Ptr Ggit.DiffFile.DiffFile) {- | Gets the old file for /@delta@/. -} diffDeltaGetOldFile :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m (Maybe Ggit.DiffFile.DiffFile) {- ^ __Returns:__ the delta\'s old file or 'Nothing'. -} diffDeltaGetOldFile delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_get_old_file delta' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newBoxed Ggit.DiffFile.DiffFile) result' return result'' touchManagedPtr delta return maybeResult #if ENABLE_OVERLOADING data DiffDeltaGetOldFileMethodInfo instance (signature ~ (m (Maybe Ggit.DiffFile.DiffFile)), MonadIO m) => O.MethodInfo DiffDeltaGetOldFileMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaGetOldFile #endif -- method DiffDelta::get_similarity -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_get_similarity" ggit_diff_delta_get_similarity :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO Word32 {- | Gets the similarity between /@delta@/ files. -} diffDeltaGetSimilarity :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m Word32 {- ^ __Returns:__ the delta\'s similarity. -} diffDeltaGetSimilarity delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_get_similarity delta' touchManagedPtr delta return result #if ENABLE_OVERLOADING data DiffDeltaGetSimilarityMethodInfo instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DiffDeltaGetSimilarityMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaGetSimilarity #endif -- method DiffDelta::get_status -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "DeltaType"})) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_get_status" ggit_diff_delta_get_status :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO CUInt {- | Gets the 'GI.Ggit.Enums.DeltaType' for /@delta@/. -} diffDeltaGetStatus :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m Ggit.Enums.DeltaType {- ^ __Returns:__ the delta\'s status. -} diffDeltaGetStatus delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_get_status delta' let result' = (toEnum . fromIntegral) result touchManagedPtr delta return result' #if ENABLE_OVERLOADING data DiffDeltaGetStatusMethodInfo instance (signature ~ (m Ggit.Enums.DeltaType), MonadIO m) => O.MethodInfo DiffDeltaGetStatusMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaGetStatus #endif -- method DiffDelta::ref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "DiffDelta"})) -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_ref" ggit_diff_delta_ref :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO (Ptr DiffDelta) {- | Atomically increments the reference count of /@delta@/ by one. This function is MT-safe and may be called from any thread. -} diffDeltaRef :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m (Maybe DiffDelta) {- ^ __Returns:__ a 'GI.Ggit.Structs.DiffDelta.DiffDelta' or 'Nothing'. -} diffDeltaRef delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta result <- ggit_diff_delta_ref delta' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newBoxed DiffDelta) result' return result'' touchManagedPtr delta return maybeResult #if ENABLE_OVERLOADING data DiffDeltaRefMethodInfo instance (signature ~ (m (Maybe DiffDelta)), MonadIO m) => O.MethodInfo DiffDeltaRefMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaRef #endif -- method DiffDelta::unref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ggit_diff_delta_unref" ggit_diff_delta_unref :: Ptr DiffDelta -> -- delta : TInterface (Name {namespace = "Ggit", name = "DiffDelta"}) IO () {- | Atomically decrements the reference count of /@delta@/ by one. If the reference count drops to 0, /@delta@/ is freed. -} diffDeltaUnref :: (B.CallStack.HasCallStack, MonadIO m) => DiffDelta {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -} -> m () diffDeltaUnref delta = liftIO $ do delta' <- unsafeManagedPtrGetPtr delta ggit_diff_delta_unref delta' touchManagedPtr delta return () #if ENABLE_OVERLOADING data DiffDeltaUnrefMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DiffDeltaUnrefMethodInfo DiffDelta signature where overloadedMethod _ = diffDeltaUnref #endif #if ENABLE_OVERLOADING type family ResolveDiffDeltaMethod (t :: Symbol) (o :: *) :: * where ResolveDiffDeltaMethod "ref" o = DiffDeltaRefMethodInfo ResolveDiffDeltaMethod "unref" o = DiffDeltaUnrefMethodInfo ResolveDiffDeltaMethod "getFlags" o = DiffDeltaGetFlagsMethodInfo ResolveDiffDeltaMethod "getNewFile" o = DiffDeltaGetNewFileMethodInfo ResolveDiffDeltaMethod "getOldFile" o = DiffDeltaGetOldFileMethodInfo ResolveDiffDeltaMethod "getSimilarity" o = DiffDeltaGetSimilarityMethodInfo ResolveDiffDeltaMethod "getStatus" o = DiffDeltaGetStatusMethodInfo ResolveDiffDeltaMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveDiffDeltaMethod t DiffDelta, O.MethodInfo info DiffDelta p) => OL.IsLabel t (DiffDelta -> 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