{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Json.Interfaces.Serializable
(
#if defined(ENABLE_OVERLOADING)
SerializableListPropertiesMethodInfo ,
#endif
Serializable(..) ,
IsSerializable ,
toSerializable ,
#if defined(ENABLE_OVERLOADING)
ResolveSerializableMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SerializableDefaultDeserializePropertyMethodInfo,
#endif
serializableDefaultDeserializeProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableDefaultSerializePropertyMethodInfo,
#endif
serializableDefaultSerializeProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableDeserializePropertyMethodInfo,
#endif
serializableDeserializeProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableFindPropertyMethodInfo ,
#endif
serializableFindProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableGetPropertyMethodInfo ,
#endif
serializableGetProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableSerializePropertyMethodInfo ,
#endif
serializableSerializeProperty ,
#if defined(ENABLE_OVERLOADING)
SerializableSetPropertyMethodInfo ,
#endif
serializableSetProperty ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 qualified GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Json.Structs.Node as Json.Node
newtype Serializable = Serializable (SP.ManagedPtr Serializable)
deriving (Serializable -> Serializable -> Bool
(Serializable -> Serializable -> Bool)
-> (Serializable -> Serializable -> Bool) -> Eq Serializable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Serializable -> Serializable -> Bool
$c/= :: Serializable -> Serializable -> Bool
== :: Serializable -> Serializable -> Bool
$c== :: Serializable -> Serializable -> Bool
Eq)
instance SP.ManagedPtrNewtype Serializable where
toManagedPtr :: Serializable -> ManagedPtr Serializable
toManagedPtr (Serializable ManagedPtr Serializable
p) = ManagedPtr Serializable
p
foreign import ccall "json_serializable_get_type"
c_json_serializable_get_type :: IO B.Types.GType
instance B.Types.TypedObject Serializable where
glibType :: IO GType
glibType = IO GType
c_json_serializable_get_type
instance B.Types.GObject Serializable
class (SP.GObject o, O.IsDescendantOf Serializable o) => IsSerializable o
instance (SP.GObject o, O.IsDescendantOf Serializable o) => IsSerializable o
instance O.HasParentTypes Serializable
type instance O.ParentTypes Serializable = '[GObject.Object.Object]
toSerializable :: (MIO.MonadIO m, IsSerializable o) => o -> m Serializable
toSerializable :: forall (m :: * -> *) o.
(MonadIO m, IsSerializable o) =>
o -> m Serializable
toSerializable = IO Serializable -> m Serializable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Serializable -> m Serializable)
-> (o -> IO Serializable) -> o -> m Serializable
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Serializable -> Serializable) -> o -> IO Serializable
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Serializable -> Serializable
Serializable
instance B.GValue.IsGValue (Maybe Serializable) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_json_serializable_get_type
gvalueSet_ :: Ptr GValue -> Maybe Serializable -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Serializable
P.Nothing = Ptr GValue -> Ptr Serializable -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Serializable
forall a. Ptr a
FP.nullPtr :: FP.Ptr Serializable)
gvalueSet_ Ptr GValue
gv (P.Just Serializable
obj) = Serializable -> (Ptr Serializable -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Serializable
obj (Ptr GValue -> Ptr Serializable -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Serializable)
gvalueGet_ Ptr GValue
gv = do
Ptr Serializable
ptr <- Ptr GValue -> IO (Ptr Serializable)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Serializable)
if Ptr Serializable
ptr Ptr Serializable -> Ptr Serializable -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Serializable
forall a. Ptr a
FP.nullPtr
then Serializable -> Maybe Serializable
forall a. a -> Maybe a
P.Just (Serializable -> Maybe Serializable)
-> IO Serializable -> IO (Maybe Serializable)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Serializable -> Serializable)
-> Ptr Serializable -> IO Serializable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Serializable -> Serializable
Serializable Ptr Serializable
ptr
else Maybe Serializable -> IO (Maybe Serializable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Serializable
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Serializable
type instance O.AttributeList Serializable = SerializableAttributeList
type SerializableAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSerializableMethod (t :: Symbol) (o :: *) :: * where
ResolveSerializableMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSerializableMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSerializableMethod "defaultDeserializeProperty" o = SerializableDefaultDeserializePropertyMethodInfo
ResolveSerializableMethod "defaultSerializeProperty" o = SerializableDefaultSerializePropertyMethodInfo
ResolveSerializableMethod "deserializeProperty" o = SerializableDeserializePropertyMethodInfo
ResolveSerializableMethod "findProperty" o = SerializableFindPropertyMethodInfo
ResolveSerializableMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSerializableMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSerializableMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSerializableMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSerializableMethod "listProperties" o = SerializableListPropertiesMethodInfo
ResolveSerializableMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSerializableMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSerializableMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSerializableMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSerializableMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSerializableMethod "serializeProperty" o = SerializableSerializePropertyMethodInfo
ResolveSerializableMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSerializableMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSerializableMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSerializableMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSerializableMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSerializableMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSerializableMethod "getProperty" o = SerializableGetPropertyMethodInfo
ResolveSerializableMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSerializableMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSerializableMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSerializableMethod "setProperty" o = SerializableSetPropertyMethodInfo
ResolveSerializableMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSerializableMethod t Serializable, O.OverloadedMethod info Serializable p) => OL.IsLabel t (Serializable -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSerializableMethod t Serializable, O.OverloadedMethod info Serializable p, R.HasField t Serializable p) => R.HasField t Serializable p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSerializableMethod t Serializable, O.OverloadedMethodInfo info Serializable) => OL.IsLabel t (O.MethodProxy info Serializable) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "json_serializable_default_deserialize_property" json_serializable_default_deserialize_property ::
Ptr Serializable ->
CString ->
Ptr GValue ->
Ptr GParamSpec ->
Ptr Json.Node.Node ->
IO CInt
serializableDefaultDeserializeProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> T.Text
-> GValue
-> GParamSpec
-> Json.Node.Node
-> m Bool
serializableDefaultDeserializeProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> Text -> GValue -> GParamSpec -> Node -> m Bool
serializableDefaultDeserializeProperty a
serializable Text
propertyName GValue
value GParamSpec
pspec Node
propertyNode = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr Node
propertyNode' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Node
propertyNode
CInt
result <- Ptr Serializable
-> CString -> Ptr GValue -> Ptr GParamSpec -> Ptr Node -> IO CInt
json_serializable_default_deserialize_property Ptr Serializable
serializable' CString
propertyName' Ptr GValue
value' Ptr GParamSpec
pspec' Ptr Node
propertyNode'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
Node -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Node
propertyNode
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SerializableDefaultDeserializePropertyMethodInfo
instance (signature ~ (T.Text -> GValue -> GParamSpec -> Json.Node.Node -> m Bool), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableDefaultDeserializePropertyMethodInfo a signature where
overloadedMethod = serializableDefaultDeserializeProperty
instance O.OverloadedMethodInfo SerializableDefaultDeserializePropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableDefaultDeserializeProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableDefaultDeserializeProperty"
})
#endif
foreign import ccall "json_serializable_default_serialize_property" json_serializable_default_serialize_property ::
Ptr Serializable ->
CString ->
Ptr GValue ->
Ptr GParamSpec ->
IO (Ptr Json.Node.Node)
serializableDefaultSerializeProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> T.Text
-> GValue
-> GParamSpec
-> m (Maybe Json.Node.Node)
serializableDefaultSerializeProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> Text -> GValue -> GParamSpec -> m (Maybe Node)
serializableDefaultSerializeProperty a
serializable Text
propertyName GValue
value GParamSpec
pspec = IO (Maybe Node) -> m (Maybe Node)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Node) -> m (Maybe Node))
-> IO (Maybe Node) -> m (Maybe Node)
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr Node
result <- Ptr Serializable
-> CString -> Ptr GValue -> Ptr GParamSpec -> IO (Ptr Node)
json_serializable_default_serialize_property Ptr Serializable
serializable' CString
propertyName' Ptr GValue
value' Ptr GParamSpec
pspec'
Maybe Node
maybeResult <- Ptr Node -> (Ptr Node -> IO Node) -> IO (Maybe Node)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Node
result ((Ptr Node -> IO Node) -> IO (Maybe Node))
-> (Ptr Node -> IO Node) -> IO (Maybe Node)
forall a b. (a -> b) -> a -> b
$ \Ptr Node
result' -> do
Node
result'' <- ((ManagedPtr Node -> Node) -> Ptr Node -> IO Node
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Node -> Node
Json.Node.Node) Ptr Node
result'
Node -> IO Node
forall (m :: * -> *) a. Monad m => a -> m a
return Node
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
Maybe Node -> IO (Maybe Node)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Node
maybeResult
#if defined(ENABLE_OVERLOADING)
data SerializableDefaultSerializePropertyMethodInfo
instance (signature ~ (T.Text -> GValue -> GParamSpec -> m (Maybe Json.Node.Node)), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableDefaultSerializePropertyMethodInfo a signature where
overloadedMethod = serializableDefaultSerializeProperty
instance O.OverloadedMethodInfo SerializableDefaultSerializePropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableDefaultSerializeProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableDefaultSerializeProperty"
})
#endif
foreign import ccall "json_serializable_deserialize_property" json_serializable_deserialize_property ::
Ptr Serializable ->
CString ->
Ptr GValue ->
Ptr GParamSpec ->
Ptr Json.Node.Node ->
IO CInt
serializableDeserializeProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> T.Text
-> GParamSpec
-> Json.Node.Node
-> m ((Bool, GValue))
serializableDeserializeProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> Text -> GParamSpec -> Node -> m (Bool, GValue)
serializableDeserializeProperty a
serializable Text
propertyName GParamSpec
pspec Node
propertyNode = IO (Bool, GValue) -> m (Bool, GValue)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, GValue) -> m (Bool, GValue))
-> IO (Bool, GValue) -> m (Bool, GValue)
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr Node
propertyNode' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Node
propertyNode
CInt
result <- Ptr Serializable
-> CString -> Ptr GValue -> Ptr GParamSpec -> Ptr Node -> IO CInt
json_serializable_deserialize_property Ptr Serializable
serializable' CString
propertyName' Ptr GValue
value Ptr GParamSpec
pspec' Ptr Node
propertyNode'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
Node -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Node
propertyNode
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
(Bool, GValue) -> IO (Bool, GValue)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', GValue
value')
#if defined(ENABLE_OVERLOADING)
data SerializableDeserializePropertyMethodInfo
instance (signature ~ (T.Text -> GParamSpec -> Json.Node.Node -> m ((Bool, GValue))), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableDeserializePropertyMethodInfo a signature where
overloadedMethod = serializableDeserializeProperty
instance O.OverloadedMethodInfo SerializableDeserializePropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableDeserializeProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableDeserializeProperty"
})
#endif
foreign import ccall "json_serializable_find_property" json_serializable_find_property ::
Ptr Serializable ->
CString ->
IO (Ptr GParamSpec)
serializableFindProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> T.Text
-> m (Maybe GParamSpec)
serializableFindProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> Text -> m (Maybe GParamSpec)
serializableFindProperty a
serializable Text
name = IO (Maybe GParamSpec) -> m (Maybe GParamSpec)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe GParamSpec) -> m (Maybe GParamSpec))
-> IO (Maybe GParamSpec) -> m (Maybe GParamSpec)
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
CString
name' <- Text -> IO CString
textToCString Text
name
Ptr GParamSpec
result <- Ptr Serializable -> CString -> IO (Ptr GParamSpec)
json_serializable_find_property Ptr Serializable
serializable' CString
name'
Maybe GParamSpec
maybeResult <- Ptr GParamSpec
-> (Ptr GParamSpec -> IO GParamSpec) -> IO (Maybe GParamSpec)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr GParamSpec
result ((Ptr GParamSpec -> IO GParamSpec) -> IO (Maybe GParamSpec))
-> (Ptr GParamSpec -> IO GParamSpec) -> IO (Maybe GParamSpec)
forall a b. (a -> b) -> a -> b
$ \Ptr GParamSpec
result' -> do
GParamSpec
result'' <- Ptr GParamSpec -> IO GParamSpec
B.GParamSpec.newGParamSpecFromPtr Ptr GParamSpec
result'
GParamSpec -> IO GParamSpec
forall (m :: * -> *) a. Monad m => a -> m a
return GParamSpec
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
Maybe GParamSpec -> IO (Maybe GParamSpec)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GParamSpec
maybeResult
#if defined(ENABLE_OVERLOADING)
data SerializableFindPropertyMethodInfo
instance (signature ~ (T.Text -> m (Maybe GParamSpec)), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableFindPropertyMethodInfo a signature where
overloadedMethod = serializableFindProperty
instance O.OverloadedMethodInfo SerializableFindPropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableFindProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableFindProperty"
})
#endif
foreign import ccall "json_serializable_get_property" json_serializable_get_property ::
Ptr Serializable ->
Ptr GParamSpec ->
Ptr GValue ->
IO ()
serializableGetProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> GParamSpec
-> m (GValue)
serializableGetProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> GParamSpec -> m GValue
serializableGetProperty a
serializable GParamSpec
pspec = IO GValue -> m GValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
Ptr Serializable -> Ptr GParamSpec -> Ptr GValue -> IO ()
json_serializable_get_property Ptr Serializable
serializable' Ptr GParamSpec
pspec' Ptr GValue
value
GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'
#if defined(ENABLE_OVERLOADING)
data SerializableGetPropertyMethodInfo
instance (signature ~ (GParamSpec -> m (GValue)), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableGetPropertyMethodInfo a signature where
overloadedMethod = serializableGetProperty
instance O.OverloadedMethodInfo SerializableGetPropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableGetProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableGetProperty"
})
#endif
#if defined(ENABLE_OVERLOADING)
data SerializableListPropertiesMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "listProperties" Serializable) => O.OverloadedMethod SerializableListPropertiesMethodInfo o p where
overloadedMethod = undefined
instance (o ~ O.UnsupportedMethodError "listProperties" Serializable) => O.OverloadedMethodInfo SerializableListPropertiesMethodInfo o where
overloadedMethodInfo = undefined
#endif
foreign import ccall "json_serializable_serialize_property" json_serializable_serialize_property ::
Ptr Serializable ->
CString ->
Ptr GValue ->
Ptr GParamSpec ->
IO (Ptr Json.Node.Node)
serializableSerializeProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> T.Text
-> GValue
-> GParamSpec
-> m Json.Node.Node
serializableSerializeProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> Text -> GValue -> GParamSpec -> m Node
serializableSerializeProperty a
serializable Text
propertyName GValue
value GParamSpec
pspec = IO Node -> m Node
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Node -> m Node) -> IO Node -> m Node
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
CString
propertyName' <- Text -> IO CString
textToCString Text
propertyName
Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr Node
result <- Ptr Serializable
-> CString -> Ptr GValue -> Ptr GParamSpec -> IO (Ptr Node)
json_serializable_serialize_property Ptr Serializable
serializable' CString
propertyName' Ptr GValue
value' Ptr GParamSpec
pspec'
Text -> Ptr Node -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"serializableSerializeProperty" Ptr Node
result
Node
result' <- ((ManagedPtr Node -> Node) -> Ptr Node -> IO Node
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Node -> Node
Json.Node.Node) Ptr Node
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
propertyName'
Node -> IO Node
forall (m :: * -> *) a. Monad m => a -> m a
return Node
result'
#if defined(ENABLE_OVERLOADING)
data SerializableSerializePropertyMethodInfo
instance (signature ~ (T.Text -> GValue -> GParamSpec -> m Json.Node.Node), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableSerializePropertyMethodInfo a signature where
overloadedMethod = serializableSerializeProperty
instance O.OverloadedMethodInfo SerializableSerializePropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableSerializeProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableSerializeProperty"
})
#endif
foreign import ccall "json_serializable_set_property" json_serializable_set_property ::
Ptr Serializable ->
Ptr GParamSpec ->
Ptr GValue ->
IO ()
serializableSetProperty ::
(B.CallStack.HasCallStack, MonadIO m, IsSerializable a) =>
a
-> GParamSpec
-> GValue
-> m ()
serializableSetProperty :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSerializable a) =>
a -> GParamSpec -> GValue -> m ()
serializableSetProperty a
serializable GParamSpec
pspec GValue
value = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Serializable
serializable' <- a -> IO (Ptr Serializable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
serializable
Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
Ptr Serializable -> Ptr GParamSpec -> Ptr GValue -> IO ()
json_serializable_set_property Ptr Serializable
serializable' Ptr GParamSpec
pspec' Ptr GValue
value'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
serializable
GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SerializableSetPropertyMethodInfo
instance (signature ~ (GParamSpec -> GValue -> m ()), MonadIO m, IsSerializable a) => O.OverloadedMethod SerializableSetPropertyMethodInfo a signature where
overloadedMethod = serializableSetProperty
instance O.OverloadedMethodInfo SerializableSetPropertyMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Json.Interfaces.Serializable.serializableSetProperty",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-json-1.0.2/docs/GI-Json-Interfaces-Serializable.html#v:serializableSetProperty"
})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Serializable = SerializableSignalList
type SerializableSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif