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

A structure holding information for a specific type.
It is filled in by the g_type_query() function.
-}

module GI.GObject.Structs.TypeQuery
    ( 

-- * Exported types
    TypeQuery(..)                           ,
    noTypeQuery                             ,


 -- * Properties
-- ** ClassSize
    typeQueryReadClassSize                  ,


-- ** InstanceSize
    typeQueryReadInstanceSize               ,


-- ** Type
    typeQueryReadType                       ,


-- ** TypeName
    typeQueryReadTypeName                   ,




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

newtype TypeQuery = TypeQuery (ForeignPtr TypeQuery)
noTypeQuery :: Maybe TypeQuery
noTypeQuery = Nothing

typeQueryReadType :: TypeQuery -> IO GType
typeQueryReadType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CGType
    let val' = GType val
    return val'

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

typeQueryReadClassSize :: TypeQuery -> IO Word32
typeQueryReadClassSize s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word32
    return val

typeQueryReadInstanceSize :: TypeQuery -> IO Word32
typeQueryReadInstanceSize s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val