{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Ggit.Objects.Native
(
Native(..) ,
IsNative ,
toNative ,
#if defined(ENABLE_OVERLOADING)
ResolveNativeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
NativeNativePropertyInfo ,
#endif
constructNativeNative ,
#if defined(ENABLE_OVERLOADING)
nativeNative ,
#endif
) 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.GHashTable as B.GHT
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.Kind as DK
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.Ggit.Objects.ObjectFactoryBase as Ggit.ObjectFactoryBase
newtype Native = Native (SP.ManagedPtr Native)
deriving (Native -> Native -> Bool
(Native -> Native -> Bool)
-> (Native -> Native -> Bool) -> Eq Native
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Native -> Native -> Bool
== :: Native -> Native -> Bool
$c/= :: Native -> Native -> Bool
/= :: Native -> Native -> Bool
Eq)
instance SP.ManagedPtrNewtype Native where
toManagedPtr :: Native -> ManagedPtr Native
toManagedPtr (Native ManagedPtr Native
p) = ManagedPtr Native
p
foreign import ccall "ggit_native_get_type"
c_ggit_native_get_type :: IO B.Types.GType
instance B.Types.TypedObject Native where
glibType :: IO GType
glibType = IO GType
c_ggit_native_get_type
instance B.Types.GObject Native
class (SP.GObject o, O.IsDescendantOf Native o) => IsNative o
instance (SP.GObject o, O.IsDescendantOf Native o) => IsNative o
instance O.HasParentTypes Native
type instance O.ParentTypes Native = '[Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object]
toNative :: (MIO.MonadIO m, IsNative o) => o -> m Native
toNative :: forall (m :: * -> *) o. (MonadIO m, IsNative o) => o -> m Native
toNative = IO Native -> m Native
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Native -> m Native) -> (o -> IO Native) -> o -> m Native
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Native -> Native) -> o -> IO Native
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Native -> Native
Native
instance B.GValue.IsGValue (Maybe Native) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ggit_native_get_type
gvalueSet_ :: Ptr GValue -> Maybe Native -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Native
P.Nothing = Ptr GValue -> Ptr Native -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Native
forall a. Ptr a
FP.nullPtr :: FP.Ptr Native)
gvalueSet_ Ptr GValue
gv (P.Just Native
obj) = Native -> (Ptr Native -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Native
obj (Ptr GValue -> Ptr Native -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Native)
gvalueGet_ Ptr GValue
gv = do
Ptr Native
ptr <- Ptr GValue -> IO (Ptr Native)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Native)
if Ptr Native
ptr Ptr Native -> Ptr Native -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Native
forall a. Ptr a
FP.nullPtr
then Native -> Maybe Native
forall a. a -> Maybe a
P.Just (Native -> Maybe Native) -> IO Native -> IO (Maybe Native)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Native -> Native) -> Ptr Native -> IO Native
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Native -> Native
Native Ptr Native
ptr
else Maybe Native -> IO (Maybe Native)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Native
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveNativeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveNativeMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveNativeMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveNativeMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveNativeMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveNativeMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveNativeMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveNativeMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveNativeMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveNativeMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveNativeMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveNativeMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveNativeMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveNativeMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveNativeMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveNativeMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveNativeMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveNativeMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveNativeMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveNativeMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveNativeMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveNativeMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveNativeMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveNativeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveNativeMethod t Native, O.OverloadedMethod info Native p) => OL.IsLabel t (Native -> 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 ~ ResolveNativeMethod t Native, O.OverloadedMethod info Native p, R.HasField t Native p) => R.HasField t Native p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveNativeMethod t Native, O.OverloadedMethodInfo info Native) => OL.IsLabel t (O.MethodProxy info Native) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
constructNativeNative :: (IsNative o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
constructNativeNative :: forall o (m :: * -> *).
(IsNative o, MonadIO m) =>
Ptr () -> m (GValueConstruct o)
constructNativeNative Ptr ()
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Ptr () -> IO (GValueConstruct o)
forall b o. String -> Ptr b -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyPtr String
"native" Ptr ()
val
#if defined(ENABLE_OVERLOADING)
data NativeNativePropertyInfo
instance AttrInfo NativeNativePropertyInfo where
type AttrAllowedOps NativeNativePropertyInfo = '[ 'AttrConstruct]
type AttrBaseTypeConstraint NativeNativePropertyInfo = IsNative
type AttrSetTypeConstraint NativeNativePropertyInfo = (~) (Ptr ())
type AttrTransferTypeConstraint NativeNativePropertyInfo = (~) (Ptr ())
type AttrTransferType NativeNativePropertyInfo = Ptr ()
type AttrGetType NativeNativePropertyInfo = ()
type AttrLabel NativeNativePropertyInfo = "native"
type AttrOrigin NativeNativePropertyInfo = Native
attrGet = undefined
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructNativeNative
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Ggit.Objects.Native.native"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ggit-1.0.14/docs/GI-Ggit-Objects-Native.html#g:attr:native"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Native
type instance O.AttributeList Native = NativeAttributeList
type NativeAttributeList = ('[ '("native", NativeNativePropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
nativeNative :: AttrLabelProxy "native"
nativeNative = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Native = NativeSignalList
type NativeSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif