{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Represents a git push options. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Ggit.Objects.PushOptions ( -- * Exported types PushOptions(..) , IsPushOptions , toPushOptions , noPushOptions , -- * Methods -- ** getParallelism #method:getParallelism# #if ENABLE_OVERLOADING PushOptionsGetParallelismMethodInfo , #endif pushOptionsGetParallelism , -- ** new #method:new# pushOptionsNew , -- ** setParallelism #method:setParallelism# #if ENABLE_OVERLOADING PushOptionsSetParallelismMethodInfo , #endif pushOptionsSetParallelism , -- * Properties -- ** parallelism #attr:parallelism# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING PushOptionsParallelismPropertyInfo , #endif constructPushOptionsParallelism , getPushOptionsParallelism , #if ENABLE_OVERLOADING pushOptionsParallelism , #endif setPushOptionsParallelism , ) 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.GObject.Objects.Object as GObject.Object -- | Memory-managed wrapper type. newtype PushOptions = PushOptions (ManagedPtr PushOptions) foreign import ccall "ggit_push_options_get_type" c_ggit_push_options_get_type :: IO GType instance GObject PushOptions where gobjectType = c_ggit_push_options_get_type -- | Type class for types which can be safely cast to `PushOptions`, for instance with `toPushOptions`. class (GObject o, O.IsDescendantOf PushOptions o) => IsPushOptions o instance (GObject o, O.IsDescendantOf PushOptions o) => IsPushOptions o instance O.HasParentTypes PushOptions type instance O.ParentTypes PushOptions = '[GObject.Object.Object] -- | Cast to `PushOptions`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toPushOptions :: (MonadIO m, IsPushOptions o) => o -> m PushOptions toPushOptions = liftIO . unsafeCastTo PushOptions -- | A convenience alias for `Nothing` :: `Maybe` `PushOptions`. noPushOptions :: Maybe PushOptions noPushOptions = Nothing #if ENABLE_OVERLOADING type family ResolvePushOptionsMethod (t :: Symbol) (o :: *) :: * where ResolvePushOptionsMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolvePushOptionsMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolvePushOptionsMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolvePushOptionsMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolvePushOptionsMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolvePushOptionsMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolvePushOptionsMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolvePushOptionsMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolvePushOptionsMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolvePushOptionsMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolvePushOptionsMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolvePushOptionsMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolvePushOptionsMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolvePushOptionsMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolvePushOptionsMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolvePushOptionsMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolvePushOptionsMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolvePushOptionsMethod "getParallelism" o = PushOptionsGetParallelismMethodInfo ResolvePushOptionsMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolvePushOptionsMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolvePushOptionsMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolvePushOptionsMethod "setParallelism" o = PushOptionsSetParallelismMethodInfo ResolvePushOptionsMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolvePushOptionsMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolvePushOptionsMethod t PushOptions, O.MethodInfo info PushOptions p) => OL.IsLabel t (PushOptions -> 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 -- VVV Prop "parallelism" -- Type: TBasicType TInt -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] -- Nullable: (Just False,Just False) {- | Get the value of the “@parallelism@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' pushOptions #parallelism @ -} getPushOptionsParallelism :: (MonadIO m, IsPushOptions o) => o -> m Int32 getPushOptionsParallelism obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "parallelism" {- | Set the value of the “@parallelism@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' pushOptions [ #parallelism 'Data.GI.Base.Attributes.:=' value ] @ -} setPushOptionsParallelism :: (MonadIO m, IsPushOptions o) => o -> Int32 -> m () setPushOptionsParallelism obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "parallelism" val {- | Construct a `GValueConstruct` with valid value for the “@parallelism@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructPushOptionsParallelism :: (IsPushOptions o) => Int32 -> IO (GValueConstruct o) constructPushOptionsParallelism val = B.Properties.constructObjectPropertyInt32 "parallelism" val #if ENABLE_OVERLOADING data PushOptionsParallelismPropertyInfo instance AttrInfo PushOptionsParallelismPropertyInfo where type AttrAllowedOps PushOptionsParallelismPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint PushOptionsParallelismPropertyInfo = (~) Int32 type AttrBaseTypeConstraint PushOptionsParallelismPropertyInfo = IsPushOptions type AttrGetType PushOptionsParallelismPropertyInfo = Int32 type AttrLabel PushOptionsParallelismPropertyInfo = "parallelism" type AttrOrigin PushOptionsParallelismPropertyInfo = PushOptions attrGet _ = getPushOptionsParallelism attrSet _ = setPushOptionsParallelism attrConstruct _ = constructPushOptionsParallelism attrClear _ = undefined #endif #if ENABLE_OVERLOADING instance O.HasAttributeList PushOptions type instance O.AttributeList PushOptions = PushOptionsAttributeList type PushOptionsAttributeList = ('[ '("parallelism", PushOptionsParallelismPropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING pushOptionsParallelism :: AttrLabelProxy "parallelism" pushOptionsParallelism = AttrLabelProxy #endif #if ENABLE_OVERLOADING type instance O.SignalList PushOptions = PushOptionsSignalList type PushOptionsSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method PushOptions::new -- method type : Constructor -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "PushOptions"})) -- throws : False -- Skip return : False foreign import ccall "ggit_push_options_new" ggit_push_options_new :: IO (Ptr PushOptions) {- | Create a new push options object. -} pushOptionsNew :: (B.CallStack.HasCallStack, MonadIO m) => m (Maybe PushOptions) {- ^ __Returns:__ a 'GI.Ggit.Objects.PushOptions.PushOptions' or 'Nothing'. -} pushOptionsNew = liftIO $ do result <- ggit_push_options_new maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (wrapObject PushOptions) result' return result'' return maybeResult #if ENABLE_OVERLOADING #endif -- method PushOptions::get_parallelism -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "PushOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitPushOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "ggit_push_options_get_parallelism" ggit_push_options_get_parallelism :: Ptr PushOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "PushOptions"}) IO Int32 {- | Get the number of parallel threads to use when creating the pack file to push. The special value 0 indicates that the number of threads will be automatically detected. -} pushOptionsGetParallelism :: (B.CallStack.HasCallStack, MonadIO m, IsPushOptions a) => a {- ^ /@options@/: a 'GI.Ggit.Objects.PushOptions.PushOptions'. -} -> m Int32 {- ^ __Returns:__ the number of parallel threads, or 0 for auto-detect. -} pushOptionsGetParallelism options = liftIO $ do options' <- unsafeManagedPtrCastPtr options result <- ggit_push_options_get_parallelism options' touchManagedPtr options return result #if ENABLE_OVERLOADING data PushOptionsGetParallelismMethodInfo instance (signature ~ (m Int32), MonadIO m, IsPushOptions a) => O.MethodInfo PushOptionsGetParallelismMethodInfo a signature where overloadedMethod _ = pushOptionsGetParallelism #endif -- method PushOptions::set_parallelism -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "PushOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitPushOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parallelism", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of threads, or 0 for auto-detect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ggit_push_options_set_parallelism" ggit_push_options_set_parallelism :: Ptr PushOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "PushOptions"}) Int32 -> -- parallelism : TBasicType TInt IO () {- | Set the number of parallel threads to use when creating the pack file to push. The special value 0 can be specified for /@parallelism@/ indicating that the number of threads will be automatically detected. -} pushOptionsSetParallelism :: (B.CallStack.HasCallStack, MonadIO m, IsPushOptions a) => a {- ^ /@options@/: a 'GI.Ggit.Objects.PushOptions.PushOptions'. -} -> Int32 {- ^ /@parallelism@/: the number of threads, or 0 for auto-detect. -} -> m () pushOptionsSetParallelism options parallelism = liftIO $ do options' <- unsafeManagedPtrCastPtr options ggit_push_options_set_parallelism options' parallelism touchManagedPtr options return () #if ENABLE_OVERLOADING data PushOptionsSetParallelismMethodInfo instance (signature ~ (Int32 -> m ()), MonadIO m, IsPushOptions a) => O.MethodInfo PushOptionsSetParallelismMethodInfo a signature where overloadedMethod _ = pushOptionsSetParallelism #endif