packages feed

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

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

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

module DearImGui.Raw.Internal.ImGuiPtrOrIndex
  ( ImGuiPtrOrIndex (..)
  ) where

import Foreign.C.Types
import Foreign.Ptr (Ptr, plusPtr)
import Foreign.Storable (Storable (..))
import GHC.Records (HasField (..))

#include "dcimgui_nodefaultargfunctions_internal.h"

-- structs (opaque)

data {-# CTYPE "dcimgui_nodefaultargfunctions_internal.h" "ImGuiPtrOrIndex" #-} ImGuiPtrOrIndex = ImGuiPtrOrIndex
  { ptr :: Ptr ()
  , index :: CInt
  }
  deriving (Eq, Show)
instance Storable ImGuiPtrOrIndex where
  sizeOf _    = #{size ImGuiPtrOrIndex}
  alignment _ = #{alignment ImGuiPtrOrIndex}
  peek p = ImGuiPtrOrIndex <$> #{peek ImGuiPtrOrIndex, Ptr} p <*> #{peek ImGuiPtrOrIndex, Index} p
  poke p v = do
    #{poke ImGuiPtrOrIndex, Ptr} p v.ptr
    #{poke ImGuiPtrOrIndex, Index} p v.index

instance HasField "ptr" (Ptr ImGuiPtrOrIndex) (Ptr (Ptr ())) where
  getField = #{ptr ImGuiPtrOrIndex, Ptr}

instance HasField "index" (Ptr ImGuiPtrOrIndex) (Ptr CInt) where
  getField = #{ptr ImGuiPtrOrIndex, Index}