{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Represents the base type for objects created by an object factory.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Ggit.Objects.ObjectFactoryBase
    ( 

-- * Exported types
    ObjectFactoryBase(..)                   ,
    IsObjectFactoryBase                     ,
    toObjectFactoryBase                     ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveObjectFactoryBaseMethod          ,
#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

-- | Memory-managed wrapper type.
newtype ObjectFactoryBase = ObjectFactoryBase (SP.ManagedPtr ObjectFactoryBase)
    deriving (ObjectFactoryBase -> ObjectFactoryBase -> Bool
(ObjectFactoryBase -> ObjectFactoryBase -> Bool)
-> (ObjectFactoryBase -> ObjectFactoryBase -> Bool)
-> Eq ObjectFactoryBase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
== :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
$c/= :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
/= :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
Eq)

instance SP.ManagedPtrNewtype ObjectFactoryBase where
    toManagedPtr :: ObjectFactoryBase -> ManagedPtr ObjectFactoryBase
toManagedPtr (ObjectFactoryBase ManagedPtr ObjectFactoryBase
p) = ManagedPtr ObjectFactoryBase
p

foreign import ccall "ggit_object_factory_base_get_type"
    c_ggit_object_factory_base_get_type :: IO B.Types.GType

instance B.Types.TypedObject ObjectFactoryBase where
    glibType :: IO GType
glibType = IO GType
c_ggit_object_factory_base_get_type

instance B.Types.GObject ObjectFactoryBase

-- | Type class for types which can be safely cast to `ObjectFactoryBase`, for instance with `toObjectFactoryBase`.
class (SP.GObject o, O.IsDescendantOf ObjectFactoryBase o) => IsObjectFactoryBase o
instance (SP.GObject o, O.IsDescendantOf ObjectFactoryBase o) => IsObjectFactoryBase o

instance O.HasParentTypes ObjectFactoryBase
type instance O.ParentTypes ObjectFactoryBase = '[GObject.Object.Object]

-- | Cast to `ObjectFactoryBase`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toObjectFactoryBase :: (MIO.MonadIO m, IsObjectFactoryBase o) => o -> m ObjectFactoryBase
toObjectFactoryBase :: forall (m :: * -> *) o.
(MonadIO m, IsObjectFactoryBase o) =>
o -> m ObjectFactoryBase
toObjectFactoryBase = IO ObjectFactoryBase -> m ObjectFactoryBase
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ObjectFactoryBase -> m ObjectFactoryBase)
-> (o -> IO ObjectFactoryBase) -> o -> m ObjectFactoryBase
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ObjectFactoryBase -> ObjectFactoryBase)
-> o -> IO ObjectFactoryBase
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ObjectFactoryBase -> ObjectFactoryBase
ObjectFactoryBase

-- | Convert 'ObjectFactoryBase' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe ObjectFactoryBase) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ggit_object_factory_base_get_type
    gvalueSet_ :: Ptr GValue -> Maybe ObjectFactoryBase -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ObjectFactoryBase
P.Nothing = Ptr GValue -> Ptr ObjectFactoryBase -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ObjectFactoryBase
forall a. Ptr a
FP.nullPtr :: FP.Ptr ObjectFactoryBase)
    gvalueSet_ Ptr GValue
gv (P.Just ObjectFactoryBase
obj) = ObjectFactoryBase -> (Ptr ObjectFactoryBase -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ObjectFactoryBase
obj (Ptr GValue -> Ptr ObjectFactoryBase -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe ObjectFactoryBase)
gvalueGet_ Ptr GValue
gv = do
        Ptr ObjectFactoryBase
ptr <- Ptr GValue -> IO (Ptr ObjectFactoryBase)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ObjectFactoryBase)
        if Ptr ObjectFactoryBase
ptr Ptr ObjectFactoryBase -> Ptr ObjectFactoryBase -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ObjectFactoryBase
forall a. Ptr a
FP.nullPtr
        then ObjectFactoryBase -> Maybe ObjectFactoryBase
forall a. a -> Maybe a
P.Just (ObjectFactoryBase -> Maybe ObjectFactoryBase)
-> IO ObjectFactoryBase -> IO (Maybe ObjectFactoryBase)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ObjectFactoryBase -> ObjectFactoryBase)
-> Ptr ObjectFactoryBase -> IO ObjectFactoryBase
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ObjectFactoryBase -> ObjectFactoryBase
ObjectFactoryBase Ptr ObjectFactoryBase
ptr
        else Maybe ObjectFactoryBase -> IO (Maybe ObjectFactoryBase)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ObjectFactoryBase
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveObjectFactoryBaseMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveObjectFactoryBaseMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveObjectFactoryBaseMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveObjectFactoryBaseMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveObjectFactoryBaseMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveObjectFactoryBaseMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveObjectFactoryBaseMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveObjectFactoryBaseMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveObjectFactoryBaseMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveObjectFactoryBaseMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveObjectFactoryBaseMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveObjectFactoryBaseMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveObjectFactoryBaseMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveObjectFactoryBaseMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveObjectFactoryBaseMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveObjectFactoryBaseMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveObjectFactoryBaseMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveObjectFactoryBaseMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveObjectFactoryBaseMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveObjectFactoryBaseMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveObjectFactoryBaseMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveObjectFactoryBaseMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveObjectFactoryBaseMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveObjectFactoryBaseMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveObjectFactoryBaseMethod t ObjectFactoryBase, O.OverloadedMethod info ObjectFactoryBase p) => OL.IsLabel t (ObjectFactoryBase -> 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 ~ ResolveObjectFactoryBaseMethod t ObjectFactoryBase, O.OverloadedMethod info ObjectFactoryBase p, R.HasField t ObjectFactoryBase p) => R.HasField t ObjectFactoryBase p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveObjectFactoryBaseMethod t ObjectFactoryBase, O.OverloadedMethodInfo info ObjectFactoryBase) => OL.IsLabel t (O.MethodProxy info ObjectFactoryBase) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ObjectFactoryBase
type instance O.AttributeList ObjectFactoryBase = ObjectFactoryBaseAttributeList
type ObjectFactoryBaseAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ObjectFactoryBase = ObjectFactoryBaseSignalList
type ObjectFactoryBaseSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif