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

Contains the public fields of a GByteArray.
-}

module GI.GLib.Structs.ByteArray
    ( 

-- * Exported types
    ByteArray(..)                           ,
    noByteArray                             ,


 -- * Properties
-- ** Data
    byteArrayReadData                       ,


-- ** Len
    byteArrayReadLen                        ,




    ) 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.GLib.Types
import GI.GLib.Callbacks

newtype ByteArray = ByteArray (ForeignPtr ByteArray)
foreign import ccall "g_byte_array_get_type" c_g_byte_array_get_type :: 
    IO GType

instance BoxedObject ByteArray where
    boxedType _ = c_g_byte_array_get_type

noByteArray :: Maybe ByteArray
noByteArray = Nothing

byteArrayReadData :: ByteArray -> IO Word8
byteArrayReadData s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Word8
    return val

byteArrayReadLen :: ByteArray -> IO Word32
byteArrayReadLen s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Word32
    return val