{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Ggit.Structs.Note
(
Note(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveNoteMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
NoteGetIdMethodInfo ,
#endif
noteGetId ,
#if defined(ENABLE_OVERLOADING)
NoteGetMessageMethodInfo ,
#endif
noteGetMessage ,
#if defined(ENABLE_OVERLOADING)
NoteRefMethodInfo ,
#endif
noteRef ,
#if defined(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.BasicTypes as B.Types
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 Control.Monad.IO.Class as MIO
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 (SP.ManagedPtr Note)
deriving (Note -> Note -> Bool
(Note -> Note -> Bool) -> (Note -> Note -> Bool) -> Eq Note
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Note -> Note -> Bool
$c/= :: Note -> Note -> Bool
== :: Note -> Note -> Bool
$c== :: Note -> Note -> Bool
Eq)
instance SP.ManagedPtrNewtype Note where
toManagedPtr :: Note -> ManagedPtr Note
toManagedPtr (Note ManagedPtr Note
p) = ManagedPtr Note
p
foreign import ccall "ggit_note_get_type" c_ggit_note_get_type ::
IO GType
type instance O.ParentTypes Note = '[]
instance O.HasParentTypes Note
instance B.Types.TypedObject Note where
glibType :: IO GType
glibType = IO GType
c_ggit_note_get_type
instance B.Types.GBoxed Note
instance B.GValue.IsGValue Note where
toGValue :: Note -> IO GValue
toGValue Note
o = do
GType
gtype <- IO GType
c_ggit_note_get_type
Note -> (Ptr Note -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Note
o (GType -> (GValue -> Ptr Note -> IO ()) -> Ptr Note -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Note -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Note
fromGValue GValue
gv = do
Ptr Note
ptr <- GValue -> IO (Ptr Note)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Note)
(ManagedPtr Note -> Note) -> Ptr Note -> IO Note
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Note -> Note
Note Ptr Note
ptr
#if defined(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 -> m (Maybe OId)
noteGetId Note
note = IO (Maybe OId) -> m (Maybe OId)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe OId) -> m (Maybe OId))
-> IO (Maybe OId) -> m (Maybe OId)
forall a b. (a -> b) -> a -> b
$ do
Ptr Note
note' <- Note -> IO (Ptr Note)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Note
note
Ptr OId
result <- Ptr Note -> IO (Ptr OId)
ggit_note_get_id Ptr Note
note'
Maybe OId
maybeResult <- Ptr OId -> (Ptr OId -> IO OId) -> IO (Maybe OId)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr OId
result ((Ptr OId -> IO OId) -> IO (Maybe OId))
-> (Ptr OId -> IO OId) -> IO (Maybe OId)
forall a b. (a -> b) -> a -> b
$ \Ptr OId
result' -> do
OId
result'' <- ((ManagedPtr OId -> OId) -> Ptr OId -> IO OId
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr OId -> OId
Ggit.OId.OId) Ptr OId
result'
OId -> IO OId
forall (m :: * -> *) a. Monad m => a -> m a
return OId
result''
Note -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Note
note
Maybe OId -> IO (Maybe OId)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe OId
maybeResult
#if defined(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 -> m (Maybe Text)
noteGetMessage Note
note = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Note
note' <- Note -> IO (Ptr Note)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Note
note
CString
result <- Ptr Note -> IO CString
ggit_note_get_message Ptr Note
note'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Note -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Note
note
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(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 -> m (Maybe Note)
noteRef Note
note = IO (Maybe Note) -> m (Maybe Note)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Note) -> m (Maybe Note))
-> IO (Maybe Note) -> m (Maybe Note)
forall a b. (a -> b) -> a -> b
$ do
Ptr Note
note' <- Note -> IO (Ptr Note)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Note
note
Ptr Note
result <- Ptr Note -> IO (Ptr Note)
ggit_note_ref Ptr Note
note'
Maybe Note
maybeResult <- Ptr Note -> (Ptr Note -> IO Note) -> IO (Maybe Note)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Note
result ((Ptr Note -> IO Note) -> IO (Maybe Note))
-> (Ptr Note -> IO Note) -> IO (Maybe Note)
forall a b. (a -> b) -> a -> b
$ \Ptr Note
result' -> do
Note
result'' <- ((ManagedPtr Note -> Note) -> Ptr Note -> IO Note
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Note -> Note
Note) Ptr Note
result'
Note -> IO Note
forall (m :: * -> *) a. Monad m => a -> m a
return Note
result''
Note -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Note
note
Maybe Note -> IO (Maybe Note)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Note
maybeResult
#if defined(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 -> m ()
noteUnref Note
note = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Note
note' <- Note -> IO (Ptr Note)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Note
note
Ptr Note -> IO ()
ggit_note_unref Ptr Note
note'
Note -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Note
note
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data NoteUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo NoteUnrefMethodInfo Note signature where
overloadedMethod = noteUnref
#endif
#if defined(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 @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif