{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.TestLogMsg
(
TestLogMsg(..) ,
newZeroTestLogMsg ,
noTestLogMsg ,
#if defined(ENABLE_OVERLOADING)
ResolveTestLogMsgMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
TestLogMsgFreeMethodInfo ,
#endif
testLogMsgFree ,
getTestLogMsgLogType ,
setTestLogMsgLogType ,
#if defined(ENABLE_OVERLOADING)
testLogMsg_logType ,
#endif
getTestLogMsgNNums ,
setTestLogMsgNNums ,
#if defined(ENABLE_OVERLOADING)
testLogMsg_nNums ,
#endif
getTestLogMsgNStrings ,
setTestLogMsgNStrings ,
#if defined(ENABLE_OVERLOADING)
testLogMsg_nStrings ,
#endif
clearTestLogMsgStrings ,
getTestLogMsgStrings ,
setTestLogMsgStrings ,
#if defined(ENABLE_OVERLOADING)
testLogMsg_strings ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
newtype TestLogMsg = TestLogMsg (ManagedPtr TestLogMsg)
deriving (Eq)
instance WrappedPtr TestLogMsg where
wrappedPtrCalloc = callocBytes 20
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 20 >=> wrapPtr TestLogMsg)
wrappedPtrFree = Just ptr_to_g_free
newZeroTestLogMsg :: MonadIO m => m TestLogMsg
newZeroTestLogMsg = liftIO $ wrappedPtrCalloc >>= wrapPtr TestLogMsg
instance tag ~ 'AttrSet => Constructible TestLogMsg tag where
new _ attrs = do
o <- newZeroTestLogMsg
GI.Attributes.set o attrs
return o
noTestLogMsg :: Maybe TestLogMsg
noTestLogMsg = Nothing
getTestLogMsgLogType :: MonadIO m => TestLogMsg -> m GLib.Enums.TestLogType
getTestLogMsgLogType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setTestLogMsgLogType :: MonadIO m => TestLogMsg -> GLib.Enums.TestLogType -> m ()
setTestLogMsgLogType s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 0) (val' :: CUInt)
#if defined(ENABLE_OVERLOADING)
data TestLogMsgLogTypeFieldInfo
instance AttrInfo TestLogMsgLogTypeFieldInfo where
type AttrBaseTypeConstraint TestLogMsgLogTypeFieldInfo = (~) TestLogMsg
type AttrAllowedOps TestLogMsgLogTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TestLogMsgLogTypeFieldInfo = (~) GLib.Enums.TestLogType
type AttrTransferTypeConstraint TestLogMsgLogTypeFieldInfo = (~)GLib.Enums.TestLogType
type AttrTransferType TestLogMsgLogTypeFieldInfo = GLib.Enums.TestLogType
type AttrGetType TestLogMsgLogTypeFieldInfo = GLib.Enums.TestLogType
type AttrLabel TestLogMsgLogTypeFieldInfo = "log_type"
type AttrOrigin TestLogMsgLogTypeFieldInfo = TestLogMsg
attrGet = getTestLogMsgLogType
attrSet = setTestLogMsgLogType
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
testLogMsg_logType :: AttrLabelProxy "logType"
testLogMsg_logType = AttrLabelProxy
#endif
getTestLogMsgNStrings :: MonadIO m => TestLogMsg -> m Word32
getTestLogMsgNStrings s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO Word32
return val
setTestLogMsgNStrings :: MonadIO m => TestLogMsg -> Word32 -> m ()
setTestLogMsgNStrings s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 4) (val :: Word32)
#if defined(ENABLE_OVERLOADING)
data TestLogMsgNStringsFieldInfo
instance AttrInfo TestLogMsgNStringsFieldInfo where
type AttrBaseTypeConstraint TestLogMsgNStringsFieldInfo = (~) TestLogMsg
type AttrAllowedOps TestLogMsgNStringsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TestLogMsgNStringsFieldInfo = (~) Word32
type AttrTransferTypeConstraint TestLogMsgNStringsFieldInfo = (~)Word32
type AttrTransferType TestLogMsgNStringsFieldInfo = Word32
type AttrGetType TestLogMsgNStringsFieldInfo = Word32
type AttrLabel TestLogMsgNStringsFieldInfo = "n_strings"
type AttrOrigin TestLogMsgNStringsFieldInfo = TestLogMsg
attrGet = getTestLogMsgNStrings
attrSet = setTestLogMsgNStrings
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
testLogMsg_nStrings :: AttrLabelProxy "nStrings"
testLogMsg_nStrings = AttrLabelProxy
#endif
getTestLogMsgStrings :: MonadIO m => TestLogMsg -> m (Maybe T.Text)
getTestLogMsgStrings s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setTestLogMsgStrings :: MonadIO m => TestLogMsg -> CString -> m ()
setTestLogMsgStrings s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearTestLogMsgStrings :: MonadIO m => TestLogMsg -> m ()
clearTestLogMsgStrings s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data TestLogMsgStringsFieldInfo
instance AttrInfo TestLogMsgStringsFieldInfo where
type AttrBaseTypeConstraint TestLogMsgStringsFieldInfo = (~) TestLogMsg
type AttrAllowedOps TestLogMsgStringsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TestLogMsgStringsFieldInfo = (~) CString
type AttrTransferTypeConstraint TestLogMsgStringsFieldInfo = (~)CString
type AttrTransferType TestLogMsgStringsFieldInfo = CString
type AttrGetType TestLogMsgStringsFieldInfo = Maybe T.Text
type AttrLabel TestLogMsgStringsFieldInfo = "strings"
type AttrOrigin TestLogMsgStringsFieldInfo = TestLogMsg
attrGet = getTestLogMsgStrings
attrSet = setTestLogMsgStrings
attrConstruct = undefined
attrClear = clearTestLogMsgStrings
attrTransfer _ v = do
return v
testLogMsg_strings :: AttrLabelProxy "strings"
testLogMsg_strings = AttrLabelProxy
#endif
getTestLogMsgNNums :: MonadIO m => TestLogMsg -> m Word32
getTestLogMsgNNums s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Word32
return val
setTestLogMsgNNums :: MonadIO m => TestLogMsg -> Word32 -> m ()
setTestLogMsgNNums s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Word32)
#if defined(ENABLE_OVERLOADING)
data TestLogMsgNNumsFieldInfo
instance AttrInfo TestLogMsgNNumsFieldInfo where
type AttrBaseTypeConstraint TestLogMsgNNumsFieldInfo = (~) TestLogMsg
type AttrAllowedOps TestLogMsgNNumsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TestLogMsgNNumsFieldInfo = (~) Word32
type AttrTransferTypeConstraint TestLogMsgNNumsFieldInfo = (~)Word32
type AttrTransferType TestLogMsgNNumsFieldInfo = Word32
type AttrGetType TestLogMsgNNumsFieldInfo = Word32
type AttrLabel TestLogMsgNNumsFieldInfo = "n_nums"
type AttrOrigin TestLogMsgNNumsFieldInfo = TestLogMsg
attrGet = getTestLogMsgNNums
attrSet = setTestLogMsgNNums
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
testLogMsg_nNums :: AttrLabelProxy "nNums"
testLogMsg_nNums = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TestLogMsg
type instance O.AttributeList TestLogMsg = TestLogMsgAttributeList
type TestLogMsgAttributeList = ('[ '("logType", TestLogMsgLogTypeFieldInfo), '("nStrings", TestLogMsgNStringsFieldInfo), '("strings", TestLogMsgStringsFieldInfo), '("nNums", TestLogMsgNNumsFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_test_log_msg_free" g_test_log_msg_free ::
Ptr TestLogMsg ->
IO ()
testLogMsgFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
TestLogMsg
-> m ()
testLogMsgFree tmsg = liftIO $ do
tmsg' <- unsafeManagedPtrGetPtr tmsg
g_test_log_msg_free tmsg'
touchManagedPtr tmsg
return ()
#if defined(ENABLE_OVERLOADING)
data TestLogMsgFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo TestLogMsgFreeMethodInfo TestLogMsg signature where
overloadedMethod = testLogMsgFree
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveTestLogMsgMethod (t :: Symbol) (o :: *) :: * where
ResolveTestLogMsgMethod "free" o = TestLogMsgFreeMethodInfo
ResolveTestLogMsgMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTestLogMsgMethod t TestLogMsg, O.MethodInfo info TestLogMsg p) => OL.IsLabel t (TestLogMsg -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif