{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- 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.LibarchiveInputStream
    ( 

-- * Exported types
    LibarchiveInputStream(..)               ,
    newZeroLibarchiveInputStream            ,
    noLibarchiveInputStream                 ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveLibarchiveInputStreamMethod      ,
#endif




 -- * Properties
-- ** parentInstance #attr:parentInstance#
-- | /No description available in the introspection data./

    clearLibarchiveInputStreamParentInstance,
    getLibarchiveInputStreamParentInstance  ,
#if defined(ENABLE_OVERLOADING)
    libarchiveInputStream_parentInstance    ,
#endif
    setLibarchiveInputStreamParentInstance  ,




    ) 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.GI.Base.Signals as B.Signals
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.Gio.Objects.InputStream as Gio.InputStream

-- | Memory-managed wrapper type.
newtype LibarchiveInputStream = LibarchiveInputStream (ManagedPtr LibarchiveInputStream)
    deriving (LibarchiveInputStream -> LibarchiveInputStream -> Bool
(LibarchiveInputStream -> LibarchiveInputStream -> Bool)
-> (LibarchiveInputStream -> LibarchiveInputStream -> Bool)
-> Eq LibarchiveInputStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LibarchiveInputStream -> LibarchiveInputStream -> Bool
$c/= :: LibarchiveInputStream -> LibarchiveInputStream -> Bool
== :: LibarchiveInputStream -> LibarchiveInputStream -> Bool
$c== :: LibarchiveInputStream -> LibarchiveInputStream -> Bool
Eq)
instance WrappedPtr LibarchiveInputStream where
    wrappedPtrCalloc :: IO (Ptr LibarchiveInputStream)
wrappedPtrCalloc = Int -> IO (Ptr LibarchiveInputStream)
forall a. Int -> IO (Ptr a)
callocBytes 40
    wrappedPtrCopy :: LibarchiveInputStream -> IO LibarchiveInputStream
wrappedPtrCopy = \p :: LibarchiveInputStream
p -> LibarchiveInputStream
-> (Ptr LibarchiveInputStream -> IO LibarchiveInputStream)
-> IO LibarchiveInputStream
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LibarchiveInputStream
p (Int -> Ptr LibarchiveInputStream -> IO (Ptr LibarchiveInputStream)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 40 (Ptr LibarchiveInputStream -> IO (Ptr LibarchiveInputStream))
-> (Ptr LibarchiveInputStream -> IO LibarchiveInputStream)
-> Ptr LibarchiveInputStream
-> IO LibarchiveInputStream
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr LibarchiveInputStream -> LibarchiveInputStream)
-> Ptr LibarchiveInputStream -> IO LibarchiveInputStream
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr LibarchiveInputStream -> LibarchiveInputStream
LibarchiveInputStream)
    wrappedPtrFree :: Maybe (GDestroyNotify LibarchiveInputStream)
wrappedPtrFree = GDestroyNotify LibarchiveInputStream
-> Maybe (GDestroyNotify LibarchiveInputStream)
forall a. a -> Maybe a
Just GDestroyNotify LibarchiveInputStream
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free

-- | Construct a `LibarchiveInputStream` struct initialized to zero.
newZeroLibarchiveInputStream :: MonadIO m => m LibarchiveInputStream
newZeroLibarchiveInputStream :: m LibarchiveInputStream
newZeroLibarchiveInputStream = IO LibarchiveInputStream -> m LibarchiveInputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO LibarchiveInputStream -> m LibarchiveInputStream)
-> IO LibarchiveInputStream -> m LibarchiveInputStream
forall a b. (a -> b) -> a -> b
$ IO (Ptr LibarchiveInputStream)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr LibarchiveInputStream)
-> (Ptr LibarchiveInputStream -> IO LibarchiveInputStream)
-> IO LibarchiveInputStream
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr LibarchiveInputStream -> LibarchiveInputStream)
-> Ptr LibarchiveInputStream -> IO LibarchiveInputStream
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr LibarchiveInputStream -> LibarchiveInputStream
LibarchiveInputStream

instance tag ~ 'AttrSet => Constructible LibarchiveInputStream tag where
    new :: (ManagedPtr LibarchiveInputStream -> LibarchiveInputStream)
-> [AttrOp LibarchiveInputStream tag] -> m LibarchiveInputStream
new _ attrs :: [AttrOp LibarchiveInputStream tag]
attrs = do
        LibarchiveInputStream
o <- m LibarchiveInputStream
forall (m :: * -> *). MonadIO m => m LibarchiveInputStream
newZeroLibarchiveInputStream
        LibarchiveInputStream
-> [AttrOp LibarchiveInputStream 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set LibarchiveInputStream
o [AttrOp LibarchiveInputStream tag]
[AttrOp LibarchiveInputStream 'AttrSet]
attrs
        LibarchiveInputStream -> m LibarchiveInputStream
forall (m :: * -> *) a. Monad m => a -> m a
return LibarchiveInputStream
o


-- | A convenience alias for `Nothing` :: `Maybe` `LibarchiveInputStream`.
noLibarchiveInputStream :: Maybe LibarchiveInputStream
noLibarchiveInputStream :: Maybe LibarchiveInputStream
noLibarchiveInputStream = Maybe LibarchiveInputStream
forall a. Maybe a
Nothing

-- | Get the value of the “@parent_instance@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' libarchiveInputStream #parentInstance
-- @
getLibarchiveInputStreamParentInstance :: MonadIO m => LibarchiveInputStream -> m (Maybe Gio.InputStream.InputStream)
getLibarchiveInputStreamParentInstance :: LibarchiveInputStream -> m (Maybe InputStream)
getLibarchiveInputStreamParentInstance s :: LibarchiveInputStream
s = IO (Maybe InputStream) -> m (Maybe InputStream)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe InputStream) -> m (Maybe InputStream))
-> IO (Maybe InputStream) -> m (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ LibarchiveInputStream
-> (Ptr LibarchiveInputStream -> IO (Maybe InputStream))
-> IO (Maybe InputStream)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LibarchiveInputStream
s ((Ptr LibarchiveInputStream -> IO (Maybe InputStream))
 -> IO (Maybe InputStream))
-> (Ptr LibarchiveInputStream -> IO (Maybe InputStream))
-> IO (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr LibarchiveInputStream
ptr -> do
    Ptr InputStream
val <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek (Ptr LibarchiveInputStream
ptr Ptr LibarchiveInputStream -> Int -> Ptr (Ptr InputStream)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO (Ptr Gio.InputStream.InputStream)
    Maybe InputStream
result <- Ptr InputStream
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr InputStream
val ((Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream))
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ \val' :: Ptr InputStream
val' -> do
        InputStream
val'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
val'
        InputStream -> IO InputStream
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
val''
    Maybe InputStream -> IO (Maybe InputStream)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe InputStream
result

-- | Set the value of the “@parent_instance@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' libarchiveInputStream [ #parentInstance 'Data.GI.Base.Attributes.:=' value ]
-- @
setLibarchiveInputStreamParentInstance :: MonadIO m => LibarchiveInputStream -> Ptr Gio.InputStream.InputStream -> m ()
setLibarchiveInputStreamParentInstance :: LibarchiveInputStream -> Ptr InputStream -> m ()
setLibarchiveInputStreamParentInstance s :: LibarchiveInputStream
s val :: Ptr InputStream
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ LibarchiveInputStream
-> (Ptr LibarchiveInputStream -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LibarchiveInputStream
s ((Ptr LibarchiveInputStream -> IO ()) -> IO ())
-> (Ptr LibarchiveInputStream -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr LibarchiveInputStream
ptr -> do
    Ptr (Ptr InputStream) -> Ptr InputStream -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr LibarchiveInputStream
ptr Ptr LibarchiveInputStream -> Int -> Ptr (Ptr InputStream)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Ptr InputStream
val :: Ptr Gio.InputStream.InputStream)

-- | Set the value of the “@parent_instance@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #parentInstance
-- @
clearLibarchiveInputStreamParentInstance :: MonadIO m => LibarchiveInputStream -> m ()
clearLibarchiveInputStreamParentInstance :: LibarchiveInputStream -> m ()
clearLibarchiveInputStreamParentInstance s :: LibarchiveInputStream
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ LibarchiveInputStream
-> (Ptr LibarchiveInputStream -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr LibarchiveInputStream
s ((Ptr LibarchiveInputStream -> IO ()) -> IO ())
-> (Ptr LibarchiveInputStream -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr LibarchiveInputStream
ptr -> do
    Ptr (Ptr InputStream) -> Ptr InputStream -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr LibarchiveInputStream
ptr Ptr LibarchiveInputStream -> Int -> Ptr (Ptr InputStream)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Ptr InputStream
forall a. Ptr a
FP.nullPtr :: Ptr Gio.InputStream.InputStream)

#if defined(ENABLE_OVERLOADING)
data LibarchiveInputStreamParentInstanceFieldInfo
instance AttrInfo LibarchiveInputStreamParentInstanceFieldInfo where
    type AttrBaseTypeConstraint LibarchiveInputStreamParentInstanceFieldInfo = (~) LibarchiveInputStream
    type AttrAllowedOps LibarchiveInputStreamParentInstanceFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint LibarchiveInputStreamParentInstanceFieldInfo = (~) (Ptr Gio.InputStream.InputStream)
    type AttrTransferTypeConstraint LibarchiveInputStreamParentInstanceFieldInfo = (~)(Ptr Gio.InputStream.InputStream)
    type AttrTransferType LibarchiveInputStreamParentInstanceFieldInfo = (Ptr Gio.InputStream.InputStream)
    type AttrGetType LibarchiveInputStreamParentInstanceFieldInfo = Maybe Gio.InputStream.InputStream
    type AttrLabel LibarchiveInputStreamParentInstanceFieldInfo = "parent_instance"
    type AttrOrigin LibarchiveInputStreamParentInstanceFieldInfo = LibarchiveInputStream
    attrGet = getLibarchiveInputStreamParentInstance
    attrSet = setLibarchiveInputStreamParentInstance
    attrConstruct = undefined
    attrClear = clearLibarchiveInputStreamParentInstance
    attrTransfer _ v = do
        return v

libarchiveInputStream_parentInstance :: AttrLabelProxy "parentInstance"
libarchiveInputStream_parentInstance = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList LibarchiveInputStream
type instance O.AttributeList LibarchiveInputStream = LibarchiveInputStreamAttributeList
type LibarchiveInputStreamAttributeList = ('[ '("parentInstance", LibarchiveInputStreamParentInstanceFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveLibarchiveInputStreamMethod (t :: Symbol) (o :: *) :: * where
    ResolveLibarchiveInputStreamMethod l o = O.MethodResolutionFailed l o

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

#endif