{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.OSTree.Objects.BootconfigParser
    ( 

-- * Exported types
    BootconfigParser(..)                    ,
    IsBootconfigParser                      ,
    toBootconfigParser                      ,
    noBootconfigParser                      ,


 -- * Methods
-- ** clone #method:clone#
    BootconfigParserCloneMethodInfo         ,
    bootconfigParserClone                   ,


-- ** get #method:get#
    BootconfigParserGetMethodInfo           ,
    bootconfigParserGet                     ,


-- ** new #method:new#
    bootconfigParserNew                     ,


-- ** parse #method:parse#
    BootconfigParserParseMethodInfo         ,
    bootconfigParserParse                   ,


-- ** parseAt #method:parseAt#
    BootconfigParserParseAtMethodInfo       ,
    bootconfigParserParseAt                 ,


-- ** set #method:set#
    BootconfigParserSetMethodInfo           ,
    bootconfigParserSet                     ,


-- ** write #method:write#
    BootconfigParserWriteMethodInfo         ,
    bootconfigParserWrite                   ,


-- ** writeAt #method:writeAt#
    BootconfigParserWriteAtMethodInfo       ,
    bootconfigParserWriteAt                 ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable

newtype BootconfigParser = BootconfigParser (ManagedPtr BootconfigParser)
foreign import ccall "ostree_bootconfig_parser_get_type"
    c_ostree_bootconfig_parser_get_type :: IO GType

instance GObject BootconfigParser where
    gobjectType _ = c_ostree_bootconfig_parser_get_type
    

class GObject o => IsBootconfigParser o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError BootconfigParser a) =>
    IsBootconfigParser a
#endif
instance IsBootconfigParser BootconfigParser
instance GObject.Object.IsObject BootconfigParser

toBootconfigParser :: IsBootconfigParser o => o -> IO BootconfigParser
toBootconfigParser = unsafeCastTo BootconfigParser

noBootconfigParser :: Maybe BootconfigParser
noBootconfigParser = Nothing

type family ResolveBootconfigParserMethod (t :: Symbol) (o :: *) :: * where
    ResolveBootconfigParserMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveBootconfigParserMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveBootconfigParserMethod "clone" o = BootconfigParserCloneMethodInfo
    ResolveBootconfigParserMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveBootconfigParserMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveBootconfigParserMethod "get" o = BootconfigParserGetMethodInfo
    ResolveBootconfigParserMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveBootconfigParserMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveBootconfigParserMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveBootconfigParserMethod "parse" o = BootconfigParserParseMethodInfo
    ResolveBootconfigParserMethod "parseAt" o = BootconfigParserParseAtMethodInfo
    ResolveBootconfigParserMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveBootconfigParserMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveBootconfigParserMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveBootconfigParserMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveBootconfigParserMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveBootconfigParserMethod "set" o = BootconfigParserSetMethodInfo
    ResolveBootconfigParserMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveBootconfigParserMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveBootconfigParserMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveBootconfigParserMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveBootconfigParserMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveBootconfigParserMethod "write" o = BootconfigParserWriteMethodInfo
    ResolveBootconfigParserMethod "writeAt" o = BootconfigParserWriteAtMethodInfo
    ResolveBootconfigParserMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveBootconfigParserMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveBootconfigParserMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveBootconfigParserMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBootconfigParserMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBootconfigParserMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBootconfigParserMethod t BootconfigParser, O.MethodInfo info BootconfigParser p) => O.IsLabelProxy t (BootconfigParser -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveBootconfigParserMethod t BootconfigParser, O.MethodInfo info BootconfigParser p) => O.IsLabel t (BootconfigParser -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

instance O.HasAttributeList BootconfigParser
type instance O.AttributeList BootconfigParser = BootconfigParserAttributeList
type BootconfigParserAttributeList = ('[ ] :: [(Symbol, *)])

type instance O.SignalList BootconfigParser = BootconfigParserSignalList
type BootconfigParserSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "ostree_bootconfig_parser_new" ostree_bootconfig_parser_new :: 
    IO (Ptr BootconfigParser)

{- |
/No description available in the introspection data./
-}
bootconfigParserNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m BootconfigParser
bootconfigParserNew  = liftIO $ do
    result <- ostree_bootconfig_parser_new
    checkUnexpectedReturnNULL "bootconfigParserNew" result
    result' <- (wrapObject BootconfigParser) result
    return result'

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

foreign import ccall "ostree_bootconfig_parser_clone" ostree_bootconfig_parser_clone :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    IO (Ptr BootconfigParser)

{- |
/No description available in the introspection data./
-}
bootconfigParserClone ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a) =>
    a
    {- ^ /@self@/: Bootconfig to clone -}
    -> m BootconfigParser
    {- ^ __Returns:__ Copy of /@self@/ -}
bootconfigParserClone self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- ostree_bootconfig_parser_clone self'
    checkUnexpectedReturnNULL "bootconfigParserClone" result
    result' <- (wrapObject BootconfigParser) result
    touchManagedPtr self
    return result'

data BootconfigParserCloneMethodInfo
instance (signature ~ (m BootconfigParser), MonadIO m, IsBootconfigParser a) => O.MethodInfo BootconfigParserCloneMethodInfo a signature where
    overloadedMethod _ = bootconfigParserClone

-- method BootconfigParser::get
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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 "ostree_bootconfig_parser_get" ostree_bootconfig_parser_get :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    CString ->                              -- key : TBasicType TUTF8
    IO CString

{- |
/No description available in the introspection data./
-}
bootconfigParserGet ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a) =>
    a
    -> T.Text
    -> m T.Text
bootconfigParserGet self key = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    key' <- textToCString key
    result <- ostree_bootconfig_parser_get self' key'
    checkUnexpectedReturnNULL "bootconfigParserGet" result
    result' <- cstringToText result
    touchManagedPtr self
    freeMem key'
    return result'

data BootconfigParserGetMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsBootconfigParser a) => O.MethodInfo BootconfigParserGetMethodInfo a signature where
    overloadedMethod _ = bootconfigParserGet

-- method BootconfigParser::parse
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, 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 "ostree_bootconfig_parser_parse" ostree_bootconfig_parser_parse :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    Ptr Gio.File.File ->                    -- path : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
/No description available in the introspection data./
-}
bootconfigParserParse ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) =>
    a
    -> b
    -> Maybe (c)
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bootconfigParserParse self path cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    path' <- unsafeManagedPtrCastPtr path
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_bootconfig_parser_parse self' path' maybeCancellable
        touchManagedPtr self
        touchManagedPtr path
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data BootconfigParserParseMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsBootconfigParser a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) => O.MethodInfo BootconfigParserParseMethodInfo a signature where
    overloadedMethod _ = bootconfigParserParse

-- method BootconfigParser::parse_at
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Parser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dfd", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Directory fd", 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 "File path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Cancellable", 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 "ostree_bootconfig_parser_parse_at" ostree_bootconfig_parser_parse_at :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    Int32 ->                                -- dfd : TBasicType TInt
    CString ->                              -- path : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Initialize a bootconfig from the given file.
-}
bootconfigParserParseAt ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: Parser -}
    -> Int32
    {- ^ /@dfd@/: Directory fd -}
    -> T.Text
    {- ^ /@path@/: File path -}
    -> Maybe (b)
    {- ^ /@cancellable@/: Cancellable -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bootconfigParserParseAt self dfd path cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    path' <- textToCString path
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_bootconfig_parser_parse_at self' dfd path' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        freeMem path'
        return ()
     ) (do
        freeMem path'
     )

data BootconfigParserParseAtMethodInfo
instance (signature ~ (Int32 -> T.Text -> Maybe (b) -> m ()), MonadIO m, IsBootconfigParser a, Gio.Cancellable.IsCancellable b) => O.MethodInfo BootconfigParserParseAtMethodInfo a signature where
    overloadedMethod _ = bootconfigParserParseAt

-- method BootconfigParser::set
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, 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_bootconfig_parser_set" ostree_bootconfig_parser_set :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO ()

{- |
/No description available in the introspection data./
-}
bootconfigParserSet ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a) =>
    a
    -> T.Text
    -> T.Text
    -> m ()
bootconfigParserSet self key value = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    key' <- textToCString key
    value' <- textToCString value
    ostree_bootconfig_parser_set self' key' value'
    touchManagedPtr self
    freeMem key'
    freeMem value'
    return ()

data BootconfigParserSetMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsBootconfigParser a) => O.MethodInfo BootconfigParserSetMethodInfo a signature where
    overloadedMethod _ = bootconfigParserSet

-- method BootconfigParser::write
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "output", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, 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 "ostree_bootconfig_parser_write" ostree_bootconfig_parser_write :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    Ptr Gio.File.File ->                    -- output : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
/No description available in the introspection data./
-}
bootconfigParserWrite ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) =>
    a
    -> b
    -> Maybe (c)
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bootconfigParserWrite self output cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    output' <- unsafeManagedPtrCastPtr output
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_bootconfig_parser_write self' output' maybeCancellable
        touchManagedPtr self
        touchManagedPtr output
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data BootconfigParserWriteMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsBootconfigParser a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) => O.MethodInfo BootconfigParserWriteMethodInfo a signature where
    overloadedMethod _ = bootconfigParserWrite

-- method BootconfigParser::write_at
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "BootconfigParser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dfd", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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 = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, 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 "ostree_bootconfig_parser_write_at" ostree_bootconfig_parser_write_at :: 
    Ptr BootconfigParser ->                 -- self : TInterface (Name {namespace = "OSTree", name = "BootconfigParser"})
    Int32 ->                                -- dfd : TBasicType TInt
    CString ->                              -- path : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
/No description available in the introspection data./
-}
bootconfigParserWriteAt ::
    (B.CallStack.HasCallStack, MonadIO m, IsBootconfigParser a, Gio.Cancellable.IsCancellable b) =>
    a
    -> Int32
    -> T.Text
    -> Maybe (b)
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
bootconfigParserWriteAt self dfd path cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    path' <- textToCString path
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ ostree_bootconfig_parser_write_at self' dfd path' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        freeMem path'
        return ()
     ) (do
        freeMem path'
     )

data BootconfigParserWriteAtMethodInfo
instance (signature ~ (Int32 -> T.Text -> Maybe (b) -> m ()), MonadIO m, IsBootconfigParser a, Gio.Cancellable.IsCancellable b) => O.MethodInfo BootconfigParserWriteAtMethodInfo a signature where
    overloadedMethod _ = bootconfigParserWriteAt