#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Structs.FileAttributeInfo
(
FileAttributeInfo(..) ,
newZeroFileAttributeInfo ,
noFileAttributeInfo ,
#if ENABLE_OVERLOADING
fileAttributeInfo_flags ,
#endif
getFileAttributeInfoFlags ,
setFileAttributeInfoFlags ,
clearFileAttributeInfoName ,
#if ENABLE_OVERLOADING
fileAttributeInfo_name ,
#endif
getFileAttributeInfoName ,
setFileAttributeInfoName ,
#if ENABLE_OVERLOADING
fileAttributeInfo_type ,
#endif
getFileAttributeInfoType ,
setFileAttributeInfoType ,
) 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 {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
newtype FileAttributeInfo = FileAttributeInfo (ManagedPtr FileAttributeInfo)
instance WrappedPtr FileAttributeInfo where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr FileAttributeInfo)
wrappedPtrFree = Just ptr_to_g_free
newZeroFileAttributeInfo :: MonadIO m => m FileAttributeInfo
newZeroFileAttributeInfo = liftIO $ wrappedPtrCalloc >>= wrapPtr FileAttributeInfo
instance tag ~ 'AttrSet => Constructible FileAttributeInfo tag where
new _ attrs = do
o <- newZeroFileAttributeInfo
GI.Attributes.set o attrs
return o
noFileAttributeInfo :: Maybe FileAttributeInfo
noFileAttributeInfo = Nothing
getFileAttributeInfoName :: MonadIO m => FileAttributeInfo -> m (Maybe T.Text)
getFileAttributeInfoName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setFileAttributeInfoName :: MonadIO m => FileAttributeInfo -> CString -> m ()
setFileAttributeInfoName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
clearFileAttributeInfoName :: MonadIO m => FileAttributeInfo -> m ()
clearFileAttributeInfoName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data FileAttributeInfoNameFieldInfo
instance AttrInfo FileAttributeInfoNameFieldInfo where
type AttrAllowedOps FileAttributeInfoNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FileAttributeInfoNameFieldInfo = (~) CString
type AttrBaseTypeConstraint FileAttributeInfoNameFieldInfo = (~) FileAttributeInfo
type AttrGetType FileAttributeInfoNameFieldInfo = Maybe T.Text
type AttrLabel FileAttributeInfoNameFieldInfo = "name"
type AttrOrigin FileAttributeInfoNameFieldInfo = FileAttributeInfo
attrGet _ = getFileAttributeInfoName
attrSet _ = setFileAttributeInfoName
attrConstruct = undefined
attrClear _ = clearFileAttributeInfoName
fileAttributeInfo_name :: AttrLabelProxy "name"
fileAttributeInfo_name = AttrLabelProxy
#endif
getFileAttributeInfoType :: MonadIO m => FileAttributeInfo -> m Gio.Enums.FileAttributeType
getFileAttributeInfoType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setFileAttributeInfoType :: MonadIO m => FileAttributeInfo -> Gio.Enums.FileAttributeType -> m ()
setFileAttributeInfoType s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 8) (val' :: CUInt)
#if ENABLE_OVERLOADING
data FileAttributeInfoTypeFieldInfo
instance AttrInfo FileAttributeInfoTypeFieldInfo where
type AttrAllowedOps FileAttributeInfoTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint FileAttributeInfoTypeFieldInfo = (~) Gio.Enums.FileAttributeType
type AttrBaseTypeConstraint FileAttributeInfoTypeFieldInfo = (~) FileAttributeInfo
type AttrGetType FileAttributeInfoTypeFieldInfo = Gio.Enums.FileAttributeType
type AttrLabel FileAttributeInfoTypeFieldInfo = "type"
type AttrOrigin FileAttributeInfoTypeFieldInfo = FileAttributeInfo
attrGet _ = getFileAttributeInfoType
attrSet _ = setFileAttributeInfoType
attrConstruct = undefined
attrClear _ = undefined
fileAttributeInfo_type :: AttrLabelProxy "type"
fileAttributeInfo_type = AttrLabelProxy
#endif
getFileAttributeInfoFlags :: MonadIO m => FileAttributeInfo -> m [Gio.Flags.FileAttributeInfoFlags]
getFileAttributeInfoFlags s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO CUInt
let val' = wordToGFlags val
return val'
setFileAttributeInfoFlags :: MonadIO m => FileAttributeInfo -> [Gio.Flags.FileAttributeInfoFlags] -> m ()
setFileAttributeInfoFlags s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gflagsToWord val
poke (ptr `plusPtr` 12) (val' :: CUInt)
#if ENABLE_OVERLOADING
data FileAttributeInfoFlagsFieldInfo
instance AttrInfo FileAttributeInfoFlagsFieldInfo where
type AttrAllowedOps FileAttributeInfoFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint FileAttributeInfoFlagsFieldInfo = (~) [Gio.Flags.FileAttributeInfoFlags]
type AttrBaseTypeConstraint FileAttributeInfoFlagsFieldInfo = (~) FileAttributeInfo
type AttrGetType FileAttributeInfoFlagsFieldInfo = [Gio.Flags.FileAttributeInfoFlags]
type AttrLabel FileAttributeInfoFlagsFieldInfo = "flags"
type AttrOrigin FileAttributeInfoFlagsFieldInfo = FileAttributeInfo
attrGet _ = getFileAttributeInfoFlags
attrSet _ = setFileAttributeInfoFlags
attrConstruct = undefined
attrClear _ = undefined
fileAttributeInfo_flags :: AttrLabelProxy "flags"
fileAttributeInfo_flags = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList FileAttributeInfo
type instance O.AttributeList FileAttributeInfo = FileAttributeInfoAttributeList
type FileAttributeInfoAttributeList = ('[ '("name", FileAttributeInfoNameFieldInfo), '("type", FileAttributeInfoTypeFieldInfo), '("flags", FileAttributeInfoFlagsFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveFileAttributeInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveFileAttributeInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileAttributeInfoMethod t FileAttributeInfo, O.MethodInfo info FileAttributeInfo p) => OL.IsLabel t (FileAttributeInfo -> 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