{-# 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.Poppler.Objects.Attachment
    ( 

-- * Exported types
    Attachment(..)                          ,
    IsAttachment                            ,
    toAttachment                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [save]("GI.Poppler.Objects.Attachment#g:method:save"), [saveToCallback]("GI.Poppler.Objects.Attachment#g:method:saveToCallback"), [saveToFd]("GI.Poppler.Objects.Attachment#g:method:saveToFd"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getChecksum]("GI.Poppler.Objects.Attachment#g:method:getChecksum"), [getCtime]("GI.Poppler.Objects.Attachment#g:method:getCtime"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getDescription]("GI.Poppler.Objects.Attachment#g:method:getDescription"), [getMtime]("GI.Poppler.Objects.Attachment#g:method:getMtime"), [getName]("GI.Poppler.Objects.Attachment#g:method:getName"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSize]("GI.Poppler.Objects.Attachment#g:method:getSize").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveAttachmentMethod                 ,
#endif

-- ** getChecksum #method:getChecksum#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetChecksumMethodInfo         ,
#endif
    attachmentGetChecksum                   ,


-- ** getCtime #method:getCtime#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetCtimeMethodInfo            ,
#endif
    attachmentGetCtime                      ,


-- ** getDescription #method:getDescription#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetDescriptionMethodInfo      ,
#endif
    attachmentGetDescription                ,


-- ** getMtime #method:getMtime#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetMtimeMethodInfo            ,
#endif
    attachmentGetMtime                      ,


-- ** getName #method:getName#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetNameMethodInfo             ,
#endif
    attachmentGetName                       ,


-- ** getSize #method:getSize#

#if defined(ENABLE_OVERLOADING)
    AttachmentGetSizeMethodInfo             ,
#endif
    attachmentGetSize                       ,


-- ** save #method:save#

#if defined(ENABLE_OVERLOADING)
    AttachmentSaveMethodInfo                ,
#endif
    attachmentSave                          ,


-- ** saveToCallback #method:saveToCallback#

#if defined(ENABLE_OVERLOADING)
    AttachmentSaveToCallbackMethodInfo      ,
#endif
    attachmentSaveToCallback                ,


-- ** saveToFd #method:saveToFd#

#if defined(ENABLE_OVERLOADING)
    AttachmentSaveToFdMethodInfo            ,
#endif
    attachmentSaveToFd                      ,




    ) 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.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

import qualified GI.GLib.Structs.DateTime as GLib.DateTime
import qualified GI.GLib.Structs.String as GLib.String
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Poppler.Callbacks as Poppler.Callbacks

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

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

foreign import ccall "poppler_attachment_get_type"
    c_poppler_attachment_get_type :: IO B.Types.GType

instance B.Types.TypedObject Attachment where
    glibType :: IO GType
glibType = IO GType
c_poppler_attachment_get_type

instance B.Types.GObject Attachment

-- | Type class for types which can be safely cast to `Attachment`, for instance with `toAttachment`.
class (SP.GObject o, O.IsDescendantOf Attachment o) => IsAttachment o
instance (SP.GObject o, O.IsDescendantOf Attachment o) => IsAttachment o

instance O.HasParentTypes Attachment
type instance O.ParentTypes Attachment = '[GObject.Object.Object]

-- | Cast to `Attachment`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAttachment :: (MIO.MonadIO m, IsAttachment o) => o -> m Attachment
toAttachment :: forall (m :: * -> *) o.
(MonadIO m, IsAttachment o) =>
o -> m Attachment
toAttachment = IO Attachment -> m Attachment
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Attachment -> m Attachment)
-> (o -> IO Attachment) -> o -> m Attachment
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Attachment -> Attachment) -> o -> IO Attachment
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Attachment -> Attachment
Attachment

-- | Convert 'Attachment' 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 Attachment) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_poppler_attachment_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Attachment -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Attachment
P.Nothing = Ptr GValue -> Ptr Attachment -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Attachment
forall a. Ptr a
FP.nullPtr :: FP.Ptr Attachment)
    gvalueSet_ Ptr GValue
gv (P.Just Attachment
obj) = Attachment -> (Ptr Attachment -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Attachment
obj (Ptr GValue -> Ptr Attachment -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Attachment)
gvalueGet_ Ptr GValue
gv = do
        Ptr Attachment
ptr <- Ptr GValue -> IO (Ptr Attachment)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Attachment)
        if Ptr Attachment
ptr Ptr Attachment -> Ptr Attachment -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Attachment
forall a. Ptr a
FP.nullPtr
        then Attachment -> Maybe Attachment
forall a. a -> Maybe a
P.Just (Attachment -> Maybe Attachment)
-> IO Attachment -> IO (Maybe Attachment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Attachment -> Attachment)
-> Ptr Attachment -> IO Attachment
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Attachment -> Attachment
Attachment Ptr Attachment
ptr
        else Maybe Attachment -> IO (Maybe Attachment)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Attachment
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveAttachmentMethod (t :: Symbol) (o :: *) :: * where
    ResolveAttachmentMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAttachmentMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAttachmentMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAttachmentMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAttachmentMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAttachmentMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAttachmentMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAttachmentMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAttachmentMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAttachmentMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAttachmentMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAttachmentMethod "save" o = AttachmentSaveMethodInfo
    ResolveAttachmentMethod "saveToCallback" o = AttachmentSaveToCallbackMethodInfo
    ResolveAttachmentMethod "saveToFd" o = AttachmentSaveToFdMethodInfo
    ResolveAttachmentMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAttachmentMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAttachmentMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAttachmentMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAttachmentMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAttachmentMethod "getChecksum" o = AttachmentGetChecksumMethodInfo
    ResolveAttachmentMethod "getCtime" o = AttachmentGetCtimeMethodInfo
    ResolveAttachmentMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAttachmentMethod "getDescription" o = AttachmentGetDescriptionMethodInfo
    ResolveAttachmentMethod "getMtime" o = AttachmentGetMtimeMethodInfo
    ResolveAttachmentMethod "getName" o = AttachmentGetNameMethodInfo
    ResolveAttachmentMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAttachmentMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAttachmentMethod "getSize" o = AttachmentGetSizeMethodInfo
    ResolveAttachmentMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAttachmentMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveAttachmentMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAttachmentMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAttachmentMethod t Attachment, O.OverloadedMethod info Attachment p) => OL.IsLabel t (Attachment -> 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 ~ ResolveAttachmentMethod t Attachment, O.OverloadedMethod info Attachment p, R.HasField t Attachment p) => R.HasField t Attachment p where
    getField = O.overloadedMethod @info

#endif

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

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Attachment = AttachmentSignalList
type AttachmentSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Attachment::get_checksum
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "String" })
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_checksum" poppler_attachment_get_checksum :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO (Ptr GLib.String.String)

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetChecksum ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m GLib.String.String
    -- ^ __Returns:__ The attachment\'s checksum.
attachmentGetChecksum :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m String
attachmentGetChecksum a
attachment = IO String -> m String
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> m String) -> IO String -> m String
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    Ptr String
result <- Ptr Attachment -> IO (Ptr String)
poppler_attachment_get_checksum Ptr Attachment
attachment'
    Text -> Ptr String -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attachmentGetChecksum" Ptr String
result
    String
result' <- ((ManagedPtr String -> String) -> Ptr String -> IO String
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr String -> String
GLib.String.String) Ptr String
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    String -> IO String
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return String
result'

#if defined(ENABLE_OVERLOADING)
data AttachmentGetChecksumMethodInfo
instance (signature ~ (m GLib.String.String), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetChecksumMethodInfo a signature where
    overloadedMethod = attachmentGetChecksum

instance O.OverloadedMethodInfo AttachmentGetChecksumMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetChecksum",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetChecksum"
        })


#endif

-- method Attachment::get_ctime
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "DateTime" })
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_ctime" poppler_attachment_get_ctime :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO (Ptr GLib.DateTime.DateTime)

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetCtime ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m (Maybe GLib.DateTime.DateTime)
    -- ^ __Returns:__ The attachment\'s creation date and time
    -- as a t'GI.GLib.Structs.DateTime.DateTime', or 'P.Nothing' if the creation date and time is not available.
attachmentGetCtime :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m (Maybe DateTime)
attachmentGetCtime a
attachment = IO (Maybe DateTime) -> m (Maybe DateTime)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DateTime) -> m (Maybe DateTime))
-> IO (Maybe DateTime) -> m (Maybe DateTime)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    Ptr DateTime
result <- Ptr Attachment -> IO (Ptr DateTime)
poppler_attachment_get_ctime Ptr Attachment
attachment'
    Maybe DateTime
maybeResult <- Ptr DateTime
-> (Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DateTime
result ((Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime))
-> (Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime)
forall a b. (a -> b) -> a -> b
$ \Ptr DateTime
result' -> do
        DateTime
result'' <- ((ManagedPtr DateTime -> DateTime) -> Ptr DateTime -> IO DateTime
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr DateTime -> DateTime
GLib.DateTime.DateTime) Ptr DateTime
result'
        DateTime -> IO DateTime
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return DateTime
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    Maybe DateTime -> IO (Maybe DateTime)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DateTime
maybeResult

#if defined(ENABLE_OVERLOADING)
data AttachmentGetCtimeMethodInfo
instance (signature ~ (m (Maybe GLib.DateTime.DateTime)), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetCtimeMethodInfo a signature where
    overloadedMethod = attachmentGetCtime

instance O.OverloadedMethodInfo AttachmentGetCtimeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetCtime",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetCtime"
        })


#endif

-- method Attachment::get_description
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_description" poppler_attachment_get_description :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m T.Text
    -- ^ __Returns:__ The attachment\'s descriptive text.
attachmentGetDescription :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m Text
attachmentGetDescription a
attachment = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    CString
result <- Ptr Attachment -> IO CString
poppler_attachment_get_description Ptr Attachment
attachment'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attachmentGetDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data AttachmentGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetDescriptionMethodInfo a signature where
    overloadedMethod = attachmentGetDescription

instance O.OverloadedMethodInfo AttachmentGetDescriptionMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetDescription",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetDescription"
        })


#endif

-- method Attachment::get_mtime
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "DateTime" })
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_mtime" poppler_attachment_get_mtime :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO (Ptr GLib.DateTime.DateTime)

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetMtime ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m (Maybe GLib.DateTime.DateTime)
    -- ^ __Returns:__ The attachment\'s modification date and
    -- time as a t'GI.GLib.Structs.DateTime.DateTime', or 'P.Nothing' if the modification date and time is not
    -- available.
attachmentGetMtime :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m (Maybe DateTime)
attachmentGetMtime a
attachment = IO (Maybe DateTime) -> m (Maybe DateTime)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe DateTime) -> m (Maybe DateTime))
-> IO (Maybe DateTime) -> m (Maybe DateTime)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    Ptr DateTime
result <- Ptr Attachment -> IO (Ptr DateTime)
poppler_attachment_get_mtime Ptr Attachment
attachment'
    Maybe DateTime
maybeResult <- Ptr DateTime
-> (Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr DateTime
result ((Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime))
-> (Ptr DateTime -> IO DateTime) -> IO (Maybe DateTime)
forall a b. (a -> b) -> a -> b
$ \Ptr DateTime
result' -> do
        DateTime
result'' <- ((ManagedPtr DateTime -> DateTime) -> Ptr DateTime -> IO DateTime
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr DateTime -> DateTime
GLib.DateTime.DateTime) Ptr DateTime
result'
        DateTime -> IO DateTime
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return DateTime
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    Maybe DateTime -> IO (Maybe DateTime)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DateTime
maybeResult

#if defined(ENABLE_OVERLOADING)
data AttachmentGetMtimeMethodInfo
instance (signature ~ (m (Maybe GLib.DateTime.DateTime)), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetMtimeMethodInfo a signature where
    overloadedMethod = attachmentGetMtime

instance O.OverloadedMethodInfo AttachmentGetMtimeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetMtime",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetMtime"
        })


#endif

-- method Attachment::get_name
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_name" poppler_attachment_get_name :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m T.Text
    -- ^ __Returns:__ The attachment\'s name.
attachmentGetName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m Text
attachmentGetName a
attachment = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    CString
result <- Ptr Attachment -> IO CString
poppler_attachment_get_name Ptr Attachment
attachment'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attachmentGetName" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data AttachmentGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetNameMethodInfo a signature where
    overloadedMethod = attachmentGetName

instance O.OverloadedMethodInfo AttachmentGetNameMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetName",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetName"
        })


#endif

-- method Attachment::get_size
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerAttachment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_attachment_get_size" poppler_attachment_get_size :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    IO Word64

-- | /No description available in the introspection data./
-- 
-- /Since: 20.09.0/
attachmentGetSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: a t'GI.Poppler.Objects.Attachment.Attachment'
    -> m Word64
    -- ^ __Returns:__ The attachment\'s size.
attachmentGetSize :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> m Word64
attachmentGetSize a
attachment = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    Word64
result <- Ptr Attachment -> IO Word64
poppler_attachment_get_size Ptr Attachment
attachment'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result

#if defined(ENABLE_OVERLOADING)
data AttachmentGetSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentGetSizeMethodInfo a signature where
    overloadedMethod = attachmentGetSize

instance O.OverloadedMethodInfo AttachmentGetSizeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentGetSize",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentGetSize"
        })


#endif

-- method Attachment::save
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #PopplerAttachment."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of file to save"
--                 , 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 "poppler_attachment_save" poppler_attachment_save :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    CString ->                              -- filename : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Saves /@attachment@/ to a file indicated by /@filename@/.  If /@error@/ is set, 'P.False'
-- will be returned. Possible errors include those in the @/G_FILE_ERROR/@ domain
-- and whatever the save function generates.
attachmentSave ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: A t'GI.Poppler.Objects.Attachment.Attachment'.
    -> T.Text
    -- ^ /@filename@/: name of file to save
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
attachmentSave :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> Text -> m ()
attachmentSave a
attachment Text
filename = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Attachment -> CString -> Ptr (Ptr GError) -> IO CInt
poppler_attachment_save Ptr Attachment
attachment' CString
filename'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
     )

#if defined(ENABLE_OVERLOADING)
data AttachmentSaveMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentSaveMethodInfo a signature where
    overloadedMethod = attachmentSave

instance O.OverloadedMethodInfo AttachmentSaveMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentSave",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentSave"
        })


#endif

-- method Attachment::save_to_callback
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #PopplerAttachment."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "save_func"
--           , argType =
--               TInterface
--                 Name { namespace = "Poppler" , name = "AttachmentSaveFunc" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a function that is called to save each block of data that the save routine generates."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeCall
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data to pass to the save function."
--                 , 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 "poppler_attachment_save_to_callback" poppler_attachment_save_to_callback :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    FunPtr Poppler.Callbacks.C_AttachmentSaveFunc -> -- save_func : TInterface (Name {namespace = "Poppler", name = "AttachmentSaveFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Saves /@attachment@/ by feeding the produced data to /@saveFunc@/. Can be used
-- when you want to store the attachment to something other than a file, such as
-- an in-memory buffer or a socket. If /@error@/ is set, 'P.False' will be
-- returned. Possible errors include those in the @/G_FILE_ERROR/@ domain and
-- whatever the save function generates.
attachmentSaveToCallback ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: A t'GI.Poppler.Objects.Attachment.Attachment'.
    -> FunPtr Poppler.Callbacks.C_AttachmentSaveFunc
    -- ^ /@saveFunc@/: a function that is called to save each block of data that the save routine generates.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
attachmentSaveToCallback :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> FunPtr C_AttachmentSaveFunc -> m ()
attachmentSaveToCallback a
attachment FunPtr C_AttachmentSaveFunc
saveFunc = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Attachment
-> FunPtr C_AttachmentSaveFunc
-> Ptr ()
-> Ptr (Ptr GError)
-> IO CInt
poppler_attachment_save_to_callback Ptr Attachment
attachment' FunPtr C_AttachmentSaveFunc
saveFunc Ptr ()
forall a. Ptr a
userData
        Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_AttachmentSaveFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_AttachmentSaveFunc
saveFunc
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_AttachmentSaveFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_AttachmentSaveFunc
saveFunc
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data AttachmentSaveToCallbackMethodInfo
instance (signature ~ (FunPtr Poppler.Callbacks.C_AttachmentSaveFunc -> m ()), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentSaveToCallbackMethodInfo a signature where
    overloadedMethod = attachmentSaveToCallback

instance O.OverloadedMethodInfo AttachmentSaveToCallbackMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentSaveToCallback",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentSaveToCallback"
        })


#endif

-- method Attachment::save_to_fd
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "attachment"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Attachment" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #PopplerAttachment."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "fd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid file descriptor open for writing"
--                 , 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 "poppler_attachment_save_to_fd" poppler_attachment_save_to_fd :: 
    Ptr Attachment ->                       -- attachment : TInterface (Name {namespace = "Poppler", name = "Attachment"})
    Int32 ->                                -- fd : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Saves /@attachment@/ to a file referred to by /@fd@/.  If /@error@/ is set, 'P.False'
-- will be returned. Possible errors include those in the @/G_FILE_ERROR/@ domain
-- and whatever the save function generates.
-- Note that this function takes ownership of /@fd@/; you must not operate on it
-- again, nor close it.
-- 
-- /Since: 21.12.0/
attachmentSaveToFd ::
    (B.CallStack.HasCallStack, MonadIO m, IsAttachment a) =>
    a
    -- ^ /@attachment@/: A t'GI.Poppler.Objects.Attachment.Attachment'.
    -> Int32
    -- ^ /@fd@/: a valid file descriptor open for writing
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
attachmentSaveToFd :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttachment a) =>
a -> Int32 -> m ()
attachmentSaveToFd a
attachment Int32
fd = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attachment
attachment' <- a -> IO (Ptr Attachment)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attachment
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Attachment -> Int32 -> Ptr (Ptr GError) -> IO CInt
poppler_attachment_save_to_fd Ptr Attachment
attachment' Int32
fd
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attachment
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data AttachmentSaveToFdMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsAttachment a) => O.OverloadedMethod AttachmentSaveToFdMethodInfo a signature where
    overloadedMethod = attachmentSaveToFd

instance O.OverloadedMethodInfo AttachmentSaveToFdMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Objects.Attachment.attachmentSaveToFd",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Objects-Attachment.html#v:attachmentSaveToFd"
        })


#endif