{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE NoImplicitPrelude #-}
module SDL3.Sys.Bindgen.Locale (
SDL3.Sys.Bindgen.Locale.SDL_Locale (..),
)
where
import Prelude (Eq, Int, Show, pure, (<*>), (>>), type (~))
import HsBindgen.Runtime.HasCField qualified as HasCField
import HsBindgen.Runtime.Marshal qualified as Marshal
import HsBindgen.Runtime.PtrConst qualified as PtrConst
import HsBindgen.Runtime.Struct qualified as Struct
import HsBindgen.Runtime.Support qualified as BG
import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField
data SDL_Locale = SDL_Locale
{ SDL_Locale -> PtrConst CChar
language :: PtrConst.PtrConst BG.CChar
, SDL_Locale -> PtrConst CChar
country :: PtrConst.PtrConst BG.CChar
}
deriving stock ((forall x. SDL_Locale -> Rep SDL_Locale x)
-> (forall x. Rep SDL_Locale x -> SDL_Locale) -> Generic SDL_Locale
forall x. Rep SDL_Locale x -> SDL_Locale
forall x. SDL_Locale -> Rep SDL_Locale x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_Locale -> Rep SDL_Locale x
from :: forall x. SDL_Locale -> Rep SDL_Locale x
$cto :: forall x. Rep SDL_Locale x -> SDL_Locale
to :: forall x. Rep SDL_Locale x -> SDL_Locale
BG.Generic, SDL_Locale -> SDL_Locale -> Bool
(SDL_Locale -> SDL_Locale -> Bool)
-> (SDL_Locale -> SDL_Locale -> Bool) -> Eq SDL_Locale
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_Locale -> SDL_Locale -> Bool
== :: SDL_Locale -> SDL_Locale -> Bool
$c/= :: SDL_Locale -> SDL_Locale -> Bool
/= :: SDL_Locale -> SDL_Locale -> Bool
Eq, Int -> SDL_Locale -> ShowS
[SDL_Locale] -> ShowS
SDL_Locale -> String
(Int -> SDL_Locale -> ShowS)
-> (SDL_Locale -> String)
-> ([SDL_Locale] -> ShowS)
-> Show SDL_Locale
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_Locale -> ShowS
showsPrec :: Int -> SDL_Locale -> ShowS
$cshow :: SDL_Locale -> String
show :: SDL_Locale -> String
$cshowList :: [SDL_Locale] -> ShowS
showList :: [SDL_Locale] -> ShowS
Show)
instance Marshal.StaticSize SDL_Locale where
staticSizeOf :: Proxy SDL_Locale -> Int
staticSizeOf = \Proxy SDL_Locale
_ -> (Int
16 :: Int)
staticAlignment :: Proxy SDL_Locale -> Int
staticAlignment = \Proxy SDL_Locale
_ -> (Int
8 :: Int)
instance Marshal.ReadRaw SDL_Locale where
readRaw :: Ptr SDL_Locale -> IO SDL_Locale
readRaw =
\Ptr SDL_Locale
ptr0 ->
(PtrConst CChar -> PtrConst CChar -> SDL_Locale)
-> IO (PtrConst CChar -> PtrConst CChar -> SDL_Locale)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PtrConst CChar -> PtrConst CChar -> SDL_Locale
SDL_Locale
IO (PtrConst CChar -> PtrConst CChar -> SDL_Locale)
-> IO (PtrConst CChar) -> IO (PtrConst CChar -> SDL_Locale)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "language"
-> Ptr SDL_Locale -> IO (CFieldType SDL_Locale "language")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"language") Ptr SDL_Locale
ptr0
IO (PtrConst CChar -> SDL_Locale)
-> IO (PtrConst CChar) -> IO SDL_Locale
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "country"
-> Ptr SDL_Locale -> IO (CFieldType SDL_Locale "country")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"country") Ptr SDL_Locale
ptr0
instance Marshal.WriteRaw SDL_Locale where
writeRaw :: Ptr SDL_Locale -> SDL_Locale -> IO ()
writeRaw =
\Ptr SDL_Locale
ptr0 ->
\SDL_Locale
s1 ->
case SDL_Locale
s1 of
SDL_Locale PtrConst CChar
language2 PtrConst CChar
country3 ->
Proxy "language"
-> Ptr SDL_Locale -> CFieldType SDL_Locale "language" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"language") Ptr SDL_Locale
ptr0 PtrConst CChar
CFieldType SDL_Locale "language"
language2
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "country"
-> Ptr SDL_Locale -> CFieldType SDL_Locale "country" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"country") Ptr SDL_Locale
ptr0 PtrConst CChar
CFieldType SDL_Locale "country"
country3
deriving via Marshal.EquivStorable SDL_Locale instance BG.Storable SDL_Locale
deriving via Struct.IsStructViaReadRaw SDL_Locale instance Struct.IsStruct SDL_Locale
instance
(ty ~ PtrConst.PtrConst BG.CChar)
=> BG.CompatHasField.HasField "language" SDL_Locale ty
where
hasField :: SDL_Locale -> (ty -> SDL_Locale, ty)
hasField =
\SDL_Locale
x0 ->
( \ty
y1 ->
SDL_Locale{language :: PtrConst CChar
language = ty
PtrConst CChar
y1, country :: PtrConst CChar
country = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"country" SDL_Locale
x0}
, forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"language" SDL_Locale
x0
)
instance
(ty ~ PtrConst.PtrConst BG.CChar)
=> BG.HasField "language" (BG.Ptr SDL_Locale) (BG.Ptr ty)
where
getField :: Ptr SDL_Locale -> Ptr ty
getField = Proxy "language"
-> Ptr SDL_Locale -> Ptr (CFieldType SDL_Locale "language")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"language")
instance HasCField.HasCField SDL_Locale "language" where
type
CFieldType SDL_Locale "language" =
PtrConst.PtrConst BG.CChar
offset# :: Proxy# SDL_Locale -> Proxy# "language" -> Int
offset# = \Proxy# SDL_Locale
_ -> \Proxy# "language"
_ -> Int
0
instance
(ty ~ PtrConst.PtrConst BG.CChar)
=> BG.CompatHasField.HasField "country" SDL_Locale ty
where
hasField :: SDL_Locale -> (ty -> SDL_Locale, ty)
hasField =
\SDL_Locale
x0 ->
( \ty
y1 ->
SDL_Locale{country :: PtrConst CChar
country = ty
PtrConst CChar
y1, language :: PtrConst CChar
language = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"language" SDL_Locale
x0}
, forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"country" SDL_Locale
x0
)
instance
(ty ~ PtrConst.PtrConst BG.CChar)
=> BG.HasField "country" (BG.Ptr SDL_Locale) (BG.Ptr ty)
where
getField :: Ptr SDL_Locale -> Ptr ty
getField = Proxy "country"
-> Ptr SDL_Locale -> Ptr (CFieldType SDL_Locale "country")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"country")
instance HasCField.HasCField SDL_Locale "country" where
type
CFieldType SDL_Locale "country" =
PtrConst.PtrConst BG.CChar
offset# :: Proxy# SDL_Locale -> Proxy# "country" -> Int
offset# = \Proxy# SDL_Locale
_ -> \Proxy# "country"
_ -> Int
8