{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) Acts as a lightweight registry for possible valid file attributes. The registry stores Key-Value pair formats as #GFileAttributeInfos. -} module GI.Gio.Structs.FileAttributeInfoList ( -- * Exported types FileAttributeInfoList(..) , noFileAttributeInfoList , -- * Methods -- ** fileAttributeInfoListAdd fileAttributeInfoListAdd , -- ** fileAttributeInfoListDup fileAttributeInfoListDup , -- ** fileAttributeInfoListLookup fileAttributeInfoListLookup , -- ** fileAttributeInfoListNew fileAttributeInfoListNew , -- ** fileAttributeInfoListRef fileAttributeInfoListRef , -- ** fileAttributeInfoListUnref fileAttributeInfoListUnref , -- * Properties -- ** Infos fileAttributeInfoListReadInfos , -- ** NInfos fileAttributeInfoListReadNInfos , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gio.Types import GI.Gio.Callbacks newtype FileAttributeInfoList = FileAttributeInfoList (ForeignPtr FileAttributeInfoList) foreign import ccall "g_file_attribute_info_list_get_type" c_g_file_attribute_info_list_get_type :: IO GType instance BoxedObject FileAttributeInfoList where boxedType _ = c_g_file_attribute_info_list_get_type noFileAttributeInfoList :: Maybe FileAttributeInfoList noFileAttributeInfoList = Nothing fileAttributeInfoListReadInfos :: FileAttributeInfoList -> IO FileAttributeInfo fileAttributeInfoListReadInfos s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO (Ptr FileAttributeInfo) val' <- (newPtr 16 FileAttributeInfo) val return val' fileAttributeInfoListReadNInfos :: FileAttributeInfoList -> IO Int32 fileAttributeInfoListReadNInfos s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val -- method FileAttributeInfoList::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Gio" "FileAttributeInfoList" -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_new" g_file_attribute_info_list_new :: IO (Ptr FileAttributeInfoList) fileAttributeInfoListNew :: (MonadIO m) => m FileAttributeInfoList fileAttributeInfoListNew = liftIO $ do result <- g_file_attribute_info_list_new checkUnexpectedReturnNULL "g_file_attribute_info_list_new" result result' <- (wrapBoxed FileAttributeInfoList) result return result' -- method FileAttributeInfoList::add -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gio" "FileAttributeType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "FileAttributeInfoFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gio" "FileAttributeType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "FileAttributeInfoFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_add" g_file_attribute_info_list_add :: Ptr FileAttributeInfoList -> -- _obj : TInterface "Gio" "FileAttributeInfoList" CString -> -- name : TBasicType TUTF8 CUInt -> -- type : TInterface "Gio" "FileAttributeType" CUInt -> -- flags : TInterface "Gio" "FileAttributeInfoFlags" IO () fileAttributeInfoListAdd :: (MonadIO m) => FileAttributeInfoList -> -- _obj T.Text -> -- name FileAttributeType -> -- type [FileAttributeInfoFlags] -> -- flags m () fileAttributeInfoListAdd _obj name type_ flags = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj name' <- textToCString name let type_' = (fromIntegral . fromEnum) type_ let flags' = gflagsToWord flags g_file_attribute_info_list_add _obj' name' type_' flags' touchManagedPtr _obj freeMem name' return () -- method FileAttributeInfoList::dup -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "FileAttributeInfoList" -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_dup" g_file_attribute_info_list_dup :: Ptr FileAttributeInfoList -> -- _obj : TInterface "Gio" "FileAttributeInfoList" IO (Ptr FileAttributeInfoList) fileAttributeInfoListDup :: (MonadIO m) => FileAttributeInfoList -> -- _obj m FileAttributeInfoList fileAttributeInfoListDup _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_file_attribute_info_list_dup _obj' checkUnexpectedReturnNULL "g_file_attribute_info_list_dup" result result' <- (wrapBoxed FileAttributeInfoList) result touchManagedPtr _obj return result' -- method FileAttributeInfoList::lookup -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "FileAttributeInfo" -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_lookup" g_file_attribute_info_list_lookup :: Ptr FileAttributeInfoList -> -- _obj : TInterface "Gio" "FileAttributeInfoList" CString -> -- name : TBasicType TUTF8 IO (Ptr FileAttributeInfo) fileAttributeInfoListLookup :: (MonadIO m) => FileAttributeInfoList -> -- _obj T.Text -> -- name m FileAttributeInfo fileAttributeInfoListLookup _obj name = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj name' <- textToCString name result <- g_file_attribute_info_list_lookup _obj' name' checkUnexpectedReturnNULL "g_file_attribute_info_list_lookup" result result' <- (newPtr 16 FileAttributeInfo) result touchManagedPtr _obj freeMem name' return result' -- method FileAttributeInfoList::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "FileAttributeInfoList" -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_ref" g_file_attribute_info_list_ref :: Ptr FileAttributeInfoList -> -- _obj : TInterface "Gio" "FileAttributeInfoList" IO (Ptr FileAttributeInfoList) fileAttributeInfoListRef :: (MonadIO m) => FileAttributeInfoList -> -- _obj m FileAttributeInfoList fileAttributeInfoListRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_file_attribute_info_list_ref _obj' checkUnexpectedReturnNULL "g_file_attribute_info_list_ref" result result' <- (wrapBoxed FileAttributeInfoList) result touchManagedPtr _obj return result' -- method FileAttributeInfoList::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileAttributeInfoList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_file_attribute_info_list_unref" g_file_attribute_info_list_unref :: Ptr FileAttributeInfoList -> -- _obj : TInterface "Gio" "FileAttributeInfoList" IO () fileAttributeInfoListUnref :: (MonadIO m) => FileAttributeInfoList -> -- _obj m () fileAttributeInfoListUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_file_attribute_info_list_unref _obj' touchManagedPtr _obj return ()