{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- 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                     ,
    noObjectFactoryBase                     ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#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.ManagedPtr as B.ManagedPtr
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 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 GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype ObjectFactoryBase = ObjectFactoryBase (ManagedPtr ObjectFactoryBase)
    deriving (ObjectFactoryBase -> ObjectFactoryBase -> Bool
(ObjectFactoryBase -> ObjectFactoryBase -> Bool)
-> (ObjectFactoryBase -> ObjectFactoryBase -> Bool)
-> Eq ObjectFactoryBase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
$c/= :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
== :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
$c== :: ObjectFactoryBase -> ObjectFactoryBase -> Bool
Eq)
foreign import ccall "ggit_object_factory_base_get_type"
    c_ggit_object_factory_base_get_type :: IO GType

instance GObject ObjectFactoryBase where
    gobjectType :: IO GType
gobjectType = IO GType
c_ggit_object_factory_base_get_type
    

-- | Convert 'ObjectFactoryBase' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue ObjectFactoryBase where
    toGValue :: ObjectFactoryBase -> IO GValue
toGValue o :: ObjectFactoryBase
o = do
        GType
gtype <- IO GType
c_ggit_object_factory_base_get_type
        ObjectFactoryBase
-> (Ptr ObjectFactoryBase -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ObjectFactoryBase
o (GType
-> (GValue -> Ptr ObjectFactoryBase -> IO ())
-> Ptr ObjectFactoryBase
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr ObjectFactoryBase -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO ObjectFactoryBase
fromGValue gv :: GValue
gv = do
        Ptr ObjectFactoryBase
ptr <- GValue -> IO (Ptr ObjectFactoryBase)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr ObjectFactoryBase)
        (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
        
    

-- | Type class for types which can be safely cast to `ObjectFactoryBase`, for instance with `toObjectFactoryBase`.
class (GObject o, O.IsDescendantOf ObjectFactoryBase o) => IsObjectFactoryBase o
instance (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 :: (MonadIO m, IsObjectFactoryBase o) => o -> m ObjectFactoryBase
toObjectFactoryBase :: o -> m ObjectFactoryBase
toObjectFactoryBase = IO ObjectFactoryBase -> m ObjectFactoryBase
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr ObjectFactoryBase -> ObjectFactoryBase
ObjectFactoryBase

-- | A convenience alias for `Nothing` :: `Maybe` `ObjectFactoryBase`.
noObjectFactoryBase :: Maybe ObjectFactoryBase
noObjectFactoryBase :: Maybe ObjectFactoryBase
noObjectFactoryBase = Maybe ObjectFactoryBase
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveObjectFactoryBaseMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif