{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- On-disk representation of a [class/@buffer@/].
-- 
-- A @GtkSourceFile@ object is the on-disk representation of a [class/@buffer@/].
-- With a @GtkSourceFile@, you can create and configure a [class/@fileLoader@/]
-- and [class/@fileSaver@/] which take by default the values of the
-- @GtkSourceFile@ properties (except for the file loader which auto-detect some
-- properties). On a successful load or save operation, the @GtkSourceFile@
-- properties are updated. If an operation fails, the @GtkSourceFile@ properties
-- have still the previous valid values.

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

module GI.GtkSource.Objects.File
    ( 

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


 -- * 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"), [checkFileOnDisk]("GI.GtkSource.Objects.File#g:method:checkFileOnDisk"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isDeleted]("GI.GtkSource.Objects.File#g:method:isDeleted"), [isExternallyModified]("GI.GtkSource.Objects.File#g:method:isExternallyModified"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [isLocal]("GI.GtkSource.Objects.File#g:method:isLocal"), [isReadonly]("GI.GtkSource.Objects.File#g:method:isReadonly"), [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"), [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
-- [getCompressionType]("GI.GtkSource.Objects.File#g:method:getCompressionType"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getEncoding]("GI.GtkSource.Objects.File#g:method:getEncoding"), [getLocation]("GI.GtkSource.Objects.File#g:method:getLocation"), [getNewlineType]("GI.GtkSource.Objects.File#g:method:getNewlineType"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setLocation]("GI.GtkSource.Objects.File#g:method:setLocation"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveFileMethod                       ,
#endif

-- ** checkFileOnDisk #method:checkFileOnDisk#

#if defined(ENABLE_OVERLOADING)
    FileCheckFileOnDiskMethodInfo           ,
#endif
    fileCheckFileOnDisk                     ,


-- ** getCompressionType #method:getCompressionType#

#if defined(ENABLE_OVERLOADING)
    FileGetCompressionTypeMethodInfo        ,
#endif
    fileGetCompressionType                  ,


-- ** getEncoding #method:getEncoding#

#if defined(ENABLE_OVERLOADING)
    FileGetEncodingMethodInfo               ,
#endif
    fileGetEncoding                         ,


-- ** getLocation #method:getLocation#

#if defined(ENABLE_OVERLOADING)
    FileGetLocationMethodInfo               ,
#endif
    fileGetLocation                         ,


-- ** getNewlineType #method:getNewlineType#

#if defined(ENABLE_OVERLOADING)
    FileGetNewlineTypeMethodInfo            ,
#endif
    fileGetNewlineType                      ,


-- ** isDeleted #method:isDeleted#

#if defined(ENABLE_OVERLOADING)
    FileIsDeletedMethodInfo                 ,
#endif
    fileIsDeleted                           ,


-- ** isExternallyModified #method:isExternallyModified#

#if defined(ENABLE_OVERLOADING)
    FileIsExternallyModifiedMethodInfo      ,
#endif
    fileIsExternallyModified                ,


-- ** isLocal #method:isLocal#

#if defined(ENABLE_OVERLOADING)
    FileIsLocalMethodInfo                   ,
#endif
    fileIsLocal                             ,


-- ** isReadonly #method:isReadonly#

#if defined(ENABLE_OVERLOADING)
    FileIsReadonlyMethodInfo                ,
#endif
    fileIsReadonly                          ,


-- ** new #method:new#

    fileNew                                 ,


-- ** setLocation #method:setLocation#

#if defined(ENABLE_OVERLOADING)
    FileSetLocationMethodInfo               ,
#endif
    fileSetLocation                         ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    FileCompressionTypePropertyInfo         ,
#endif
#if defined(ENABLE_OVERLOADING)
    fileCompressionType                     ,
#endif
    getFileCompressionType                  ,


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

#if defined(ENABLE_OVERLOADING)
    FileEncodingPropertyInfo                ,
#endif
#if defined(ENABLE_OVERLOADING)
    fileEncoding                            ,
#endif
    getFileEncoding                         ,


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

#if defined(ENABLE_OVERLOADING)
    FileLocationPropertyInfo                ,
#endif
    clearFileLocation                       ,
    constructFileLocation                   ,
#if defined(ENABLE_OVERLOADING)
    fileLocation                            ,
#endif
    getFileLocation                         ,
    setFileLocation                         ,


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

#if defined(ENABLE_OVERLOADING)
    FileNewlineTypePropertyInfo             ,
#endif
#if defined(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).

#if defined(ENABLE_OVERLOADING)
    FileReadOnlyPropertyInfo                ,
#endif
#if defined(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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

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 (SP.ManagedPtr File)
    deriving (File -> File -> Bool
(File -> File -> Bool) -> (File -> File -> Bool) -> Eq File
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: File -> File -> Bool
== :: File -> File -> Bool
$c/= :: File -> File -> Bool
/= :: File -> File -> Bool
Eq)

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

foreign import ccall "gtk_source_file_get_type"
    c_gtk_source_file_get_type :: IO B.Types.GType

instance B.Types.TypedObject File where
    glibType :: IO GType
glibType = IO GType
c_gtk_source_file_get_type

instance B.Types.GObject File

-- | Type class for types which can be safely cast to `File`, for instance with `toFile`.
class (SP.GObject o, O.IsDescendantOf File o) => IsFile o
instance (SP.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 :: (MIO.MonadIO m, IsFile o) => o -> m File
toFile :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m File
toFile = IO File -> m File
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO File -> m File) -> (o -> IO File) -> o -> m File
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr File -> File) -> o -> IO File
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr File -> File
File

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

#if defined(ENABLE_OVERLOADING)
type family ResolveFileMethod (t :: Symbol) (o :: DK.Type) :: DK.Type 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 "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveFileMethod "setLocation" o = FileSetLocationMethodInfo
    ResolveFileMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFileMethod l o = O.MethodResolutionFailed l o

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

#endif

instance (info ~ ResolveFileMethod t File, O.OverloadedMethodInfo info File) => OL.IsLabel t (O.MethodProxy info File) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#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 :: forall (m :: * -> *) o.
(MonadIO m, IsFile o) =>
o -> m CompressionType
getFileCompressionType o
obj = IO CompressionType -> m CompressionType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO CompressionType -> m CompressionType)
-> IO CompressionType -> m CompressionType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO CompressionType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"compression-type"

#if defined(ENABLE_OVERLOADING)
data FileCompressionTypePropertyInfo
instance AttrInfo FileCompressionTypePropertyInfo where
    type AttrAllowedOps FileCompressionTypePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint FileCompressionTypePropertyInfo = IsFile
    type AttrSetTypeConstraint FileCompressionTypePropertyInfo = (~) ()
    type AttrTransferTypeConstraint FileCompressionTypePropertyInfo = (~) ()
    type AttrTransferType FileCompressionTypePropertyInfo = ()
    type AttrGetType FileCompressionTypePropertyInfo = GtkSource.Enums.CompressionType
    type AttrLabel FileCompressionTypePropertyInfo = "compression-type"
    type AttrOrigin FileCompressionTypePropertyInfo = File
    attrGet = getFileCompressionType
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.compressionType"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#g:attr:compressionType"
        })
#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 :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m Encoding
getFileEncoding o
obj = IO Encoding -> m Encoding
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Encoding -> m Encoding) -> IO Encoding -> m Encoding
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Encoding) -> IO Encoding
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getFileEncoding" (IO (Maybe Encoding) -> IO Encoding)
-> IO (Maybe Encoding) -> IO Encoding
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr Encoding -> Encoding)
-> IO (Maybe Encoding)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"encoding" ManagedPtr Encoding -> Encoding
GtkSource.Encoding.Encoding

#if defined(ENABLE_OVERLOADING)
data FileEncodingPropertyInfo
instance AttrInfo FileEncodingPropertyInfo where
    type AttrAllowedOps FileEncodingPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint FileEncodingPropertyInfo = IsFile
    type AttrSetTypeConstraint FileEncodingPropertyInfo = (~) ()
    type AttrTransferTypeConstraint FileEncodingPropertyInfo = (~) ()
    type AttrTransferType FileEncodingPropertyInfo = ()
    type AttrGetType FileEncodingPropertyInfo = GtkSource.Encoding.Encoding
    type AttrLabel FileEncodingPropertyInfo = "encoding"
    type AttrOrigin FileEncodingPropertyInfo = File
    attrGet = getFileEncoding
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.encoding"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#g:attr:encoding"
        })
#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 :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m File
getFileLocation o
obj = IO File -> m File
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe File) -> IO File
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getFileLocation" (IO (Maybe File) -> IO File) -> IO (Maybe File) -> IO File
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr File -> File) -> IO (Maybe File)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"location" ManagedPtr File -> File
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 :: forall (m :: * -> *) o a.
(MonadIO m, IsFile o, IsFile a) =>
o -> a -> m ()
setFileLocation o
obj a
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"location" (a -> Maybe a
forall a. a -> Maybe a
Just a
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, MIO.MonadIO m, Gio.File.IsFile a) => a -> m (GValueConstruct o)
constructFileLocation :: forall o (m :: * -> *) a.
(IsFile o, MonadIO m, IsFile a) =>
a -> m (GValueConstruct o)
constructFileLocation a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"location" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
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 :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m ()
clearFileLocation o
obj = 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
$ o -> String -> Maybe File -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"location" (Maybe File
forall a. Maybe a
Nothing :: Maybe Gio.File.File)

#if defined(ENABLE_OVERLOADING)
data FileLocationPropertyInfo
instance AttrInfo FileLocationPropertyInfo where
    type AttrAllowedOps FileLocationPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint FileLocationPropertyInfo = IsFile
    type AttrSetTypeConstraint FileLocationPropertyInfo = Gio.File.IsFile
    type AttrTransferTypeConstraint FileLocationPropertyInfo = Gio.File.IsFile
    type AttrTransferType FileLocationPropertyInfo = Gio.File.File
    type AttrGetType FileLocationPropertyInfo = Gio.File.File
    type AttrLabel FileLocationPropertyInfo = "location"
    type AttrOrigin FileLocationPropertyInfo = File
    attrGet = getFileLocation
    attrSet = setFileLocation
    attrTransfer _ v = do
        unsafeCastTo Gio.File.File v
    attrConstruct = constructFileLocation
    attrClear = clearFileLocation
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.location"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#g:attr:location"
        })
#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 :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m NewlineType
getFileNewlineType o
obj = IO NewlineType -> m NewlineType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO NewlineType -> m NewlineType)
-> IO NewlineType -> m NewlineType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO NewlineType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"newline-type"

#if defined(ENABLE_OVERLOADING)
data FileNewlineTypePropertyInfo
instance AttrInfo FileNewlineTypePropertyInfo where
    type AttrAllowedOps FileNewlineTypePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint FileNewlineTypePropertyInfo = IsFile
    type AttrSetTypeConstraint FileNewlineTypePropertyInfo = (~) ()
    type AttrTransferTypeConstraint FileNewlineTypePropertyInfo = (~) ()
    type AttrTransferType FileNewlineTypePropertyInfo = ()
    type AttrGetType FileNewlineTypePropertyInfo = GtkSource.Enums.NewlineType
    type AttrLabel FileNewlineTypePropertyInfo = "newline-type"
    type AttrOrigin FileNewlineTypePropertyInfo = File
    attrGet = getFileNewlineType
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.newlineType"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#g:attr:newlineType"
        })
#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 :: forall (m :: * -> *) o. (MonadIO m, IsFile o) => o -> m Bool
getFileReadOnly o
obj = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj String
"read-only"

#if defined(ENABLE_OVERLOADING)
data FileReadOnlyPropertyInfo
instance AttrInfo FileReadOnlyPropertyInfo where
    type AttrAllowedOps FileReadOnlyPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint FileReadOnlyPropertyInfo = IsFile
    type AttrSetTypeConstraint FileReadOnlyPropertyInfo = (~) ()
    type AttrTransferTypeConstraint FileReadOnlyPropertyInfo = (~) ()
    type AttrTransferType FileReadOnlyPropertyInfo = ()
    type AttrGetType FileReadOnlyPropertyInfo = Bool
    type AttrLabel FileReadOnlyPropertyInfo = "read-only"
    type AttrOrigin FileReadOnlyPropertyInfo = File
    attrGet = getFileReadOnly
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.readOnly"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#g:attr:readOnly"
        })
#endif

#if defined(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, DK.Type)])
#endif

#if defined(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 defined(ENABLE_OVERLOADING)
type instance O.SignalList File = FileSignalList
type FileSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#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./
fileNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m File
    -- ^ __Returns:__ a new t'GI.GtkSource.Objects.File.File' object.
fileNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m File
fileNew  = IO File -> m File
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
result <- IO (Ptr File)
gtk_source_file_new
    Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fileNew" Ptr File
result
    File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
File) Ptr File
result
    File -> IO File
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'

#if defined(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
--           , argCallbackUserData = 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.
-- 
-- t'GI.GtkSource.Objects.File.File' doesn\'t create a t'GI.Gio.Objects.FileMonitor.FileMonitor' to track those properties, so
-- this function needs to be called instead. Creating lots of t'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 [method/@file@/.is_local].
fileCheckFileOnDisk ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m ()
fileCheckFileOnDisk :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m ()
fileCheckFileOnDisk a
file = 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 File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    Ptr File -> IO ()
gtk_source_file_check_file_on_disk Ptr File
file'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

instance O.OverloadedMethodInfo FileCheckFileOnDiskMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileCheckFileOnDisk",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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./
fileGetCompressionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m GtkSource.Enums.CompressionType
    -- ^ __Returns:__ the compression type.
fileGetCompressionType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m CompressionType
fileGetCompressionType a
file = IO CompressionType -> m CompressionType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CompressionType -> m CompressionType)
-> IO CompressionType -> m CompressionType
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CUInt
result <- Ptr File -> IO CUInt
gtk_source_file_get_compression_type Ptr File
file'
    let result' :: CompressionType
result' = (Int -> CompressionType
forall a. Enum a => Int -> a
toEnum (Int -> CompressionType)
-> (CUInt -> Int) -> CUInt -> CompressionType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    CompressionType -> IO CompressionType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CompressionType
result'

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

instance O.OverloadedMethodInfo FileGetCompressionTypeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileGetCompressionType",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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 'P.Nothing'. After a successful file loading or saving
-- operation, the encoding is non-'P.Nothing'.
fileGetEncoding ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m GtkSource.Encoding.Encoding
    -- ^ __Returns:__ the character encoding.
fileGetEncoding :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Encoding
fileGetEncoding a
file = IO Encoding -> m Encoding
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Encoding -> m Encoding) -> IO Encoding -> m Encoding
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    Ptr Encoding
result <- Ptr File -> IO (Ptr Encoding)
gtk_source_file_get_encoding Ptr File
file'
    Text -> Ptr Encoding -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fileGetEncoding" Ptr Encoding
result
    Encoding
result' <- ((ManagedPtr Encoding -> Encoding) -> Ptr Encoding -> IO Encoding
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Encoding -> Encoding
GtkSource.Encoding.Encoding) Ptr Encoding
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Encoding -> IO Encoding
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Encoding
result'

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

instance O.OverloadedMethodInfo FileGetEncodingMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileGetEncoding",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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./
fileGetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m Gio.File.File
    -- ^ __Returns:__ the t'GI.Gio.Interfaces.File.File'.
fileGetLocation :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m File
fileGetLocation a
file = IO File -> m File
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    Ptr File
result <- Ptr File -> IO (Ptr File)
gtk_source_file_get_location Ptr File
file'
    Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fileGetLocation" Ptr File
result
    File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) Ptr File
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    File -> IO File
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'

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

instance O.OverloadedMethodInfo FileGetLocationMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileGetLocation",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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./
fileGetNewlineType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m GtkSource.Enums.NewlineType
    -- ^ __Returns:__ the newline type.
fileGetNewlineType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m NewlineType
fileGetNewlineType a
file = IO NewlineType -> m NewlineType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NewlineType -> m NewlineType)
-> IO NewlineType -> m NewlineType
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CUInt
result <- Ptr File -> IO CUInt
gtk_source_file_get_newline_type Ptr File
file'
    let result' :: NewlineType
result' = (Int -> NewlineType
forall a. Enum a => Int -> a
toEnum (Int -> NewlineType) -> (CUInt -> Int) -> CUInt -> NewlineType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    NewlineType -> IO NewlineType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return NewlineType
result'

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

instance O.OverloadedMethodInfo FileGetNewlineTypeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileGetNewlineType",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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
-- [property/@file@/:location] is 'P.Nothing', returns 'P.False'.
-- 
-- To have an up-to-date value, you must first call
-- [method/@file@/.check_file_on_disk].
fileIsDeleted ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m Bool
    -- ^ __Returns:__ whether the file has been deleted.
fileIsDeleted :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Bool
fileIsDeleted a
file = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CInt
result <- Ptr File -> IO CInt
gtk_source_file_is_deleted Ptr File
file'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

instance O.OverloadedMethodInfo FileIsDeletedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileIsDeleted",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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
-- [property/@file@/:location] is 'P.Nothing', returns 'P.False'.
-- 
-- To have an up-to-date value, you must first call
-- [method/@file@/.check_file_on_disk].
fileIsExternallyModified ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m Bool
    -- ^ __Returns:__ whether the file is externally modified.
fileIsExternallyModified :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Bool
fileIsExternallyModified a
file = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CInt
result <- Ptr File -> IO CInt
gtk_source_file_is_externally_modified Ptr File
file'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

instance O.OverloadedMethodInfo FileIsExternallyModifiedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileIsExternallyModified",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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 [property/@file@/:location] is 'P.Nothing',
-- returns 'P.False'.
fileIsLocal ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m Bool
    -- ^ __Returns:__ whether the file is local.
fileIsLocal :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Bool
fileIsLocal a
file = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CInt
result <- Ptr File -> IO CInt
gtk_source_file_is_local Ptr File
file'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

instance O.OverloadedMethodInfo FileIsLocalMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileIsLocal",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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
-- [property/@file@/:location] is 'P.Nothing', returns 'P.False'.
-- 
-- To have an up-to-date value, you must first call
-- [method/@file@/.check_file_on_disk].
fileIsReadonly ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> m Bool
    -- ^ __Returns:__ whether the file is read-only.
fileIsReadonly :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Bool
fileIsReadonly a
file = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    CInt
result <- Ptr File -> IO CInt
gtk_source_file_is_readonly Ptr File
file'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

instance O.OverloadedMethodInfo FileIsReadonlyMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileIsReadonly",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v: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
--           , argCallbackUserData = 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
--           , argCallbackUserData = 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.
fileSetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.File.IsFile b) =>
    a
    -- ^ /@file@/: a t'GI.GtkSource.Objects.File.File'.
    -> Maybe (b)
    -- ^ /@location@/: the new t'GI.Gio.Interfaces.File.File', or 'P.Nothing'.
    -> m ()
fileSetLocation :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a -> Maybe b -> m ()
fileSetLocation a
file Maybe b
location = 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 File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
    Ptr File
maybeLocation <- case Maybe b
location of
        Maybe b
Nothing -> Ptr File -> IO (Ptr File)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr File
forall a. Ptr a
nullPtr
        Just b
jLocation -> do
            Ptr File
jLocation' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jLocation
            Ptr File -> IO (Ptr File)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr File
jLocation'
    Ptr File -> Ptr File -> IO ()
gtk_source_file_set_location Ptr File
file' Ptr File
maybeLocation
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
location b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

instance O.OverloadedMethodInfo FileSetLocationMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GtkSource.Objects.File.fileSetLocation",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtksource-5.0.0/docs/GI-GtkSource-Objects-File.html#v:fileSetLocation"
        })


#endif