{- | 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 configuration. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Ggit.Objects.Config ( -- * Exported types Config(..) , IsConfig , toConfig , noConfig , -- * Methods -- ** addFile #method:addFile# #if ENABLE_OVERLOADING ConfigAddFileMethodInfo , #endif configAddFile , -- ** deleteEntry #method:deleteEntry# #if ENABLE_OVERLOADING ConfigDeleteEntryMethodInfo , #endif configDeleteEntry , -- ** findGlobal #method:findGlobal# configFindGlobal , -- ** findSystem #method:findSystem# configFindSystem , -- ** foreach #method:foreach# #if ENABLE_OVERLOADING ConfigForeachMethodInfo , #endif configForeach , -- ** getBool #method:getBool# #if ENABLE_OVERLOADING ConfigGetBoolMethodInfo , #endif configGetBool , -- ** getEntry #method:getEntry# #if ENABLE_OVERLOADING ConfigGetEntryMethodInfo , #endif configGetEntry , -- ** getInt32 #method:getInt32# #if ENABLE_OVERLOADING ConfigGetInt32MethodInfo , #endif configGetInt32 , -- ** getInt64 #method:getInt64# #if ENABLE_OVERLOADING ConfigGetInt64MethodInfo , #endif configGetInt64 , -- ** getString #method:getString# #if ENABLE_OVERLOADING ConfigGetStringMethodInfo , #endif configGetString , -- ** match #method:match# #if ENABLE_OVERLOADING ConfigMatchMethodInfo , #endif configMatch , -- ** matchForeach #method:matchForeach# #if ENABLE_OVERLOADING ConfigMatchForeachMethodInfo , #endif configMatchForeach , -- ** new #method:new# configNew , -- ** newDefault #method:newDefault# configNewDefault , -- ** newFromFile #method:newFromFile# configNewFromFile , -- ** openLevel #method:openLevel# #if ENABLE_OVERLOADING ConfigOpenLevelMethodInfo , #endif configOpenLevel , -- ** setBool #method:setBool# #if ENABLE_OVERLOADING ConfigSetBoolMethodInfo , #endif configSetBool , -- ** setInt32 #method:setInt32# #if ENABLE_OVERLOADING ConfigSetInt32MethodInfo , #endif configSetInt32 , -- ** setInt64 #method:setInt64# #if ENABLE_OVERLOADING ConfigSetInt64MethodInfo , #endif configSetInt64 , -- ** setString #method:setString# #if ENABLE_OVERLOADING ConfigSetStringMethodInfo , #endif configSetString , -- ** snapshot #method:snapshot# #if ENABLE_OVERLOADING ConfigSnapshotMethodInfo , #endif configSnapshot , ) 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.GLib.Structs.MatchInfo as GLib.MatchInfo import qualified GI.GLib.Structs.Regex as GLib.Regex import qualified GI.GObject.Objects.Object as GObject.Object import qualified GI.Ggit.Callbacks as Ggit.Callbacks import {-# SOURCE #-} qualified GI.Ggit.Enums as Ggit.Enums 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.Structs.ConfigEntry as Ggit.ConfigEntry import qualified GI.Gio.Interfaces.File as Gio.File -- | Memory-managed wrapper type. newtype Config = Config (ManagedPtr Config) foreign import ccall "ggit_config_get_type" c_ggit_config_get_type :: IO GType instance GObject Config where gobjectType = c_ggit_config_get_type -- | Type class for types which can be safely cast to `Config`, for instance with `toConfig`. class (GObject o, O.IsDescendantOf Config o) => IsConfig o instance (GObject o, O.IsDescendantOf Config o) => IsConfig o instance O.HasParentTypes Config type instance O.ParentTypes Config = '[Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object] -- | Cast to `Config`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toConfig :: (MonadIO m, IsConfig o) => o -> m Config toConfig = liftIO . unsafeCastTo Config -- | A convenience alias for `Nothing` :: `Maybe` `Config`. noConfig :: Maybe Config noConfig = Nothing #if ENABLE_OVERLOADING type family ResolveConfigMethod (t :: Symbol) (o :: *) :: * where ResolveConfigMethod "addFile" o = ConfigAddFileMethodInfo ResolveConfigMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveConfigMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveConfigMethod "deleteEntry" o = ConfigDeleteEntryMethodInfo ResolveConfigMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveConfigMethod "foreach" o = ConfigForeachMethodInfo ResolveConfigMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveConfigMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveConfigMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveConfigMethod "match" o = ConfigMatchMethodInfo ResolveConfigMethod "matchForeach" o = ConfigMatchForeachMethodInfo ResolveConfigMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveConfigMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveConfigMethod "openLevel" o = ConfigOpenLevelMethodInfo ResolveConfigMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveConfigMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveConfigMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveConfigMethod "snapshot" o = ConfigSnapshotMethodInfo ResolveConfigMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveConfigMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveConfigMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveConfigMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveConfigMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveConfigMethod "getBool" o = ConfigGetBoolMethodInfo ResolveConfigMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveConfigMethod "getEntry" o = ConfigGetEntryMethodInfo ResolveConfigMethod "getInt32" o = ConfigGetInt32MethodInfo ResolveConfigMethod "getInt64" o = ConfigGetInt64MethodInfo ResolveConfigMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveConfigMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveConfigMethod "getString" o = ConfigGetStringMethodInfo ResolveConfigMethod "setBool" o = ConfigSetBoolMethodInfo ResolveConfigMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveConfigMethod "setInt32" o = ConfigSetInt32MethodInfo ResolveConfigMethod "setInt64" o = ConfigSetInt64MethodInfo ResolveConfigMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveConfigMethod "setString" o = ConfigSetStringMethodInfo ResolveConfigMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveConfigMethod t Config, O.MethodInfo info Config p) => OL.IsLabel t (Config -> 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 #if ENABLE_OVERLOADING instance O.HasAttributeList Config type instance O.AttributeList Config = ConfigAttributeList type ConfigAttributeList = ('[ '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING #endif #if ENABLE_OVERLOADING type instance O.SignalList Config = ConfigSignalList type ConfigSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method Config::new -- method type : Constructor -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Config"})) -- throws : False -- Skip return : False foreign import ccall "ggit_config_new" ggit_config_new :: IO (Ptr Config) {- | Create a new config. See also @/ggit_config_get_default()/@ to get a 'GI.Ggit.Objects.Config.Config' representing the global, XDG and system configuration files. To get a 'GI.Ggit.Objects.Config.Config' for a repository use @/ggit_repository_get_config/@ instead. -} configNew :: (B.CallStack.HasCallStack, MonadIO m) => m Config {- ^ __Returns:__ a 'GI.Ggit.Objects.Config.Config'. -} configNew = liftIO $ do result <- ggit_config_new checkUnexpectedReturnNULL "configNew" result result' <- (wrapObject Config) result return result' #if ENABLE_OVERLOADING #endif -- method Config::new_default -- method type : Constructor -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Config"})) -- throws : True -- Skip return : False foreign import ccall "ggit_config_new_default" ggit_config_new_default :: Ptr (Ptr GError) -> -- error IO (Ptr Config) {- | Get the global, XDG and system configuration files merged into one 'GI.Ggit.Objects.Config.Config' with their appropriate priority levels. If an error occured trying to load the various configuration files, this function will return 'Nothing' and /@error@/ will be set accordingly. -} configNewDefault :: (B.CallStack.HasCallStack, MonadIO m) => m Config {- ^ __Returns:__ A 'GI.Ggit.Objects.Config.Config' /(Can throw 'Data.GI.Base.GError.GError')/ -} configNewDefault = liftIO $ do onException (do result <- propagateGError $ ggit_config_new_default checkUnexpectedReturnNULL "configNewDefault" result result' <- (newObject Config) result return result' ) (do return () ) #if ENABLE_OVERLOADING #endif -- method Config::new_from_file -- method type : Constructor -- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file to load.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Config"})) -- throws : True -- Skip return : False foreign import ccall "ggit_config_new_from_file" ggit_config_new_from_file :: Ptr Gio.File.File -> -- file : TInterface (Name {namespace = "Gio", name = "File"}) Ptr (Ptr GError) -> -- error IO (Ptr Config) {- | Create a new config from a single on disk file. This is a convenience API and is exactly the same as creating an empty 'GI.Ggit.Objects.Config.Config' using @/ggit_config_new/@ and adding the file with @/ggit_config_add_file/@. The level will be set to @/GGIT_CONFIG_LEVEL_LOCAL/@. If the config could not be loaded this function returns 'Nothing' and /@error@/ will be set accordingly. -} configNewFromFile :: (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) => a {- ^ /@file@/: the file to load. -} -> m Config {- ^ __Returns:__ a 'GI.Ggit.Objects.Config.Config'. /(Can throw 'Data.GI.Base.GError.GError')/ -} configNewFromFile file = liftIO $ do file' <- unsafeManagedPtrCastPtr file onException (do result <- propagateGError $ ggit_config_new_from_file file' checkUnexpectedReturnNULL "configNewFromFile" result result' <- (wrapObject Config) result touchManagedPtr file return result' ) (do return () ) #if ENABLE_OVERLOADING #endif -- method Config::add_file -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Ggit", name = "ConfigLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfigLevel.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if a config file already exists for the given priority level, replace it.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : True -- Skip return : False foreign import ccall "ggit_config_add_file" ggit_config_add_file :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) Ptr Gio.File.File -> -- file : TInterface (Name {namespace = "Gio", name = "File"}) CInt -> -- level : TInterface (Name {namespace = "Ggit", name = "ConfigLevel"}) CInt -> -- force : TBasicType TBoolean Ptr (Ptr GError) -> -- error IO () {- | Add an on-disk config file instance to an existing config The on-disk file pointed at by /@file@/ will be opened and parsed; it\'s expected to be a native Git config file following the default Git config syntax (see man git-config). Further queries on this config object will access each of the config file instances in order (instances with a higher priority level will be accessed first). -} configAddFile :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a, Gio.File.IsFile b) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> b {- ^ /@file@/: a 'GI.Gio.Interfaces.File.File'. -} -> Ggit.Enums.ConfigLevel {- ^ /@level@/: a 'GI.Ggit.Enums.ConfigLevel'. -} -> Bool {- ^ /@force@/: if a config file already exists for the given priority level, replace it. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configAddFile config file level force = liftIO $ do config' <- unsafeManagedPtrCastPtr config file' <- unsafeManagedPtrCastPtr file let level' = (fromIntegral . fromEnum) level let force' = (fromIntegral . fromEnum) force onException (do propagateGError $ ggit_config_add_file config' file' level' force' touchManagedPtr config touchManagedPtr file return () ) (do return () ) #if ENABLE_OVERLOADING data ConfigAddFileMethodInfo instance (signature ~ (b -> Ggit.Enums.ConfigLevel -> Bool -> m ()), MonadIO m, IsConfig a, Gio.File.IsFile b) => O.MethodInfo ConfigAddFileMethodInfo a signature where overloadedMethod _ = configAddFile #endif -- method Config::delete_entry -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_delete_entry" ggit_config_delete_entry :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt {- | Delete a config variable from the config file. -} configDeleteEntry :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the configuration value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configDeleteEntry config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do _ <- propagateGError $ ggit_config_delete_entry config' name' touchManagedPtr config freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigDeleteEntryMethodInfo instance (signature ~ (T.Text -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigDeleteEntryMethodInfo a signature where overloadedMethod _ = configDeleteEntry #endif -- method Config::foreach -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Ggit", name = "ConfigCallback"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfigCallback.", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the user data for @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_foreach" ggit_config_foreach :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) FunPtr Ggit.Callbacks.C_ConfigCallback -> -- callback : TInterface (Name {namespace = "Ggit", name = "ConfigCallback"}) Ptr () -> -- user_data : TBasicType TPtr Ptr (Ptr GError) -> -- error IO CInt {- | Call /@callback@/ for each configuration value. -} configForeach :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> Ggit.Callbacks.ConfigCallback {- ^ /@callback@/: a 'GI.Ggit.Callbacks.ConfigCallback'. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configForeach config callback = liftIO $ do config' <- unsafeManagedPtrCastPtr config callback' <- Ggit.Callbacks.mk_ConfigCallback (Ggit.Callbacks.wrap_ConfigCallback Nothing (Ggit.Callbacks.drop_closures_ConfigCallback callback)) let userData = nullPtr onException (do _ <- propagateGError $ ggit_config_foreach config' callback' userData safeFreeFunPtr $ castFunPtrToPtr callback' touchManagedPtr config return () ) (do safeFreeFunPtr $ castFunPtrToPtr callback' return () ) #if ENABLE_OVERLOADING data ConfigForeachMethodInfo instance (signature ~ (Ggit.Callbacks.ConfigCallback -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigForeachMethodInfo a signature where overloadedMethod _ = configForeach #endif -- method Config::get_bool -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_get_bool" ggit_config_get_bool :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt {- | Get a boolean configuration value. -} configGetBool :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configGetBool config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do _ <- propagateGError $ ggit_config_get_bool config' name' touchManagedPtr config freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigGetBoolMethodInfo instance (signature ~ (T.Text -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigGetBoolMethodInfo a signature where overloadedMethod _ = configGetBool #endif -- method Config::get_entry -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the configuration name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "ConfigEntry"})) -- throws : True -- Skip return : False foreign import ccall "ggit_config_get_entry" ggit_config_get_entry :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr Ggit.ConfigEntry.ConfigEntry) {- | Get 'GI.Ggit.Structs.ConfigEntry.ConfigEntry' of a config variable. -} configGetEntry :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the configuration name. -} -> m Ggit.ConfigEntry.ConfigEntry {- ^ __Returns:__ the entry of /@name@/, or 'Nothing' if such a value does not exist. /(Can throw 'Data.GI.Base.GError.GError')/ -} configGetEntry config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do result <- propagateGError $ ggit_config_get_entry config' name' checkUnexpectedReturnNULL "configGetEntry" result result' <- (wrapBoxed Ggit.ConfigEntry.ConfigEntry) result touchManagedPtr config freeMem name' return result' ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigGetEntryMethodInfo instance (signature ~ (T.Text -> m Ggit.ConfigEntry.ConfigEntry), MonadIO m, IsConfig a) => O.MethodInfo ConfigGetEntryMethodInfo a signature where overloadedMethod _ = configGetEntry #endif -- method Config::get_int32 -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TInt32) -- throws : True -- Skip return : False foreign import ccall "ggit_config_get_int32" ggit_config_get_int32 :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO Int32 {- | Get a int32 configuration value. -} configGetInt32 :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> m Int32 {- ^ __Returns:__ the value. /(Can throw 'Data.GI.Base.GError.GError')/ -} configGetInt32 config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do result <- propagateGError $ ggit_config_get_int32 config' name' touchManagedPtr config freeMem name' return result ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigGetInt32MethodInfo instance (signature ~ (T.Text -> m Int32), MonadIO m, IsConfig a) => O.MethodInfo ConfigGetInt32MethodInfo a signature where overloadedMethod _ = configGetInt32 #endif -- method Config::get_int64 -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TInt64) -- throws : True -- Skip return : False foreign import ccall "ggit_config_get_int64" ggit_config_get_int64 :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO Int64 {- | Get a int64 configuration value. -} configGetInt64 :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> m Int64 {- ^ __Returns:__ the value. /(Can throw 'Data.GI.Base.GError.GError')/ -} configGetInt64 config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do result <- propagateGError $ ggit_config_get_int64 config' name' touchManagedPtr config freeMem name' return result ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigGetInt64MethodInfo instance (signature ~ (T.Text -> m Int64), MonadIO m, IsConfig a) => O.MethodInfo ConfigGetInt64MethodInfo a signature where overloadedMethod _ = configGetInt64 #endif -- method Config::get_string -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "ggit_config_get_string" ggit_config_get_string :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CString {- | Get the configuration value of /@name@/ as string. -} configGetString :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> m (Maybe T.Text) {- ^ __Returns:__ the string value of /@name@/, or 'Nothing' if such a value does not exist /(Can throw 'Data.GI.Base.GError.GError')/ -} configGetString config name = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do result <- propagateGError $ ggit_config_get_string config' name' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- cstringToText result' return result'' touchManagedPtr config freeMem name' return maybeResult ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigGetStringMethodInfo instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m, IsConfig a) => O.MethodInfo ConfigGetStringMethodInfo a signature where overloadedMethod _ = configGetString #endif -- method Config::match -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMatchInfo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "ggit_config_match" ggit_config_match :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) Ptr GLib.Regex.Regex -> -- regex : TInterface (Name {namespace = "GLib", name = "Regex"}) Ptr (Ptr GLib.MatchInfo.MatchInfo) -> -- match_info : TInterface (Name {namespace = "GLib", name = "MatchInfo"}) Ptr (Ptr GError) -> -- error IO CString {- | Matches a configuration against a regular expression. /@matchInfo@/ will contain the match information if the return value is not 'Nothing', otherwise /@error@/ will be set. -} configMatch :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> GLib.Regex.Regex {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex'. -} -> m ((Maybe T.Text, GLib.MatchInfo.MatchInfo)) {- ^ __Returns:__ the value of that matched configuration /(Can throw 'Data.GI.Base.GError.GError')/ -} configMatch config regex = liftIO $ do config' <- unsafeManagedPtrCastPtr config regex' <- unsafeManagedPtrGetPtr regex matchInfo <- allocMem :: IO (Ptr (Ptr GLib.MatchInfo.MatchInfo)) onException (do result <- propagateGError $ ggit_config_match config' regex' matchInfo maybeResult <- convertIfNonNull result $ \result' -> do result'' <- cstringToText result' freeMem result' return result'' matchInfo' <- peek matchInfo matchInfo'' <- (wrapBoxed GLib.MatchInfo.MatchInfo) matchInfo' touchManagedPtr config touchManagedPtr regex freeMem matchInfo return (maybeResult, matchInfo'') ) (do freeMem matchInfo ) #if ENABLE_OVERLOADING data ConfigMatchMethodInfo instance (signature ~ (GLib.Regex.Regex -> m ((Maybe T.Text, GLib.MatchInfo.MatchInfo))), MonadIO m, IsConfig a) => O.MethodInfo ConfigMatchMethodInfo a signature where overloadedMethod _ = configMatch #endif -- method Config::match_foreach -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Ggit", name = "ConfigMatchCallback"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfigMatchCallback.", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the user data for @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_match_foreach" ggit_config_match_foreach :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) Ptr GLib.Regex.Regex -> -- regex : TInterface (Name {namespace = "GLib", name = "Regex"}) FunPtr Ggit.Callbacks.C_ConfigMatchCallback -> -- callback : TInterface (Name {namespace = "Ggit", name = "ConfigMatchCallback"}) Ptr () -> -- user_data : TBasicType TPtr Ptr (Ptr GError) -> -- error IO CInt {- | Call /@callback@/ for all configurations matching /@regex@/. -} configMatchForeach :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> GLib.Regex.Regex {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex'. -} -> Ggit.Callbacks.ConfigMatchCallback {- ^ /@callback@/: a 'GI.Ggit.Callbacks.ConfigMatchCallback'. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configMatchForeach config regex callback = liftIO $ do config' <- unsafeManagedPtrCastPtr config regex' <- unsafeManagedPtrGetPtr regex callback' <- Ggit.Callbacks.mk_ConfigMatchCallback (Ggit.Callbacks.wrap_ConfigMatchCallback Nothing (Ggit.Callbacks.drop_closures_ConfigMatchCallback callback)) let userData = nullPtr onException (do _ <- propagateGError $ ggit_config_match_foreach config' regex' callback' userData safeFreeFunPtr $ castFunPtrToPtr callback' touchManagedPtr config touchManagedPtr regex return () ) (do safeFreeFunPtr $ castFunPtrToPtr callback' return () ) #if ENABLE_OVERLOADING data ConfigMatchForeachMethodInfo instance (signature ~ (GLib.Regex.Regex -> Ggit.Callbacks.ConfigMatchCallback -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigMatchForeachMethodInfo a signature where overloadedMethod _ = configMatchForeach #endif -- method Config::open_level -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Ggit", name = "ConfigLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the level to open.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Config"})) -- throws : True -- Skip return : False foreign import ccall "ggit_config_open_level" ggit_config_open_level :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CInt -> -- level : TInterface (Name {namespace = "Ggit", name = "ConfigLevel"}) Ptr (Ptr GError) -> -- error IO (Ptr Config) {- | Open a specific level config derived from a multi-level one. -} configOpenLevel :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> Ggit.Enums.ConfigLevel {- ^ /@level@/: the level to open. -} -> m Config {- ^ __Returns:__ the configuration at /@level@/, or 'Nothing'. /(Can throw 'Data.GI.Base.GError.GError')/ -} configOpenLevel config level = liftIO $ do config' <- unsafeManagedPtrCastPtr config let level' = (fromIntegral . fromEnum) level onException (do result <- propagateGError $ ggit_config_open_level config' level' checkUnexpectedReturnNULL "configOpenLevel" result result' <- (wrapObject Config) result touchManagedPtr config return result' ) (do return () ) #if ENABLE_OVERLOADING data ConfigOpenLevelMethodInfo instance (signature ~ (Ggit.Enums.ConfigLevel -> m Config), MonadIO m, IsConfig a) => O.MethodInfo ConfigOpenLevelMethodInfo a signature where overloadedMethod _ = configOpenLevel #endif -- method Config::set_bool -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_set_bool" ggit_config_set_bool :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 CInt -> -- value : TBasicType TBoolean Ptr (Ptr GError) -> -- error IO CInt {- | Set a boolean value. -} configSetBool :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> Bool {- ^ /@value@/: the new value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configSetBool config name value = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name let value' = (fromIntegral . fromEnum) value onException (do _ <- propagateGError $ ggit_config_set_bool config' name' value' touchManagedPtr config freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigSetBoolMethodInfo instance (signature ~ (T.Text -> Bool -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigSetBoolMethodInfo a signature where overloadedMethod _ = configSetBool #endif -- method Config::set_int32 -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_set_int32" ggit_config_set_int32 :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Int32 -> -- value : TBasicType TInt32 Ptr (Ptr GError) -> -- error IO CInt {- | Set a int32 value. -} configSetInt32 :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> Int32 {- ^ /@value@/: the new value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configSetInt32 config name value = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do _ <- propagateGError $ ggit_config_set_int32 config' name' value touchManagedPtr config freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigSetInt32MethodInfo instance (signature ~ (T.Text -> Int32 -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigSetInt32MethodInfo a signature where overloadedMethod _ = configSetInt32 #endif -- method Config::set_int64 -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_set_int64" ggit_config_set_int64 :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 Int64 -> -- value : TBasicType TInt64 Ptr (Ptr GError) -> -- error IO CInt {- | Set a int64 value. -} configSetInt64 :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> Int64 {- ^ /@value@/: the new value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configSetInt64 config name value = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name onException (do _ <- propagateGError $ ggit_config_set_int64 config' name' value touchManagedPtr config freeMem name' return () ) (do freeMem name' ) #if ENABLE_OVERLOADING data ConfigSetInt64MethodInfo instance (signature ~ (T.Text -> Int64 -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigSetInt64MethodInfo a signature where overloadedMethod _ = configSetInt64 #endif -- method Config::set_string -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the configuration value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "ggit_config_set_string" ggit_config_set_string :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) CString -> -- name : TBasicType TUTF8 CString -> -- value : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt {- | Set a new string value of a configuration. -} configSetString :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> T.Text {- ^ /@name@/: the name of the configuration value. -} -> T.Text {- ^ /@value@/: the new value. -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} configSetString config name value = liftIO $ do config' <- unsafeManagedPtrCastPtr config name' <- textToCString name value' <- textToCString value onException (do _ <- propagateGError $ ggit_config_set_string config' name' value' touchManagedPtr config freeMem name' freeMem value' return () ) (do freeMem name' freeMem value' ) #if ENABLE_OVERLOADING data ConfigSetStringMethodInfo instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsConfig a) => O.MethodInfo ConfigSetStringMethodInfo a signature where overloadedMethod _ = configSetString #endif -- method Config::snapshot -- method type : OrdinaryMethod -- Args : [Arg {argCName = "config", argType = TInterface (Name {namespace = "Ggit", name = "Config"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfig.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Config"})) -- throws : True -- Skip return : False foreign import ccall "ggit_config_snapshot" ggit_config_snapshot :: Ptr Config -> -- config : TInterface (Name {namespace = "Ggit", name = "Config"}) Ptr (Ptr GError) -> -- error IO (Ptr Config) {- | Create a snapshot of the current state of the configuration, which allows you to look into a consistent view of the configuration for looking up complex values (e.g. a remote, submodule). -} configSnapshot :: (B.CallStack.HasCallStack, MonadIO m, IsConfig a) => a {- ^ /@config@/: a 'GI.Ggit.Objects.Config.Config'. -} -> m Config {- ^ __Returns:__ a new 'GI.Ggit.Objects.Config.Config', or 'Nothing' if an error occurred. /(Can throw 'Data.GI.Base.GError.GError')/ -} configSnapshot config = liftIO $ do config' <- unsafeManagedPtrCastPtr config onException (do result <- propagateGError $ ggit_config_snapshot config' checkUnexpectedReturnNULL "configSnapshot" result result' <- (wrapObject Config) result touchManagedPtr config return result' ) (do return () ) #if ENABLE_OVERLOADING data ConfigSnapshotMethodInfo instance (signature ~ (m Config), MonadIO m, IsConfig a) => O.MethodInfo ConfigSnapshotMethodInfo a signature where overloadedMethod _ = configSnapshot #endif -- method Config::find_global -- method type : MemberFunction -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"})) -- throws : False -- Skip return : False foreign import ccall "ggit_config_find_global" ggit_config_find_global :: IO (Ptr Gio.File.File) {- | Find the file representing the users global git configuration. This file is usually located at $HOME\/.gitconfig. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with @/ggit_config_new_from_file/@ or @/ggit_config_add_file/@. This function returns 'Nothing' if the global config could not be found. -} configFindGlobal :: (B.CallStack.HasCallStack, MonadIO m) => m Gio.File.File {- ^ __Returns:__ a 'GI.Gio.Interfaces.File.File' or 'Nothing' if the global config could not be found. -} configFindGlobal = liftIO $ do result <- ggit_config_find_global checkUnexpectedReturnNULL "configFindGlobal" result result' <- (wrapObject Gio.File.File) result return result' #if ENABLE_OVERLOADING #endif -- method Config::find_system -- method type : MemberFunction -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"})) -- throws : False -- Skip return : False foreign import ccall "ggit_config_find_system" ggit_config_find_system :: IO (Ptr Gio.File.File) {- | Find the file representing the systems global git configuration. This file is usually located at \/etc\/gitconfig on UNIX type systems or @/PROGRAMFILES/@%\\Git\\etc\\gitconfig on windows. This function will try to guess the full path to that file, if the file exists. The returned file may then be used with @/ggit_config_new_from_file/@ or @/ggit_config_add_file/@. This function returns 'Nothing' if the system config could not be found. -} configFindSystem :: (B.CallStack.HasCallStack, MonadIO m) => m Gio.File.File {- ^ __Returns:__ a 'GI.Gio.Interfaces.File.File' or 'Nothing' if the system config could not be found. -} configFindSystem = liftIO $ do result <- ggit_config_find_system checkUnexpectedReturnNULL "configFindSystem" result result' <- (wrapObject Gio.File.File) result return result' #if ENABLE_OVERLOADING #endif