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

Information about a specific attribute.
-}

module GI.Gio.Structs.FileAttributeInfo
    ( 

-- * Exported types
    FileAttributeInfo(..)                   ,
    noFileAttributeInfo                     ,


 -- * Properties
-- ** Flags
    fileAttributeInfoReadFlags              ,


-- ** Name
    fileAttributeInfoReadName               ,


-- ** Type
    fileAttributeInfoReadType               ,




    ) 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 FileAttributeInfo = FileAttributeInfo (ForeignPtr FileAttributeInfo)
noFileAttributeInfo :: Maybe FileAttributeInfo
noFileAttributeInfo = Nothing

fileAttributeInfoReadName :: FileAttributeInfo -> IO T.Text
fileAttributeInfoReadName s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CString
    val' <- cstringToText val
    return val'

fileAttributeInfoReadType :: FileAttributeInfo -> IO FileAttributeType
fileAttributeInfoReadType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

fileAttributeInfoReadFlags :: FileAttributeInfo -> IO [FileAttributeInfoFlags]
fileAttributeInfoReadFlags s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO CUInt
    let val' = wordToGFlags val
    return val'