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

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

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

module GI.GtkSource.Objects.File
    (

-- * Exported types
    File(..)                                ,
    IsFile                                  ,
    toFile                                  ,
    noFile                                  ,


 -- * Methods
-- ** checkFileOnDisk #method:checkFileOnDisk#

#if ENABLE_OVERLOADING
    FileCheckFileOnDiskMethodInfo           ,
#endif
    fileCheckFileOnDisk                     ,


-- ** getCompressionType #method:getCompressionType#

#if ENABLE_OVERLOADING
    FileGetCompressionTypeMethodInfo        ,
#endif
    fileGetCompressionType                  ,


-- ** getEncoding #method:getEncoding#

#if ENABLE_OVERLOADING
    FileGetEncodingMethodInfo               ,
#endif
    fileGetEncoding                         ,


-- ** getLocation #method:getLocation#

#if ENABLE_OVERLOADING
    FileGetLocationMethodInfo               ,
#endif
    fileGetLocation                         ,


-- ** getNewlineType #method:getNewlineType#

#if ENABLE_OVERLOADING
    FileGetNewlineTypeMethodInfo            ,
#endif
    fileGetNewlineType                      ,


-- ** isDeleted #method:isDeleted#

#if ENABLE_OVERLOADING
    FileIsDeletedMethodInfo                 ,
#endif
    fileIsDeleted                           ,


-- ** isExternallyModified #method:isExternallyModified#

#if ENABLE_OVERLOADING
    FileIsExternallyModifiedMethodInfo      ,
#endif
    fileIsExternallyModified                ,


-- ** isLocal #method:isLocal#

#if ENABLE_OVERLOADING
    FileIsLocalMethodInfo                   ,
#endif
    fileIsLocal                             ,


-- ** isReadonly #method:isReadonly#

#if ENABLE_OVERLOADING
    FileIsReadonlyMethodInfo                ,
#endif
    fileIsReadonly                          ,


-- ** new #method:new#

    fileNew                                 ,


-- ** setLocation #method:setLocation#

#if ENABLE_OVERLOADING
    FileSetLocationMethodInfo               ,
#endif
    fileSetLocation                         ,




 -- * Properties
-- ** compressionType #attr:compressionType#
{- | The compression type.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileCompressionTypePropertyInfo         ,
#endif
#if ENABLE_OVERLOADING
    fileCompressionType                     ,
#endif
    getFileCompressionType                  ,


-- ** encoding #attr:encoding#
{- | The character encoding, initially 'Nothing'. After a successful file
loading or saving operation, the encoding is non-'Nothing'.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileEncodingPropertyInfo                ,
#endif
#if ENABLE_OVERLOADING
    fileEncoding                            ,
#endif
    getFileEncoding                         ,


-- ** location #attr:location#
{- | The location.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileLocationPropertyInfo                ,
#endif
    clearFileLocation                       ,
    constructFileLocation                   ,
#if ENABLE_OVERLOADING
    fileLocation                            ,
#endif
    getFileLocation                         ,
    setFileLocation                         ,


-- ** newlineType #attr:newlineType#
{- | The line ending type.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileNewlineTypePropertyInfo             ,
#endif
#if ENABLE_OVERLOADING
    fileNewlineType                         ,
#endif
    getFileNewlineType                      ,


-- ** readOnly #attr:readOnly#
{- | Whether the file is read-only or not. The value of this property is
not updated automatically (there is no file monitors).

/Since: 3.18/
-}
#if ENABLE_OVERLOADING
    FileReadOnlyPropertyInfo                ,
#endif
#if ENABLE_OVERLOADING
    fileReadOnly                            ,
#endif
    getFileReadOnly                         ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.GtkSource.Enums as GtkSource.Enums
import {-# SOURCE #-} qualified GI.GtkSource.Structs.Encoding as GtkSource.Encoding

-- | Memory-managed wrapper type.
newtype File = File (ManagedPtr File)
foreign import ccall "gtk_source_file_get_type"
    c_gtk_source_file_get_type :: IO GType

instance GObject File where
    gobjectType = c_gtk_source_file_get_type


-- | Type class for types which can be safely cast to `File`, for instance with `toFile`.
class (GObject o, O.IsDescendantOf File o) => IsFile o
instance (GObject o, O.IsDescendantOf File o) => IsFile o

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

-- | Cast to `File`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toFile :: (MonadIO m, IsFile o) => o -> m File
toFile = liftIO . unsafeCastTo File

-- | A convenience alias for `Nothing` :: `Maybe` `File`.
noFile :: Maybe File
noFile = Nothing

#if ENABLE_OVERLOADING
type family ResolveFileMethod (t :: Symbol) (o :: *) :: * where
    ResolveFileMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFileMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFileMethod "checkFileOnDisk" o = FileCheckFileOnDiskMethodInfo
    ResolveFileMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFileMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFileMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFileMethod "isDeleted" o = FileIsDeletedMethodInfo
    ResolveFileMethod "isExternallyModified" o = FileIsExternallyModifiedMethodInfo
    ResolveFileMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFileMethod "isLocal" o = FileIsLocalMethodInfo
    ResolveFileMethod "isReadonly" o = FileIsReadonlyMethodInfo
    ResolveFileMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFileMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFileMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFileMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFileMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFileMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFileMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFileMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFileMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFileMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFileMethod "getCompressionType" o = FileGetCompressionTypeMethodInfo
    ResolveFileMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFileMethod "getEncoding" o = FileGetEncodingMethodInfo
    ResolveFileMethod "getLocation" o = FileGetLocationMethodInfo
    ResolveFileMethod "getNewlineType" o = FileGetNewlineTypeMethodInfo
    ResolveFileMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFileMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFileMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFileMethod "setLocation" o = FileSetLocationMethodInfo
    ResolveFileMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFileMethod l o = O.MethodResolutionFailed l o

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

#endif

-- VVV Prop "compression-type"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "CompressionType"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@compression-type@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' file #compressionType
@
-}
getFileCompressionType :: (MonadIO m, IsFile o) => o -> m GtkSource.Enums.CompressionType
getFileCompressionType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "compression-type"

#if ENABLE_OVERLOADING
data FileCompressionTypePropertyInfo
instance AttrInfo FileCompressionTypePropertyInfo where
    type AttrAllowedOps FileCompressionTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint FileCompressionTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileCompressionTypePropertyInfo = IsFile
    type AttrGetType FileCompressionTypePropertyInfo = GtkSource.Enums.CompressionType
    type AttrLabel FileCompressionTypePropertyInfo = "compression-type"
    type AttrOrigin FileCompressionTypePropertyInfo = File
    attrGet _ = getFileCompressionType
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "encoding"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "Encoding"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@encoding@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' file #encoding
@
-}
getFileEncoding :: (MonadIO m, IsFile o) => o -> m GtkSource.Encoding.Encoding
getFileEncoding obj = liftIO $ checkUnexpectedNothing "getFileEncoding" $ B.Properties.getObjectPropertyBoxed obj "encoding" GtkSource.Encoding.Encoding

#if ENABLE_OVERLOADING
data FileEncodingPropertyInfo
instance AttrInfo FileEncodingPropertyInfo where
    type AttrAllowedOps FileEncodingPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileEncodingPropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileEncodingPropertyInfo = IsFile
    type AttrGetType FileEncodingPropertyInfo = GtkSource.Encoding.Encoding
    type AttrLabel FileEncodingPropertyInfo = "encoding"
    type AttrOrigin FileEncodingPropertyInfo = File
    attrGet _ = getFileEncoding
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "location"
   -- Type: TInterface (Name {namespace = "Gio", name = "File"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just True)

{- |
Get the value of the “@location@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' file #location
@
-}
getFileLocation :: (MonadIO m, IsFile o) => o -> m Gio.File.File
getFileLocation obj = liftIO $ checkUnexpectedNothing "getFileLocation" $ B.Properties.getObjectPropertyObject obj "location" Gio.File.File

{- |
Set the value of the “@location@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' file [ #location 'Data.GI.Base.Attributes.:=' value ]
@
-}
setFileLocation :: (MonadIO m, IsFile o, Gio.File.IsFile a) => o -> a -> m ()
setFileLocation obj val = liftIO $ B.Properties.setObjectPropertyObject obj "location" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@location@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileLocation :: (IsFile o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileLocation val = B.Properties.constructObjectPropertyObject "location" (Just val)

{- |
Set the value of the “@location@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #location
@
-}
clearFileLocation :: (MonadIO m, IsFile o) => o -> m ()
clearFileLocation obj = liftIO $ B.Properties.setObjectPropertyObject obj "location" (Nothing :: Maybe Gio.File.File)

#if ENABLE_OVERLOADING
data FileLocationPropertyInfo
instance AttrInfo FileLocationPropertyInfo where
    type AttrAllowedOps FileLocationPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileLocationPropertyInfo = Gio.File.IsFile
    type AttrBaseTypeConstraint FileLocationPropertyInfo = IsFile
    type AttrGetType FileLocationPropertyInfo = Gio.File.File
    type AttrLabel FileLocationPropertyInfo = "location"
    type AttrOrigin FileLocationPropertyInfo = File
    attrGet _ = getFileLocation
    attrSet _ = setFileLocation
    attrConstruct _ = constructFileLocation
    attrClear _ = clearFileLocation
#endif

-- VVV Prop "newline-type"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "NewlineType"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@newline-type@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' file #newlineType
@
-}
getFileNewlineType :: (MonadIO m, IsFile o) => o -> m GtkSource.Enums.NewlineType
getFileNewlineType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "newline-type"

#if ENABLE_OVERLOADING
data FileNewlineTypePropertyInfo
instance AttrInfo FileNewlineTypePropertyInfo where
    type AttrAllowedOps FileNewlineTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint FileNewlineTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileNewlineTypePropertyInfo = IsFile
    type AttrGetType FileNewlineTypePropertyInfo = GtkSource.Enums.NewlineType
    type AttrLabel FileNewlineTypePropertyInfo = "newline-type"
    type AttrOrigin FileNewlineTypePropertyInfo = File
    attrGet _ = getFileNewlineType
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "read-only"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@read-only@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' file #readOnly
@
-}
getFileReadOnly :: (MonadIO m, IsFile o) => o -> m Bool
getFileReadOnly obj = liftIO $ B.Properties.getObjectPropertyBool obj "read-only"

#if ENABLE_OVERLOADING
data FileReadOnlyPropertyInfo
instance AttrInfo FileReadOnlyPropertyInfo where
    type AttrAllowedOps FileReadOnlyPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint FileReadOnlyPropertyInfo = (~) ()
    type AttrBaseTypeConstraint FileReadOnlyPropertyInfo = IsFile
    type AttrGetType FileReadOnlyPropertyInfo = Bool
    type AttrLabel FileReadOnlyPropertyInfo = "read-only"
    type AttrOrigin FileReadOnlyPropertyInfo = File
    attrGet _ = getFileReadOnly
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList File
type instance O.AttributeList File = FileAttributeList
type FileAttributeList = ('[ '("compressionType", FileCompressionTypePropertyInfo), '("encoding", FileEncodingPropertyInfo), '("location", FileLocationPropertyInfo), '("newlineType", FileNewlineTypePropertyInfo), '("readOnly", FileReadOnlyPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
fileCompressionType :: AttrLabelProxy "compressionType"
fileCompressionType = AttrLabelProxy

fileEncoding :: AttrLabelProxy "encoding"
fileEncoding = AttrLabelProxy

fileLocation :: AttrLabelProxy "location"
fileLocation = AttrLabelProxy

fileNewlineType :: AttrLabelProxy "newlineType"
fileNewlineType = AttrLabelProxy

fileReadOnly :: AttrLabelProxy "readOnly"
fileReadOnly = AttrLabelProxy

#endif

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

#endif

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

foreign import ccall "gtk_source_file_new" gtk_source_file_new ::
    IO (Ptr File)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m File
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.File.File' object. -}
fileNew  = liftIO $ do
    result <- gtk_source_file_new
    checkUnexpectedReturnNULL "fileNew" result
    result' <- (wrapObject File) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method File::check_file_on_disk
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_check_file_on_disk" gtk_source_file_check_file_on_disk ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO ()

{- |
Checks synchronously the file on disk, to know whether the file is externally
modified, or has been deleted, and whether the file is read-only.

'GI.GtkSource.Objects.File.File' doesn\'t create a 'GI.Gio.Objects.FileMonitor.FileMonitor' to track those properties, so
this function needs to be called instead. Creating lots of 'GI.Gio.Objects.FileMonitor.FileMonitor'\'s
would take lots of resources.

Since this function is synchronous, it is advised to call it only on local
files. See 'GI.GtkSource.Objects.File.fileIsLocal'.

/Since: 3.18/
-}
fileCheckFileOnDisk ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m ()
fileCheckFileOnDisk file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    gtk_source_file_check_file_on_disk file'
    touchManagedPtr file
    return ()

#if ENABLE_OVERLOADING
data FileCheckFileOnDiskMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFile a) => O.MethodInfo FileCheckFileOnDiskMethodInfo a signature where
    overloadedMethod _ = fileCheckFileOnDisk

#endif

-- method File::get_compression_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "CompressionType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_get_compression_type" gtk_source_file_get_compression_type ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CUInt

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileGetCompressionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m GtkSource.Enums.CompressionType
    {- ^ __Returns:__ the compression type. -}
fileGetCompressionType file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_get_compression_type file'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileGetCompressionTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.CompressionType), MonadIO m, IsFile a) => O.MethodInfo FileGetCompressionTypeMethodInfo a signature where
    overloadedMethod _ = fileGetCompressionType

#endif

-- method File::get_encoding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Encoding"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_get_encoding" gtk_source_file_get_encoding ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO (Ptr GtkSource.Encoding.Encoding)

{- |
The encoding is initially 'Nothing'. After a successful file loading or saving
operation, the encoding is non-'Nothing'.

/Since: 3.14/
-}
fileGetEncoding ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m GtkSource.Encoding.Encoding
    {- ^ __Returns:__ the character encoding. -}
fileGetEncoding file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_get_encoding file'
    checkUnexpectedReturnNULL "fileGetEncoding" result
    result' <- (newBoxed GtkSource.Encoding.Encoding) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileGetEncodingMethodInfo
instance (signature ~ (m GtkSource.Encoding.Encoding), MonadIO m, IsFile a) => O.MethodInfo FileGetEncodingMethodInfo a signature where
    overloadedMethod _ = fileGetEncoding

#endif

-- method File::get_location
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_get_location" gtk_source_file_get_location ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO (Ptr Gio.File.File)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileGetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m Gio.File.File
    {- ^ __Returns:__ the 'GI.Gio.Interfaces.File.File'. -}
fileGetLocation file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_get_location file'
    checkUnexpectedReturnNULL "fileGetLocation" result
    result' <- (newObject Gio.File.File) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileGetLocationMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsFile a) => O.MethodInfo FileGetLocationMethodInfo a signature where
    overloadedMethod _ = fileGetLocation

#endif

-- method File::get_newline_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "NewlineType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_get_newline_type" gtk_source_file_get_newline_type ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CUInt

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileGetNewlineType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m GtkSource.Enums.NewlineType
    {- ^ __Returns:__ the newline type. -}
fileGetNewlineType file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_get_newline_type file'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileGetNewlineTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.NewlineType), MonadIO m, IsFile a) => O.MethodInfo FileGetNewlineTypeMethodInfo a signature where
    overloadedMethod _ = fileGetNewlineType

#endif

-- method File::is_deleted
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_is_deleted" gtk_source_file_is_deleted ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CInt

{- |
Returns whether the file has been deleted. If the
'GI.GtkSource.Objects.File.File':@/location/@ is 'Nothing', returns 'False'.

To have an up-to-date value, you must first call
'GI.GtkSource.Objects.File.fileCheckFileOnDisk'.

/Since: 3.18/
-}
fileIsDeleted ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m Bool
    {- ^ __Returns:__ whether the file has been deleted. -}
fileIsDeleted file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_is_deleted file'
    let result' = (/= 0) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileIsDeletedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsDeletedMethodInfo a signature where
    overloadedMethod _ = fileIsDeleted

#endif

-- method File::is_externally_modified
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_is_externally_modified" gtk_source_file_is_externally_modified ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CInt

{- |
Returns whether the file is externally modified. If the
'GI.GtkSource.Objects.File.File':@/location/@ is 'Nothing', returns 'False'.

To have an up-to-date value, you must first call
'GI.GtkSource.Objects.File.fileCheckFileOnDisk'.

/Since: 3.18/
-}
fileIsExternallyModified ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m Bool
    {- ^ __Returns:__ whether the file is externally modified. -}
fileIsExternallyModified file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_is_externally_modified file'
    let result' = (/= 0) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileIsExternallyModifiedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsExternallyModifiedMethodInfo a signature where
    overloadedMethod _ = fileIsExternallyModified

#endif

-- method File::is_local
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_is_local" gtk_source_file_is_local ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CInt

{- |
Returns whether the file is local. If the 'GI.GtkSource.Objects.File.File':@/location/@ is 'Nothing',
returns 'False'.

/Since: 3.18/
-}
fileIsLocal ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m Bool
    {- ^ __Returns:__ whether the file is local. -}
fileIsLocal file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_is_local file'
    let result' = (/= 0) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileIsLocalMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsLocalMethodInfo a signature where
    overloadedMethod _ = fileIsLocal

#endif

-- method File::is_readonly
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_is_readonly" gtk_source_file_is_readonly ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO CInt

{- |
Returns whether the file is read-only. If the
'GI.GtkSource.Objects.File.File':@/location/@ is 'Nothing', returns 'False'.

To have an up-to-date value, you must first call
'GI.GtkSource.Objects.File.fileCheckFileOnDisk'.

/Since: 3.18/
-}
fileIsReadonly ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> m Bool
    {- ^ __Returns:__ whether the file is read-only. -}
fileIsReadonly file = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_is_readonly file'
    let result' = (/= 0) result
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
data FileIsReadonlyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsReadonlyMethodInfo a signature where
    overloadedMethod _ = fileIsReadonly

#endif

-- method File::set_location
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "location", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the new #GFile, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_set_location" gtk_source_file_set_location ::
    Ptr File ->                             -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    Ptr Gio.File.File ->                    -- location : TInterface (Name {namespace = "Gio", name = "File"})
    IO ()

{- |
Sets the location.

/Since: 3.14/
-}
fileSetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.File.IsFile b) =>
    a
    {- ^ /@file@/: a 'GI.GtkSource.Objects.File.File'. -}
    -> Maybe (b)
    {- ^ /@location@/: the new 'GI.Gio.Interfaces.File.File', or 'Nothing'. -}
    -> m ()
fileSetLocation file location = liftIO $ do
    file' <- unsafeManagedPtrCastPtr file
    maybeLocation <- case location of
        Nothing -> return nullPtr
        Just jLocation -> do
            jLocation' <- unsafeManagedPtrCastPtr jLocation
            return jLocation'
    gtk_source_file_set_location file' maybeLocation
    touchManagedPtr file
    whenJust location touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data FileSetLocationMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.File.IsFile b) => O.MethodInfo FileSetLocationMethodInfo a signature where
    overloadedMethod _ = fileSetLocation

#endif