packages feed

gi-glib-0.2.46.13: GI/GLib/Structs/TestConfig.hs


{- |
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.TestConfig
    ( 

-- * Exported types
    TestConfig(..)                          ,
    newZeroTestConfig                       ,
    noTestConfig                            ,


 -- * Properties
-- ** TestInitialized
    testConfigReadTestInitialized           ,


-- ** TestPerf
    testConfigReadTestPerf                  ,


-- ** TestQuick
    testConfigReadTestQuick                 ,


-- ** TestQuiet
    testConfigReadTestQuiet                 ,


-- ** TestUndefined
    testConfigReadTestUndefined             ,


-- ** TestVerbose
    testConfigReadTestVerbose               ,




    ) 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 TestConfig = TestConfig (ForeignPtr TestConfig)
-- | Construct a `TestConfig` struct initialized to zero.
newZeroTestConfig :: MonadIO m => m TestConfig
newZeroTestConfig = liftIO $ callocBytes 24 >>= wrapPtr TestConfig

noTestConfig :: Maybe TestConfig
noTestConfig = Nothing

testConfigReadTestInitialized :: TestConfig -> IO Bool
testConfigReadTestInitialized s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CInt
    let val' = (/= 0) val
    return val'

testConfigReadTestQuick :: TestConfig -> IO Bool
testConfigReadTestQuick s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO CInt
    let val' = (/= 0) val
    return val'

testConfigReadTestPerf :: TestConfig -> IO Bool
testConfigReadTestPerf s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CInt
    let val' = (/= 0) val
    return val'

testConfigReadTestVerbose :: TestConfig -> IO Bool
testConfigReadTestVerbose s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO CInt
    let val' = (/= 0) val
    return val'

testConfigReadTestQuiet :: TestConfig -> IO Bool
testConfigReadTestQuiet s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CInt
    let val' = (/= 0) val
    return val'

testConfigReadTestUndefined :: TestConfig -> IO Bool
testConfigReadTestUndefined s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO CInt
    let val' = (/= 0) val
    return val'

type family ResolveTestConfigMethod (t :: Symbol) (o :: *) :: * where
    ResolveTestConfigMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveTestConfigMethod t TestConfig, MethodInfo info TestConfig p) => IsLabelProxy t (TestConfig -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTestConfigMethod t TestConfig, MethodInfo info TestConfig p) => IsLabel t (TestConfig -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif