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

module GI.GLib.Structs.TestLogMsg
    ( 

-- * Exported types
    TestLogMsg(..)                          ,
    noTestLogMsg                            ,


 -- * Methods
-- ** testLogMsgFree
    testLogMsgFree                          ,




 -- * Properties
-- ** LogType
    testLogMsgReadLogType                   ,


-- ** NNums
    testLogMsgReadNNums                     ,


-- ** NStrings
    testLogMsgReadNStrings                  ,


-- ** Nums
    testLogMsgReadNums                      ,


-- ** Strings
    testLogMsgReadStrings                   ,




    ) 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 TestLogMsg = TestLogMsg (ForeignPtr TestLogMsg)
noTestLogMsg :: Maybe TestLogMsg
noTestLogMsg = Nothing

testLogMsgReadLogType :: TestLogMsg -> IO TestLogType
testLogMsgReadLogType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

testLogMsgReadNStrings :: TestLogMsg -> IO Word32
testLogMsgReadNStrings s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO Word32
    return val

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

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

testLogMsgReadNums :: TestLogMsg -> IO Int64
testLogMsgReadNums s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO Int64
    return val

-- method TestLogMsg::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "TestLogMsg", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "TestLogMsg", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_test_log_msg_free" g_test_log_msg_free :: 
    Ptr TestLogMsg ->                       -- _obj : TInterface "GLib" "TestLogMsg"
    IO ()


testLogMsgFree ::
    (MonadIO m) =>
    TestLogMsg ->                           -- _obj
    m ()
testLogMsgFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_test_log_msg_free _obj'
    touchManagedPtr _obj
    return ()