{-# 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.GArray as B.GArray
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.Coerce as Coerce
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 GHC.Records as R
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 (Maybe Note) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ggit_note_get_type
gvalueSet_ :: Ptr GValue -> Maybe Note -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Note
P.Nothing = Ptr GValue -> Ptr Note -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Note
forall a. Ptr a
FP.nullPtr :: FP.Ptr Note)
gvalueSet_ Ptr GValue
gv (P.Just Note
obj) = Note -> (Ptr Note -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Note
obj (Ptr GValue -> Ptr Note -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Note)
gvalueGet_ Ptr GValue
gv = do
Ptr Note
ptr <- Ptr GValue -> IO (Ptr Note)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Note)
if Ptr Note
ptr Ptr Note -> Ptr Note -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Note
forall a. Ptr a
FP.nullPtr
then Note -> Maybe Note
forall a. a -> Maybe a
P.Just (Note -> Maybe Note) -> IO Note -> IO (Maybe Note)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
else Maybe Note -> IO (Maybe Note)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Note
forall a. Maybe a
P.Nothing
#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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
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.OverloadedMethod NoteGetIdMethodInfo Note signature where
overloadedMethod = noteGetId
instance O.OverloadedMethodInfo NoteGetIdMethodInfo Note where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Ggit.Structs.Note.noteGetId",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ggit-1.0.11/docs/GI-Ggit-Structs-Note.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
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.OverloadedMethod NoteGetMessageMethodInfo Note signature where
overloadedMethod = noteGetMessage
instance O.OverloadedMethodInfo NoteGetMessageMethodInfo Note where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Ggit.Structs.Note.noteGetMessage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ggit-1.0.11/docs/GI-Ggit-Structs-Note.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
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.OverloadedMethod NoteRefMethodInfo Note signature where
overloadedMethod = noteRef
instance O.OverloadedMethodInfo NoteRefMethodInfo Note where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Ggit.Structs.Note.noteRef",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ggit-1.0.11/docs/GI-Ggit-Structs-Note.html#v:noteRef"
})
#endif
foreign import ccall "ggit_note_unref" ggit_note_unref ::
Ptr Note ->
IO ()
noteUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Note
-> m ()
noteUnref :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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.OverloadedMethod NoteUnrefMethodInfo Note signature where
overloadedMethod = noteUnref
instance O.OverloadedMethodInfo NoteUnrefMethodInfo Note where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Ggit.Structs.Note.noteUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ggit-1.0.11/docs/GI-Ggit-Structs-Note.html#v: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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveNoteMethod t Note, O.OverloadedMethod info Note p, R.HasField t Note p) => R.HasField t Note p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveNoteMethod t Note, O.OverloadedMethodInfo info Note) => OL.IsLabel t (O.MethodProxy info Note) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif