{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Ggit.Objects.Branch
(
Branch(..) ,
IsBranch ,
toBranch ,
noBranch ,
#if defined(ENABLE_OVERLOADING)
ResolveBranchMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
BranchDeleteMethodInfo ,
#endif
branchDelete ,
#if defined(ENABLE_OVERLOADING)
BranchGetNameMethodInfo ,
#endif
branchGetName ,
#if defined(ENABLE_OVERLOADING)
BranchGetUpstreamMethodInfo ,
#endif
branchGetUpstream ,
#if defined(ENABLE_OVERLOADING)
BranchIsHeadMethodInfo ,
#endif
branchIsHead ,
#if defined(ENABLE_OVERLOADING)
BranchMoveMethodInfo ,
#endif
branchMove ,
#if defined(ENABLE_OVERLOADING)
BranchSetUpstreamMethodInfo ,
#endif
branchSetUpstream ,
) 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.GI.Base.Signals as B.Signals
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.Flags as Ggit.Flags
import {-# SOURCE #-} qualified GI.Ggit.Objects.Native as Ggit.Native
import {-# SOURCE #-} qualified GI.Ggit.Objects.ObjectFactoryBase as Ggit.ObjectFactoryBase
import {-# SOURCE #-} qualified GI.Ggit.Objects.Ref as Ggit.Ref
newtype Branch = Branch (ManagedPtr Branch)
deriving (Eq)
foreign import ccall "ggit_branch_get_type"
c_ggit_branch_get_type :: IO GType
instance GObject Branch where
gobjectType = c_ggit_branch_get_type
instance B.GValue.IsGValue Branch where
toGValue o = do
gtype <- c_ggit_branch_get_type
B.ManagedPtr.withManagedPtr o (B.GValue.buildGValue gtype B.GValue.set_object)
fromGValue gv = do
ptr <- B.GValue.get_object gv :: IO (Ptr Branch)
B.ManagedPtr.newObject Branch ptr
class (GObject o, O.IsDescendantOf Branch o) => IsBranch o
instance (GObject o, O.IsDescendantOf Branch o) => IsBranch o
instance O.HasParentTypes Branch
type instance O.ParentTypes Branch = '[Ggit.Ref.Ref, Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object]
toBranch :: (MonadIO m, IsBranch o) => o -> m Branch
toBranch = liftIO . unsafeCastTo Branch
noBranch :: Maybe Branch
noBranch = Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveBranchMethod (t :: Symbol) (o :: *) :: * where
ResolveBranchMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveBranchMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveBranchMethod "delete" o = BranchDeleteMethodInfo
ResolveBranchMethod "deleteLog" o = Ggit.Ref.RefDeleteLogMethodInfo
ResolveBranchMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveBranchMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveBranchMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveBranchMethod "hasLog" o = Ggit.Ref.RefHasLogMethodInfo
ResolveBranchMethod "isBranch" o = Ggit.Ref.RefIsBranchMethodInfo
ResolveBranchMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveBranchMethod "isHead" o = BranchIsHeadMethodInfo
ResolveBranchMethod "isNote" o = Ggit.Ref.RefIsNoteMethodInfo
ResolveBranchMethod "isRemote" o = Ggit.Ref.RefIsRemoteMethodInfo
ResolveBranchMethod "isTag" o = Ggit.Ref.RefIsTagMethodInfo
ResolveBranchMethod "lookup" o = Ggit.Ref.RefLookupMethodInfo
ResolveBranchMethod "move" o = BranchMoveMethodInfo
ResolveBranchMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveBranchMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveBranchMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveBranchMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveBranchMethod "rename" o = Ggit.Ref.RefRenameMethodInfo
ResolveBranchMethod "resolve" o = Ggit.Ref.RefResolveMethodInfo
ResolveBranchMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveBranchMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveBranchMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveBranchMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveBranchMethod "toString" o = Ggit.Ref.RefToStringMethodInfo
ResolveBranchMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveBranchMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveBranchMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveBranchMethod "getLog" o = Ggit.Ref.RefGetLogMethodInfo
ResolveBranchMethod "getName" o = BranchGetNameMethodInfo
ResolveBranchMethod "getOwner" o = Ggit.Ref.RefGetOwnerMethodInfo
ResolveBranchMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveBranchMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveBranchMethod "getReferenceType" o = Ggit.Ref.RefGetReferenceTypeMethodInfo
ResolveBranchMethod "getShorthand" o = Ggit.Ref.RefGetShorthandMethodInfo
ResolveBranchMethod "getSymbolicTarget" o = Ggit.Ref.RefGetSymbolicTargetMethodInfo
ResolveBranchMethod "getTarget" o = Ggit.Ref.RefGetTargetMethodInfo
ResolveBranchMethod "getUpstream" o = BranchGetUpstreamMethodInfo
ResolveBranchMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveBranchMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveBranchMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveBranchMethod "setSymbolicTarget" o = Ggit.Ref.RefSetSymbolicTargetMethodInfo
ResolveBranchMethod "setTarget" o = Ggit.Ref.RefSetTargetMethodInfo
ResolveBranchMethod "setUpstream" o = BranchSetUpstreamMethodInfo
ResolveBranchMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBranchMethod t Branch, O.MethodInfo info Branch p) => OL.IsLabel t (Branch -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Branch
type instance O.AttributeList Branch = BranchAttributeList
type BranchAttributeList = ('[ '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Branch = BranchSignalList
type BranchSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "ggit_branch_delete" ggit_branch_delete ::
Ptr Branch ->
Ptr (Ptr GError) ->
IO ()
branchDelete ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> m ()
branchDelete branch = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
onException (do
propagateGError $ ggit_branch_delete branch'
touchManagedPtr branch
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data BranchDeleteMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBranch a) => O.MethodInfo BranchDeleteMethodInfo a signature where
overloadedMethod = branchDelete
#endif
foreign import ccall "ggit_branch_get_name" ggit_branch_get_name ::
Ptr Branch ->
Ptr (Ptr GError) ->
IO CString
branchGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> m (Maybe T.Text)
branchGetName branch = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
onException (do
result <- propagateGError $ ggit_branch_get_name branch'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr branch
return maybeResult
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data BranchGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsBranch a) => O.MethodInfo BranchGetNameMethodInfo a signature where
overloadedMethod = branchGetName
#endif
foreign import ccall "ggit_branch_get_upstream" ggit_branch_get_upstream ::
Ptr Branch ->
Ptr (Ptr GError) ->
IO (Ptr Ggit.Ref.Ref)
branchGetUpstream ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> m (Maybe Ggit.Ref.Ref)
branchGetUpstream branch = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
onException (do
result <- propagateGError $ ggit_branch_get_upstream branch'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Ggit.Ref.Ref) result'
return result''
touchManagedPtr branch
return maybeResult
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data BranchGetUpstreamMethodInfo
instance (signature ~ (m (Maybe Ggit.Ref.Ref)), MonadIO m, IsBranch a) => O.MethodInfo BranchGetUpstreamMethodInfo a signature where
overloadedMethod = branchGetUpstream
#endif
foreign import ccall "ggit_branch_is_head" ggit_branch_is_head ::
Ptr Branch ->
Ptr (Ptr GError) ->
IO CInt
branchIsHead ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> m ()
branchIsHead branch = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
onException (do
_ <- propagateGError $ ggit_branch_is_head branch'
touchManagedPtr branch
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data BranchIsHeadMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBranch a) => O.MethodInfo BranchIsHeadMethodInfo a signature where
overloadedMethod = branchIsHead
#endif
foreign import ccall "ggit_branch_move" ggit_branch_move ::
Ptr Branch ->
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr Branch)
branchMove ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> T.Text
-> [Ggit.Flags.CreateFlags]
-> m (Maybe Branch)
branchMove branch newBranchName flags = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
newBranchName' <- textToCString newBranchName
let flags' = gflagsToWord flags
onException (do
result <- propagateGError $ ggit_branch_move branch' newBranchName' flags'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Branch) result'
return result''
touchManagedPtr branch
freeMem newBranchName'
return maybeResult
) (do
freeMem newBranchName'
)
#if defined(ENABLE_OVERLOADING)
data BranchMoveMethodInfo
instance (signature ~ (T.Text -> [Ggit.Flags.CreateFlags] -> m (Maybe Branch)), MonadIO m, IsBranch a) => O.MethodInfo BranchMoveMethodInfo a signature where
overloadedMethod = branchMove
#endif
foreign import ccall "ggit_branch_set_upstream" ggit_branch_set_upstream ::
Ptr Branch ->
CString ->
Ptr (Ptr GError) ->
IO ()
branchSetUpstream ::
(B.CallStack.HasCallStack, MonadIO m, IsBranch a) =>
a
-> T.Text
-> m ()
branchSetUpstream branch upstreamBranchName = liftIO $ do
branch' <- unsafeManagedPtrCastPtr branch
upstreamBranchName' <- textToCString upstreamBranchName
onException (do
propagateGError $ ggit_branch_set_upstream branch' upstreamBranchName'
touchManagedPtr branch
freeMem upstreamBranchName'
return ()
) (do
freeMem upstreamBranchName'
)
#if defined(ENABLE_OVERLOADING)
data BranchSetUpstreamMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsBranch a) => O.MethodInfo BranchSetUpstreamMethodInfo a signature where
overloadedMethod = branchSetUpstream
#endif