#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Objects.Signature
(
Signature(..) ,
IsSignature ,
toSignature ,
noSignature ,
#if ENABLE_OVERLOADING
SignatureCopyMethodInfo ,
#endif
signatureCopy ,
#if ENABLE_OVERLOADING
SignatureGetEmailMethodInfo ,
#endif
signatureGetEmail ,
#if ENABLE_OVERLOADING
SignatureGetNameMethodInfo ,
#endif
signatureGetName ,
#if ENABLE_OVERLOADING
SignatureGetTimeMethodInfo ,
#endif
signatureGetTime ,
#if ENABLE_OVERLOADING
SignatureGetTimeZoneMethodInfo ,
#endif
signatureGetTimeZone ,
signatureNew ,
signatureNewNow ,
#if ENABLE_OVERLOADING
SignatureEncodingPropertyInfo ,
#endif
constructSignatureEncoding ,
getSignatureEncoding ,
#if ENABLE_OVERLOADING
signatureEncoding ,
#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.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.GLib.Structs.DateTime as GLib.DateTime
import qualified GI.GLib.Structs.TimeZone as GLib.TimeZone
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
newtype Signature = Signature (ManagedPtr Signature)
foreign import ccall "ggit_signature_get_type"
c_ggit_signature_get_type :: IO GType
instance GObject Signature where
gobjectType = c_ggit_signature_get_type
class (GObject o, O.IsDescendantOf Signature o) => IsSignature o
instance (GObject o, O.IsDescendantOf Signature o) => IsSignature o
instance O.HasParentTypes Signature
type instance O.ParentTypes Signature = '[Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object]
toSignature :: (MonadIO m, IsSignature o) => o -> m Signature
toSignature = liftIO . unsafeCastTo Signature
noSignature :: Maybe Signature
noSignature = Nothing
#if ENABLE_OVERLOADING
type family ResolveSignatureMethod (t :: Symbol) (o :: *) :: * where
ResolveSignatureMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSignatureMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSignatureMethod "copy" o = SignatureCopyMethodInfo
ResolveSignatureMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSignatureMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSignatureMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSignatureMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSignatureMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSignatureMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSignatureMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSignatureMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSignatureMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSignatureMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSignatureMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSignatureMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSignatureMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSignatureMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSignatureMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSignatureMethod "getEmail" o = SignatureGetEmailMethodInfo
ResolveSignatureMethod "getName" o = SignatureGetNameMethodInfo
ResolveSignatureMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSignatureMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSignatureMethod "getTime" o = SignatureGetTimeMethodInfo
ResolveSignatureMethod "getTimeZone" o = SignatureGetTimeZoneMethodInfo
ResolveSignatureMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSignatureMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSignatureMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSignatureMethod t Signature, O.MethodInfo info Signature p) => OL.IsLabel t (Signature -> 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
getSignatureEncoding :: (MonadIO m, IsSignature o) => o -> m (Maybe T.Text)
getSignatureEncoding obj = liftIO $ B.Properties.getObjectPropertyString obj "encoding"
constructSignatureEncoding :: (IsSignature o) => T.Text -> IO (GValueConstruct o)
constructSignatureEncoding val = B.Properties.constructObjectPropertyString "encoding" (Just val)
#if ENABLE_OVERLOADING
data SignatureEncodingPropertyInfo
instance AttrInfo SignatureEncodingPropertyInfo where
type AttrAllowedOps SignatureEncodingPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint SignatureEncodingPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint SignatureEncodingPropertyInfo = IsSignature
type AttrGetType SignatureEncodingPropertyInfo = (Maybe T.Text)
type AttrLabel SignatureEncodingPropertyInfo = "encoding"
type AttrOrigin SignatureEncodingPropertyInfo = Signature
attrGet _ = getSignatureEncoding
attrSet _ = undefined
attrConstruct _ = constructSignatureEncoding
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Signature
type instance O.AttributeList Signature = SignatureAttributeList
type SignatureAttributeList = ('[ '("encoding", SignatureEncodingPropertyInfo), '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
signatureEncoding :: AttrLabelProxy "encoding"
signatureEncoding = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Signature = SignatureSignalList
type SignatureSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_signature_new" ggit_signature_new ::
CString ->
CString ->
Ptr GLib.DateTime.DateTime ->
Ptr (Ptr GError) ->
IO (Ptr Signature)
signatureNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> GLib.DateTime.DateTime
-> m (Maybe Signature)
signatureNew name email signatureTime = liftIO $ do
name' <- textToCString name
email' <- textToCString email
signatureTime' <- unsafeManagedPtrGetPtr signatureTime
onException (do
result <- propagateGError $ ggit_signature_new name' email' signatureTime'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Signature) result'
return result''
touchManagedPtr signatureTime
freeMem name'
freeMem email'
return maybeResult
) (do
freeMem name'
freeMem email'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "ggit_signature_new_now" ggit_signature_new_now ::
CString ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr Signature)
signatureNewNow ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> m (Maybe Signature)
signatureNewNow name email = liftIO $ do
name' <- textToCString name
email' <- textToCString email
onException (do
result <- propagateGError $ ggit_signature_new_now name' email'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Signature) result'
return result''
freeMem name'
freeMem email'
return maybeResult
) (do
freeMem name'
freeMem email'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "ggit_signature_copy" ggit_signature_copy ::
Ptr Signature ->
IO (Ptr Signature)
signatureCopy ::
(B.CallStack.HasCallStack, MonadIO m, IsSignature a) =>
a
-> m (Maybe Signature)
signatureCopy signature = liftIO $ do
signature' <- unsafeManagedPtrCastPtr signature
result <- ggit_signature_copy signature'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Signature) result'
return result''
touchManagedPtr signature
return maybeResult
#if ENABLE_OVERLOADING
data SignatureCopyMethodInfo
instance (signature ~ (m (Maybe Signature)), MonadIO m, IsSignature a) => O.MethodInfo SignatureCopyMethodInfo a signature where
overloadedMethod _ = signatureCopy
#endif
foreign import ccall "ggit_signature_get_email" ggit_signature_get_email ::
Ptr Signature ->
IO CString
signatureGetEmail ::
(B.CallStack.HasCallStack, MonadIO m, IsSignature a) =>
a
-> m (Maybe T.Text)
signatureGetEmail signature = liftIO $ do
signature' <- unsafeManagedPtrCastPtr signature
result <- ggit_signature_get_email signature'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr signature
return maybeResult
#if ENABLE_OVERLOADING
data SignatureGetEmailMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsSignature a) => O.MethodInfo SignatureGetEmailMethodInfo a signature where
overloadedMethod _ = signatureGetEmail
#endif
foreign import ccall "ggit_signature_get_name" ggit_signature_get_name ::
Ptr Signature ->
IO CString
signatureGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsSignature a) =>
a
-> m (Maybe T.Text)
signatureGetName signature = liftIO $ do
signature' <- unsafeManagedPtrCastPtr signature
result <- ggit_signature_get_name signature'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr signature
return maybeResult
#if ENABLE_OVERLOADING
data SignatureGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsSignature a) => O.MethodInfo SignatureGetNameMethodInfo a signature where
overloadedMethod _ = signatureGetName
#endif
foreign import ccall "ggit_signature_get_time" ggit_signature_get_time ::
Ptr Signature ->
IO (Ptr GLib.DateTime.DateTime)
signatureGetTime ::
(B.CallStack.HasCallStack, MonadIO m, IsSignature a) =>
a
-> m (Maybe GLib.DateTime.DateTime)
signatureGetTime signature = liftIO $ do
signature' <- unsafeManagedPtrCastPtr signature
result <- ggit_signature_get_time signature'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed GLib.DateTime.DateTime) result'
return result''
touchManagedPtr signature
return maybeResult
#if ENABLE_OVERLOADING
data SignatureGetTimeMethodInfo
instance (signature ~ (m (Maybe GLib.DateTime.DateTime)), MonadIO m, IsSignature a) => O.MethodInfo SignatureGetTimeMethodInfo a signature where
overloadedMethod _ = signatureGetTime
#endif
foreign import ccall "ggit_signature_get_time_zone" ggit_signature_get_time_zone ::
Ptr Signature ->
IO (Ptr GLib.TimeZone.TimeZone)
signatureGetTimeZone ::
(B.CallStack.HasCallStack, MonadIO m, IsSignature a) =>
a
-> m (Maybe GLib.TimeZone.TimeZone)
signatureGetTimeZone signature = liftIO $ do
signature' <- unsafeManagedPtrCastPtr signature
result <- ggit_signature_get_time_zone signature'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed GLib.TimeZone.TimeZone) result'
return result''
touchManagedPtr signature
return maybeResult
#if ENABLE_OVERLOADING
data SignatureGetTimeZoneMethodInfo
instance (signature ~ (m (Maybe GLib.TimeZone.TimeZone)), MonadIO m, IsSignature a) => O.MethodInfo SignatureGetTimeZoneMethodInfo a signature where
overloadedMethod _ = signatureGetTimeZone
#endif