#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Ggit.Structs.Note
(
Note(..) ,
noNote ,
#if ENABLE_OVERLOADING
NoteGetIdMethodInfo ,
#endif
noteGetId ,
#if ENABLE_OVERLOADING
NoteGetMessageMethodInfo ,
#endif
noteGetMessage ,
#if ENABLE_OVERLOADING
NoteRefMethodInfo ,
#endif
noteRef ,
#if ENABLE_OVERLOADING
NoteUnrefMethodInfo ,
#endif
noteUnref ,
) 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 {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId
newtype Note = Note (ManagedPtr Note)
foreign import ccall "ggit_note_get_type" c_ggit_note_get_type ::
IO GType
instance BoxedObject Note where
boxedType _ = c_ggit_note_get_type
noNote :: Maybe Note
noNote = Nothing
#if ENABLE_OVERLOADING
instance O.HasAttributeList Note
type instance O.AttributeList Note = NoteAttributeList
type NoteAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_note_get_id" ggit_note_get_id ::
Ptr Note ->
IO (Ptr Ggit.OId.OId)
noteGetId ::
(B.CallStack.HasCallStack, MonadIO m) =>
Note
-> m (Maybe Ggit.OId.OId)
noteGetId note = liftIO $ do
note' <- unsafeManagedPtrGetPtr note
result <- ggit_note_get_id note'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed Ggit.OId.OId) result'
return result''
touchManagedPtr note
return maybeResult
#if ENABLE_OVERLOADING
data NoteGetIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo NoteGetIdMethodInfo Note signature where
overloadedMethod _ = noteGetId
#endif
foreign import ccall "ggit_note_get_message" ggit_note_get_message ::
Ptr Note ->
IO CString
noteGetMessage ::
(B.CallStack.HasCallStack, MonadIO m) =>
Note
-> m (Maybe T.Text)
noteGetMessage note = liftIO $ do
note' <- unsafeManagedPtrGetPtr note
result <- ggit_note_get_message note'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr note
return maybeResult
#if ENABLE_OVERLOADING
data NoteGetMessageMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo NoteGetMessageMethodInfo Note signature where
overloadedMethod _ = noteGetMessage
#endif
foreign import ccall "ggit_note_ref" ggit_note_ref ::
Ptr Note ->
IO (Ptr Note)
noteRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
Note
-> m (Maybe Note)
noteRef note = liftIO $ do
note' <- unsafeManagedPtrGetPtr note
result <- ggit_note_ref note'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed Note) result'
return result''
touchManagedPtr note
return maybeResult
#if ENABLE_OVERLOADING
data NoteRefMethodInfo
instance (signature ~ (m (Maybe Note)), MonadIO m) => O.MethodInfo NoteRefMethodInfo Note signature where
overloadedMethod _ = noteRef
#endif
foreign import ccall "ggit_note_unref" ggit_note_unref ::
Ptr Note ->
IO ()
noteUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Note
-> m ()
noteUnref note = liftIO $ do
note' <- unsafeManagedPtrGetPtr note
ggit_note_unref note'
touchManagedPtr note
return ()
#if ENABLE_OVERLOADING
data NoteUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo NoteUnrefMethodInfo Note signature where
overloadedMethod _ = noteUnref
#endif
#if ENABLE_OVERLOADING
type family ResolveNoteMethod (t :: Symbol) (o :: *) :: * where
ResolveNoteMethod "ref" o = NoteRefMethodInfo
ResolveNoteMethod "unref" o = NoteUnrefMethodInfo
ResolveNoteMethod "getId" o = NoteGetIdMethodInfo
ResolveNoteMethod "getMessage" o = NoteGetMessageMethodInfo
ResolveNoteMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveNoteMethod t Note, O.MethodInfo info Note p) => OL.IsLabel t (Note -> 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