gi-ggit-1.0.4: GI/Ggit/Objects/Index.hs
{- |
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 an index object.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Objects.Index
(
-- * Exported types
Index(..) ,
IsIndex ,
toIndex ,
noIndex ,
-- * Methods
-- ** add #method:add#
#if ENABLE_OVERLOADING
IndexAddMethodInfo ,
#endif
indexAdd ,
-- ** addFile #method:addFile#
#if ENABLE_OVERLOADING
IndexAddFileMethodInfo ,
#endif
indexAddFile ,
-- ** addPath #method:addPath#
#if ENABLE_OVERLOADING
IndexAddPathMethodInfo ,
#endif
indexAddPath ,
-- ** getEntries #method:getEntries#
#if ENABLE_OVERLOADING
IndexGetEntriesMethodInfo ,
#endif
indexGetEntries ,
-- ** getEntriesResolveUndo #method:getEntriesResolveUndo#
#if ENABLE_OVERLOADING
IndexGetEntriesResolveUndoMethodInfo ,
#endif
indexGetEntriesResolveUndo ,
-- ** getOwner #method:getOwner#
#if ENABLE_OVERLOADING
IndexGetOwnerMethodInfo ,
#endif
indexGetOwner ,
-- ** hasConflicts #method:hasConflicts#
#if ENABLE_OVERLOADING
IndexHasConflictsMethodInfo ,
#endif
indexHasConflicts ,
-- ** open #method:open#
indexOpen ,
-- ** read #method:read#
#if ENABLE_OVERLOADING
IndexReadMethodInfo ,
#endif
indexRead ,
-- ** remove #method:remove#
#if ENABLE_OVERLOADING
IndexRemoveMethodInfo ,
#endif
indexRemove ,
-- ** write #method:write#
#if ENABLE_OVERLOADING
IndexWriteMethodInfo ,
#endif
indexWrite ,
-- ** writeTree #method:writeTree#
#if ENABLE_OVERLOADING
IndexWriteTreeMethodInfo ,
#endif
indexWriteTree ,
-- ** writeTreeTo #method:writeTreeTo#
#if ENABLE_OVERLOADING
IndexWriteTreeToMethodInfo ,
#endif
indexWriteTreeTo ,
-- * Properties
-- ** file #attr:file#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
IndexFilePropertyInfo ,
#endif
constructIndexFile ,
getIndexFile ,
#if ENABLE_OVERLOADING
indexFile ,
#endif
) 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 qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Ggit.Objects.Native as Ggit.Native
import {-# SOURCE #-} qualified GI.Ggit.Objects.ObjectFactoryBase as Ggit.ObjectFactoryBase
import {-# SOURCE #-} qualified GI.Ggit.Objects.Repository as Ggit.Repository
import {-# SOURCE #-} qualified GI.Ggit.Structs.IndexEntries as Ggit.IndexEntries
import {-# SOURCE #-} qualified GI.Ggit.Structs.IndexEntriesResolveUndo as Ggit.IndexEntriesResolveUndo
import {-# SOURCE #-} qualified GI.Ggit.Structs.IndexEntry as Ggit.IndexEntry
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
-- | Memory-managed wrapper type.
newtype Index = Index (ManagedPtr Index)
foreign import ccall "ggit_index_get_type"
c_ggit_index_get_type :: IO GType
instance GObject Index where
gobjectType = c_ggit_index_get_type
-- | Type class for types which can be safely cast to `Index`, for instance with `toIndex`.
class (GObject o, O.IsDescendantOf Index o) => IsIndex o
instance (GObject o, O.IsDescendantOf Index o) => IsIndex o
instance O.HasParentTypes Index
type instance O.ParentTypes Index = '[Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object, Gio.Initable.Initable]
-- | Cast to `Index`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toIndex :: (MonadIO m, IsIndex o) => o -> m Index
toIndex = liftIO . unsafeCastTo Index
-- | A convenience alias for `Nothing` :: `Maybe` `Index`.
noIndex :: Maybe Index
noIndex = Nothing
#if ENABLE_OVERLOADING
type family ResolveIndexMethod (t :: Symbol) (o :: *) :: * where
ResolveIndexMethod "add" o = IndexAddMethodInfo
ResolveIndexMethod "addFile" o = IndexAddFileMethodInfo
ResolveIndexMethod "addPath" o = IndexAddPathMethodInfo
ResolveIndexMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveIndexMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveIndexMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveIndexMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveIndexMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveIndexMethod "hasConflicts" o = IndexHasConflictsMethodInfo
ResolveIndexMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolveIndexMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveIndexMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveIndexMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveIndexMethod "read" o = IndexReadMethodInfo
ResolveIndexMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveIndexMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveIndexMethod "remove" o = IndexRemoveMethodInfo
ResolveIndexMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveIndexMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveIndexMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveIndexMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveIndexMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveIndexMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveIndexMethod "write" o = IndexWriteMethodInfo
ResolveIndexMethod "writeTree" o = IndexWriteTreeMethodInfo
ResolveIndexMethod "writeTreeTo" o = IndexWriteTreeToMethodInfo
ResolveIndexMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveIndexMethod "getEntries" o = IndexGetEntriesMethodInfo
ResolveIndexMethod "getEntriesResolveUndo" o = IndexGetEntriesResolveUndoMethodInfo
ResolveIndexMethod "getOwner" o = IndexGetOwnerMethodInfo
ResolveIndexMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveIndexMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveIndexMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveIndexMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveIndexMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveIndexMethod t Index, O.MethodInfo info Index p) => OL.IsLabel t (Index -> 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
-- VVV Prop "file"
-- Type: TInterface (Name {namespace = "Gio", name = "File"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' index #file
@
-}
getIndexFile :: (MonadIO m, IsIndex o) => o -> m (Maybe Gio.File.File)
getIndexFile obj = liftIO $ B.Properties.getObjectPropertyObject obj "file" Gio.File.File
{- |
Construct a `GValueConstruct` with valid value for the “@file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructIndexFile :: (IsIndex o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructIndexFile val = B.Properties.constructObjectPropertyObject "file" (Just val)
#if ENABLE_OVERLOADING
data IndexFilePropertyInfo
instance AttrInfo IndexFilePropertyInfo where
type AttrAllowedOps IndexFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint IndexFilePropertyInfo = Gio.File.IsFile
type AttrBaseTypeConstraint IndexFilePropertyInfo = IsIndex
type AttrGetType IndexFilePropertyInfo = (Maybe Gio.File.File)
type AttrLabel IndexFilePropertyInfo = "file"
type AttrOrigin IndexFilePropertyInfo = Index
attrGet _ = getIndexFile
attrSet _ = undefined
attrConstruct _ = constructIndexFile
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Index
type instance O.AttributeList Index = IndexAttributeList
type IndexAttributeList = ('[ '("file", IndexFilePropertyInfo), '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
indexFile :: AttrLabelProxy "file"
indexFile = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Index = IndexSignalList
type IndexSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method Index::add
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "IndexEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndexEntry.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_add" ggit_index_add ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr Ggit.IndexEntry.IndexEntry -> -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntry"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Add a file to the index.
-}
indexAdd ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> Ggit.IndexEntry.IndexEntry
{- ^ /@entry@/: a 'GI.Ggit.Structs.IndexEntry.IndexEntry'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexAdd idx entry = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
entry' <- unsafeManagedPtrGetPtr entry
onException (do
_ <- propagateGError $ ggit_index_add idx' entry'
touchManagedPtr idx
touchManagedPtr entry
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexAddMethodInfo
instance (signature ~ (Ggit.IndexEntry.IndexEntry -> m ()), MonadIO m, IsIndex a) => O.MethodInfo IndexAddMethodInfo a signature where
overloadedMethod _ = indexAdd
#endif
-- method Index::add_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "file to add.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_add_file" ggit_index_add_file ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr Gio.File.File -> -- file : TInterface (Name {namespace = "Gio", name = "File"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Add a file to the index. The specified file must be in the working directory
and must exist and be readable.
-}
indexAddFile ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a, Gio.File.IsFile b) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> b
{- ^ /@file@/: file to add. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexAddFile idx file = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
file' <- unsafeManagedPtrCastPtr file
onException (do
_ <- propagateGError $ ggit_index_add_file idx' file'
touchManagedPtr idx
touchManagedPtr file
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexAddFileMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsIndex a, Gio.File.IsFile b) => O.MethodInfo IndexAddFileMethodInfo a signature where
overloadedMethod _ = indexAddFile
#endif
-- method Index::add_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "path to the file to add.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_add_path" ggit_index_add_path ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
CString -> -- path : TBasicType TUTF8
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Add a file to the index by path. You can specify both relative paths
(to the working directory) and absolute paths. Absolute paths however must
reside in the working directory. The specified path must exist and must be
readable.
-}
indexAddPath ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> T.Text
{- ^ /@path@/: path to the file to add. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexAddPath idx path = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
path' <- textToCString path
onException (do
_ <- propagateGError $ ggit_index_add_path idx' path'
touchManagedPtr idx
freeMem path'
return ()
) (do
freeMem path'
)
#if ENABLE_OVERLOADING
data IndexAddPathMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsIndex a) => O.MethodInfo IndexAddPathMethodInfo a signature where
overloadedMethod _ = indexAddPath
#endif
-- method Index::get_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "IndexEntries"}))
-- throws : False
-- Skip return : False
foreign import ccall "ggit_index_get_entries" ggit_index_get_entries ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
IO (Ptr Ggit.IndexEntries.IndexEntries)
{- |
Get the index entries enumerator.
-}
indexGetEntries ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m (Maybe Ggit.IndexEntries.IndexEntries)
{- ^ __Returns:__ a 'GI.Ggit.Structs.IndexEntries.IndexEntries' or 'Nothing'. -}
indexGetEntries idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
result <- ggit_index_get_entries idx'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Ggit.IndexEntries.IndexEntries) result'
return result''
touchManagedPtr idx
return maybeResult
#if ENABLE_OVERLOADING
data IndexGetEntriesMethodInfo
instance (signature ~ (m (Maybe Ggit.IndexEntries.IndexEntries)), MonadIO m, IsIndex a) => O.MethodInfo IndexGetEntriesMethodInfo a signature where
overloadedMethod _ = indexGetEntries
#endif
-- method Index::get_entries_resolve_undo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "IndexEntriesResolveUndo"}))
-- throws : False
-- Skip return : False
foreign import ccall "ggit_index_get_entries_resolve_undo" ggit_index_get_entries_resolve_undo ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
IO (Ptr Ggit.IndexEntriesResolveUndo.IndexEntriesResolveUndo)
{- |
Get the resolve undo entries enumerator.
-}
indexGetEntriesResolveUndo ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m (Maybe Ggit.IndexEntriesResolveUndo.IndexEntriesResolveUndo)
{- ^ __Returns:__ a 'GI.Ggit.Structs.IndexEntriesResolveUndo.IndexEntriesResolveUndo' or 'Nothing'. -}
indexGetEntriesResolveUndo idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
result <- ggit_index_get_entries_resolve_undo idx'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Ggit.IndexEntriesResolveUndo.IndexEntriesResolveUndo) result'
return result''
touchManagedPtr idx
return maybeResult
#if ENABLE_OVERLOADING
data IndexGetEntriesResolveUndoMethodInfo
instance (signature ~ (m (Maybe Ggit.IndexEntriesResolveUndo.IndexEntriesResolveUndo)), MonadIO m, IsIndex a) => O.MethodInfo IndexGetEntriesResolveUndoMethodInfo a signature where
overloadedMethod _ = indexGetEntriesResolveUndo
#endif
-- method Index::get_owner
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Repository"}))
-- throws : False
-- Skip return : False
foreign import ccall "ggit_index_get_owner" ggit_index_get_owner ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
IO (Ptr Ggit.Repository.Repository)
{- |
Get the 'GI.Ggit.Objects.Repository.Repository' that owns the index.
-}
indexGetOwner ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m (Maybe Ggit.Repository.Repository)
{- ^ __Returns:__ the 'GI.Ggit.Objects.Repository.Repository' that owns this index or 'Nothing'. -}
indexGetOwner idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
result <- ggit_index_get_owner idx'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Ggit.Repository.Repository) result'
return result''
touchManagedPtr idx
return maybeResult
#if ENABLE_OVERLOADING
data IndexGetOwnerMethodInfo
instance (signature ~ (m (Maybe Ggit.Repository.Repository)), MonadIO m, IsIndex a) => O.MethodInfo IndexGetOwnerMethodInfo a signature where
overloadedMethod _ = indexGetOwner
#endif
-- method Index::has_conflicts
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "ggit_index_has_conflicts" ggit_index_has_conflicts ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
IO CInt
{- |
Get whether the index has any conflicts.
-}
indexHasConflicts ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m Bool
{- ^ __Returns:__ 'True' if the index has any conflicts, 'False' otherwise. -}
indexHasConflicts idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
result <- ggit_index_has_conflicts idx'
let result' = (/= 0) result
touchManagedPtr idx
return result'
#if ENABLE_OVERLOADING
data IndexHasConflictsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsIndex a) => O.MethodInfo IndexHasConflictsMethodInfo a signature where
overloadedMethod _ = indexHasConflicts
#endif
-- method Index::read
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "force read even if there are in-memory changes.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_read" ggit_index_read ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
CInt -> -- force : TBasicType TBoolean
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Update the contents of an existing index object in memory by reading from
the hard disk.
If /@force@/ is true, this performs a \"hard\" read that discards in-memory
changes and always reloads the on-disk index data. If there is no on-disk
version, the index will be cleared.
If /@force@/ is false, this does a \"soft\" read that reloads the index data from
disk only if it has changed since the last time it was loaded. Purely
in-memory index data will be untouched. Be aware: if there are changes on
disk, unwritten in-memory changes are discarded.
-}
indexRead ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> Bool
{- ^ /@force@/: force read even if there are in-memory changes. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexRead idx force = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
let force' = (fromIntegral . fromEnum) force
onException (do
_ <- propagateGError $ ggit_index_read idx' force'
touchManagedPtr idx
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexReadMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsIndex a) => O.MethodInfo IndexReadMethodInfo a signature where
overloadedMethod _ = indexRead
#endif
-- method Index::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file to search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stage", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stage to search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_remove" ggit_index_remove ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr Gio.File.File -> -- file : TInterface (Name {namespace = "Gio", name = "File"})
Int32 -> -- stage : TBasicType TInt
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Remove a file from the index (specified by position).
-}
indexRemove ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a, Gio.File.IsFile b) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> b
{- ^ /@file@/: the file to search. -}
-> Int32
{- ^ /@stage@/: the stage to search. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexRemove idx file stage = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
file' <- unsafeManagedPtrCastPtr file
onException (do
_ <- propagateGError $ ggit_index_remove idx' file' stage
touchManagedPtr idx
touchManagedPtr file
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexRemoveMethodInfo
instance (signature ~ (b -> Int32 -> m ()), MonadIO m, IsIndex a, Gio.File.IsFile b) => O.MethodInfo IndexRemoveMethodInfo a signature where
overloadedMethod _ = indexRemove
#endif
-- method Index::write
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_write" ggit_index_write ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Write an existing index object from memory back to disk using an atomic file
lock.
-}
indexWrite ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexWrite idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
onException (do
_ <- propagateGError $ ggit_index_write idx'
touchManagedPtr idx
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexWriteMethodInfo
instance (signature ~ (m ()), MonadIO m, IsIndex a) => O.MethodInfo IndexWriteMethodInfo a signature where
overloadedMethod _ = indexWrite
#endif
-- method Index::write_tree
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "OId"}))
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_write_tree" ggit_index_write_tree ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr (Ptr GError) -> -- error
IO (Ptr Ggit.OId.OId)
{- |
Write a new tree object to disk containing a representation of the current
state of the index. The index must be associated to an existing repository
and must not contain any files in conflict. You can use the resulting tree
to for instance create a commit.
-}
indexWriteTree ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> m (Maybe Ggit.OId.OId)
{- ^ __Returns:__ a 'GI.Ggit.Structs.OId.OId' or 'Nothing' in case of an error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexWriteTree idx = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
onException (do
result <- propagateGError $ ggit_index_write_tree idx'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Ggit.OId.OId) result'
return result''
touchManagedPtr idx
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexWriteTreeMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m, IsIndex a) => O.MethodInfo IndexWriteTreeMethodInfo a signature where
overloadedMethod _ = indexWriteTree
#endif
-- method Index::write_tree_to
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "idx", argType = TInterface (Name {namespace = "Ggit", name = "Index"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "repository", argType = TInterface (Name {namespace = "Ggit", name = "Repository"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitRepository.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "OId"}))
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_write_tree_to" ggit_index_write_tree_to ::
Ptr Index -> -- idx : TInterface (Name {namespace = "Ggit", name = "Index"})
Ptr Ggit.Repository.Repository -> -- repository : TInterface (Name {namespace = "Ggit", name = "Repository"})
Ptr (Ptr GError) -> -- error
IO (Ptr Ggit.OId.OId)
{- |
Write a new tree object to /@repository@/ containing a representation of the current
state of the index. The index must not contain any files in conflict. You can use
the resulting tree to for instance create a commit.
-}
indexWriteTreeTo ::
(B.CallStack.HasCallStack, MonadIO m, IsIndex a, Ggit.Repository.IsRepository b) =>
a
{- ^ /@idx@/: a 'GI.Ggit.Objects.Index.Index'. -}
-> b
{- ^ /@repository@/: a 'GI.Ggit.Objects.Repository.Repository'. -}
-> m (Maybe Ggit.OId.OId)
{- ^ __Returns:__ a 'GI.Ggit.Structs.OId.OId' or 'Nothing' in case of an error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexWriteTreeTo idx repository = liftIO $ do
idx' <- unsafeManagedPtrCastPtr idx
repository' <- unsafeManagedPtrCastPtr repository
onException (do
result <- propagateGError $ ggit_index_write_tree_to idx' repository'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Ggit.OId.OId) result'
return result''
touchManagedPtr idx
touchManagedPtr repository
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data IndexWriteTreeToMethodInfo
instance (signature ~ (b -> m (Maybe Ggit.OId.OId)), MonadIO m, IsIndex a, Ggit.Repository.IsRepository b) => O.MethodInfo IndexWriteTreeToMethodInfo a signature where
overloadedMethod _ = indexWriteTreeTo
#endif
-- method Index::open
-- method type : MemberFunction
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Index"}))
-- throws : True
-- Skip return : False
foreign import ccall "ggit_index_open" ggit_index_open ::
Ptr Gio.File.File -> -- file : TInterface (Name {namespace = "Gio", name = "File"})
Ptr (Ptr GError) -> -- error
IO (Ptr Index)
{- |
Create a new bare Git index object as a memory representation of the Git
index file in /@file@/, without a repository to back it.
-}
indexOpen ::
(B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) =>
a
{- ^ /@file@/: a 'GI.Gio.Interfaces.File.File'. -}
-> m (Maybe Index)
{- ^ __Returns:__ a 'GI.Ggit.Objects.Index.Index' or 'Nothing' if an error occurred. /(Can throw 'Data.GI.Base.GError.GError')/ -}
indexOpen file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
onException (do
result <- propagateGError $ ggit_index_open file'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Index) result'
return result''
touchManagedPtr file
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
#endif