{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.OSTree.Structs.RepoDevInoCache
    (

-- * Exported types
    RepoDevInoCache(..)                     ,
    noRepoDevInoCache                       ,


 -- * Methods
-- ** new #method:new#

    repoDevInoCacheNew                      ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    RepoDevInoCacheRefMethodInfo            ,
#endif
    repoDevInoCacheRef                      ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    RepoDevInoCacheUnrefMethodInfo          ,
#endif
    repoDevInoCacheUnref                    ,




    ) 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


-- | Memory-managed wrapper type.
newtype RepoDevInoCache = RepoDevInoCache (ManagedPtr RepoDevInoCache)
foreign import ccall "ostree_repo_devino_cache_get_type" c_ostree_repo_devino_cache_get_type ::
    IO GType

instance BoxedObject RepoDevInoCache where
    boxedType _ = c_ostree_repo_devino_cache_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `RepoDevInoCache`.
noRepoDevInoCache :: Maybe RepoDevInoCache
noRepoDevInoCache = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList RepoDevInoCache
type instance O.AttributeList RepoDevInoCache = RepoDevInoCacheAttributeList
type RepoDevInoCacheAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method RepoDevInoCache::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_devino_cache_new" ostree_repo_devino_cache_new ::
    IO (Ptr RepoDevInoCache)

{- |
OSTree has support for pairing @/ostree_repo_checkout_tree_at()/@ using
hardlinks in combination with a later
'GI.OSTree.Objects.Repo.repoWriteDirectoryToMtree' using a (normally modified)
directory.  In order for OSTree to optimally detect just the new
files, use this function and fill in the @devino_to_csum_cache@
member of @OstreeRepoCheckoutAtOptions@, then call
@/ostree_repo_commit_set_devino_cache()/@.
-}
repoDevInoCacheNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m RepoDevInoCache
    {- ^ __Returns:__ Newly allocated cache -}
repoDevInoCacheNew  = liftIO $ do
    result <- ostree_repo_devino_cache_new
    checkUnexpectedReturnNULL "repoDevInoCacheNew" result
    result' <- (wrapBoxed RepoDevInoCache) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method RepoDevInoCache::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "cache", argType = TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_devino_cache_ref" ostree_repo_devino_cache_ref ::
    Ptr RepoDevInoCache ->                  -- cache : TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"})
    IO (Ptr RepoDevInoCache)

{- |
/No description available in the introspection data./
-}
repoDevInoCacheRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoDevInoCache
    -> m RepoDevInoCache
repoDevInoCacheRef cache = liftIO $ do
    cache' <- unsafeManagedPtrGetPtr cache
    result <- ostree_repo_devino_cache_ref cache'
    checkUnexpectedReturnNULL "repoDevInoCacheRef" result
    result' <- (wrapBoxed RepoDevInoCache) result
    touchManagedPtr cache
    return result'

#if ENABLE_OVERLOADING
data RepoDevInoCacheRefMethodInfo
instance (signature ~ (m RepoDevInoCache), MonadIO m) => O.MethodInfo RepoDevInoCacheRefMethodInfo RepoDevInoCache signature where
    overloadedMethod _ = repoDevInoCacheRef

#endif

-- method RepoDevInoCache::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "cache", argType = TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_devino_cache_unref" ostree_repo_devino_cache_unref ::
    Ptr RepoDevInoCache ->                  -- cache : TInterface (Name {namespace = "OSTree", name = "RepoDevInoCache"})
    IO ()

{- |
/No description available in the introspection data./
-}
repoDevInoCacheUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoDevInoCache
    -> m ()
repoDevInoCacheUnref cache = liftIO $ do
    cache' <- unsafeManagedPtrGetPtr cache
    ostree_repo_devino_cache_unref cache'
    touchManagedPtr cache
    return ()

#if ENABLE_OVERLOADING
data RepoDevInoCacheUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RepoDevInoCacheUnrefMethodInfo RepoDevInoCache signature where
    overloadedMethod _ = repoDevInoCacheUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveRepoDevInoCacheMethod (t :: Symbol) (o :: *) :: * where
    ResolveRepoDevInoCacheMethod "ref" o = RepoDevInoCacheRefMethodInfo
    ResolveRepoDevInoCacheMethod "unref" o = RepoDevInoCacheUnrefMethodInfo
    ResolveRepoDevInoCacheMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.MethodInfo info RepoDevInoCache p) => OL.IsLabel t (RepoDevInoCache -> 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