dear-imgui-raw-internal-1.0.0: src/DearImGui/Raw/Internal/ImGuiDataTypeInfo.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.Internal.ImGuiDataTypeInfo
( ImGuiDataTypeInfo (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import Foreign.C.String (CString)
import Foreign.C.Types
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, plusPtr)
import Foreign.Storable (Storable (..))
import GHC.Records (HasField (..))
import Prelude hiding (init)
#include "dcimgui_nodefaultargfunctions_internal.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_nodefaultargfunctions_internal.h" "ImGuiDataTypeInfo" #-} ImGuiDataTypeInfo = ImGuiDataTypeInfo
{ size :: CSize
, name :: CString
, printFmt :: CString
, scanFmt :: CString
}
deriving (Eq, Show)
instance Storable ImGuiDataTypeInfo where
sizeOf _ = #{size ImGuiDataTypeInfo}
alignment _ = #{alignment ImGuiDataTypeInfo}
peek p = ImGuiDataTypeInfo <$> #{peek ImGuiDataTypeInfo, Size} p <*> #{peek ImGuiDataTypeInfo, Name} p <*> #{peek ImGuiDataTypeInfo, PrintFmt} p <*> #{peek ImGuiDataTypeInfo, ScanFmt} p
poke p v = do
#{poke ImGuiDataTypeInfo, Size} p v.size
#{poke ImGuiDataTypeInfo, Name} p v.name
#{poke ImGuiDataTypeInfo, PrintFmt} p v.printFmt
#{poke ImGuiDataTypeInfo, ScanFmt} p v.scanFmt
instance HasField "size" (Ptr ImGuiDataTypeInfo) (Ptr CSize) where
getField = #{ptr ImGuiDataTypeInfo, Size}
instance HasField "name" (Ptr ImGuiDataTypeInfo) (Ptr CString) where
getField = #{ptr ImGuiDataTypeInfo, Name}
instance HasField "printFmt" (Ptr ImGuiDataTypeInfo) (Ptr CString) where
getField = #{ptr ImGuiDataTypeInfo, PrintFmt}
instance HasField "scanFmt" (Ptr ImGuiDataTypeInfo) (Ptr CString) where
getField = #{ptr ImGuiDataTypeInfo, ScanFmt}
foreign import capi unsafe "DearImGuiWrappers.h ImGuiDataTypeInfo_Init_wrap"
init
:: Ptr ImGuiDataTypeInfo
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImGuiDataTypeInfo_Destroy_wrap"
destroy
:: Ptr ImGuiDataTypeInfo
-> IO ()
withDefault :: (Ptr ImGuiDataTypeInfo -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)