packages feed

dear-imgui-raw-internal-1.0.0: src/DearImGui/Raw/Internal/ImGuiStackLevelInfo.hsc

{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}

-- This file was generated by dear-bindings-ffi. Do not edit by hand.

module DearImGui.Raw.Internal.ImGuiStackLevelInfo
  ( ImGuiStackLevelInfo (..)
  , destroy
  , init
  , withDefault
  ) where

import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID, ImS8)
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" "ImGuiStackLevelInfo" #-} ImGuiStackLevelInfo = ImGuiStackLevelInfo
  { iD :: ImGuiID
  , queryFrameCount :: ImS8
  , querySuccess :: CBool
  , dataType :: ImS8
  , descOffset :: CInt
  }
  deriving (Eq, Show)
instance Storable ImGuiStackLevelInfo where
  sizeOf _    = #{size ImGuiStackLevelInfo}
  alignment _ = #{alignment ImGuiStackLevelInfo}
  peek p = ImGuiStackLevelInfo <$> #{peek ImGuiStackLevelInfo, ID} p <*> #{peek ImGuiStackLevelInfo, QueryFrameCount} p <*> #{peek ImGuiStackLevelInfo, QuerySuccess} p <*> #{peek ImGuiStackLevelInfo, DataType} p <*> #{peek ImGuiStackLevelInfo, DescOffset} p
  poke p v = do
    #{poke ImGuiStackLevelInfo, ID} p v.iD
    #{poke ImGuiStackLevelInfo, QueryFrameCount} p v.queryFrameCount
    #{poke ImGuiStackLevelInfo, QuerySuccess} p v.querySuccess
    #{poke ImGuiStackLevelInfo, DataType} p v.dataType
    #{poke ImGuiStackLevelInfo, DescOffset} p v.descOffset

instance HasField "iD" (Ptr ImGuiStackLevelInfo) (Ptr ImGuiID) where
  getField = #{ptr ImGuiStackLevelInfo, ID}

instance HasField "queryFrameCount" (Ptr ImGuiStackLevelInfo) (Ptr ImS8) where
  getField = #{ptr ImGuiStackLevelInfo, QueryFrameCount}

instance HasField "querySuccess" (Ptr ImGuiStackLevelInfo) (Ptr CBool) where
  getField = #{ptr ImGuiStackLevelInfo, QuerySuccess}

instance HasField "dataType" (Ptr ImGuiStackLevelInfo) (Ptr ImS8) where
  getField = #{ptr ImGuiStackLevelInfo, DataType}

instance HasField "descOffset" (Ptr ImGuiStackLevelInfo) (Ptr CInt) where
  getField = #{ptr ImGuiStackLevelInfo, DescOffset}

foreign import capi unsafe "DearImGuiWrappers.h ImGuiStackLevelInfo_Init_wrap"
  init
    :: Ptr ImGuiStackLevelInfo
    -> IO ()

foreign import capi unsafe "DearImGuiWrappers.h ImGuiStackLevelInfo_Destroy_wrap"
  destroy
    :: Ptr ImGuiStackLevelInfo
    -> IO ()

withDefault :: (Ptr ImGuiStackLevelInfo -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)