gi-ggit-1.0.4: GI/Ggit/Objects/Cred.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
Represents a git credential.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Objects.Cred
(
-- * Exported types
Cred(..) ,
IsCred ,
toCred ,
noCred ,
) 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.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
import {-# SOURCE #-} qualified GI.Ggit.Objects.Native as Ggit.Native
import {-# SOURCE #-} qualified GI.Ggit.Objects.ObjectFactoryBase as Ggit.ObjectFactoryBase
-- | Memory-managed wrapper type.
newtype Cred = Cred (ManagedPtr Cred)
foreign import ccall "ggit_cred_get_type"
c_ggit_cred_get_type :: IO GType
instance GObject Cred where
gobjectType = c_ggit_cred_get_type
-- | Type class for types which can be safely cast to `Cred`, for instance with `toCred`.
class (GObject o, O.IsDescendantOf Cred o) => IsCred o
instance (GObject o, O.IsDescendantOf Cred o) => IsCred o
instance O.HasParentTypes Cred
type instance O.ParentTypes Cred = '[Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object]
-- | Cast to `Cred`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toCred :: (MonadIO m, IsCred o) => o -> m Cred
toCred = liftIO . unsafeCastTo Cred
-- | A convenience alias for `Nothing` :: `Maybe` `Cred`.
noCred :: Maybe Cred
noCred = Nothing
#if ENABLE_OVERLOADING
type family ResolveCredMethod (t :: Symbol) (o :: *) :: * where
ResolveCredMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCredMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCredMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCredMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCredMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCredMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCredMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCredMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCredMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCredMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCredMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCredMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCredMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCredMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCredMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCredMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCredMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCredMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCredMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCredMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCredMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCredMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCredMethod t Cred, O.MethodInfo info Cred p) => OL.IsLabel t (Cred -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Cred
type instance O.AttributeList Cred = CredAttributeList
type CredAttributeList = ('[ '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Cred = CredSignalList
type CredSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif