{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.OSTree.Structs.RepoDevInoCache
    ( 

-- * Exported types
    RepoDevInoCache(..)                     ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [ref]("GI.OSTree.Structs.RepoDevInoCache#g:method:ref"), [unref]("GI.OSTree.Structs.RepoDevInoCache#g:method:unref").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveRepoDevInoCacheMethod            ,
#endif

-- ** new #method:new#

    repoDevInoCacheNew                      ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    RepoDevInoCacheRefMethodInfo            ,
#endif
    repoDevInoCacheRef                      ,


-- ** unref #method:unref#

#if defined(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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R


-- | Memory-managed wrapper type.
newtype RepoDevInoCache = RepoDevInoCache (SP.ManagedPtr RepoDevInoCache)
    deriving (RepoDevInoCache -> RepoDevInoCache -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepoDevInoCache -> RepoDevInoCache -> Bool
$c/= :: RepoDevInoCache -> RepoDevInoCache -> Bool
== :: RepoDevInoCache -> RepoDevInoCache -> Bool
$c== :: RepoDevInoCache -> RepoDevInoCache -> Bool
Eq)

instance SP.ManagedPtrNewtype RepoDevInoCache where
    toManagedPtr :: RepoDevInoCache -> ManagedPtr RepoDevInoCache
toManagedPtr (RepoDevInoCache ManagedPtr RepoDevInoCache
p) = ManagedPtr RepoDevInoCache
p

foreign import ccall "ostree_repo_devino_cache_get_type" c_ostree_repo_devino_cache_get_type :: 
    IO GType

type instance O.ParentTypes RepoDevInoCache = '[]
instance O.HasParentTypes RepoDevInoCache

instance B.Types.TypedObject RepoDevInoCache where
    glibType :: IO GType
glibType = IO GType
c_ostree_repo_devino_cache_get_type

instance B.Types.GBoxed RepoDevInoCache

-- | Convert 'RepoDevInoCache' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe RepoDevInoCache) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ostree_repo_devino_cache_get_type
    gvalueSet_ :: Ptr GValue -> Maybe RepoDevInoCache -> IO ()
gvalueSet_ Ptr GValue
gv Maybe RepoDevInoCache
P.Nothing = forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr RepoDevInoCache)
    gvalueSet_ Ptr GValue
gv (P.Just RepoDevInoCache
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RepoDevInoCache
obj (forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe RepoDevInoCache)
gvalueGet_ Ptr GValue
gv = do
        Ptr RepoDevInoCache
ptr <- forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr RepoDevInoCache)
        if Ptr RepoDevInoCache
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
        then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr RepoDevInoCache -> RepoDevInoCache
RepoDevInoCache Ptr RepoDevInoCache
ptr
        else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
        
    


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RepoDevInoCache
type instance O.AttributeList RepoDevInoCache = RepoDevInoCacheAttributeList
type RepoDevInoCacheAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m RepoDevInoCache
repoDevInoCacheNew  = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr RepoDevInoCache
result <- IO (Ptr RepoDevInoCache)
ostree_repo_devino_cache_new
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"repoDevInoCacheNew" Ptr RepoDevInoCache
result
    RepoDevInoCache
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RepoDevInoCache -> RepoDevInoCache
RepoDevInoCache) Ptr RepoDevInoCache
result
    forall (m :: * -> *) a. Monad m => a -> m a
return RepoDevInoCache
result'

#if defined(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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RepoDevInoCache -> m RepoDevInoCache
repoDevInoCacheRef RepoDevInoCache
cache = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr RepoDevInoCache
cache' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoDevInoCache
cache
    Ptr RepoDevInoCache
result <- Ptr RepoDevInoCache -> IO (Ptr RepoDevInoCache)
ostree_repo_devino_cache_ref Ptr RepoDevInoCache
cache'
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"repoDevInoCacheRef" Ptr RepoDevInoCache
result
    RepoDevInoCache
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RepoDevInoCache -> RepoDevInoCache
RepoDevInoCache) Ptr RepoDevInoCache
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoDevInoCache
cache
    forall (m :: * -> *) a. Monad m => a -> m a
return RepoDevInoCache
result'

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

instance O.OverloadedMethodInfo RepoDevInoCacheRefMethodInfo RepoDevInoCache where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.OSTree.Structs.RepoDevInoCache.repoDevInoCacheRef",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-RepoDevInoCache.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RepoDevInoCache -> m ()
repoDevInoCacheUnref RepoDevInoCache
cache = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr RepoDevInoCache
cache' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RepoDevInoCache
cache
    Ptr RepoDevInoCache -> IO ()
ostree_repo_devino_cache_unref Ptr RepoDevInoCache
cache'
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RepoDevInoCache
cache
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

instance O.OverloadedMethodInfo RepoDevInoCacheUnrefMethodInfo RepoDevInoCache where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.OSTree.Structs.RepoDevInoCache.repoDevInoCacheUnref",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Structs-RepoDevInoCache.html#v:repoDevInoCacheUnref"
        })


#endif

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

instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.OverloadedMethod info RepoDevInoCache p) => OL.IsLabel t (RepoDevInoCache -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.OverloadedMethod info RepoDevInoCache p, R.HasField t RepoDevInoCache p) => R.HasField t RepoDevInoCache p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveRepoDevInoCacheMethod t RepoDevInoCache, O.OverloadedMethodInfo info RepoDevInoCache) => OL.IsLabel t (O.MethodProxy info RepoDevInoCache) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif