{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GtkSource.Objects.SearchContext
    (

-- * Exported types
    SearchContext(..)                       ,
    IsSearchContext                         ,
    toSearchContext                         ,
    noSearchContext                         ,


 -- * Methods
-- ** backward #method:backward#

#if ENABLE_OVERLOADING
    SearchContextBackwardMethodInfo         ,
#endif
    searchContextBackward                   ,


-- ** backward2 #method:backward2#

#if ENABLE_OVERLOADING
    SearchContextBackward2MethodInfo        ,
#endif
    searchContextBackward2                  ,


-- ** backwardAsync #method:backwardAsync#

#if ENABLE_OVERLOADING
    SearchContextBackwardAsyncMethodInfo    ,
#endif
    searchContextBackwardAsync              ,


-- ** backwardFinish #method:backwardFinish#

#if ENABLE_OVERLOADING
    SearchContextBackwardFinishMethodInfo   ,
#endif
    searchContextBackwardFinish             ,


-- ** backwardFinish2 #method:backwardFinish2#

#if ENABLE_OVERLOADING
    SearchContextBackwardFinish2MethodInfo  ,
#endif
    searchContextBackwardFinish2            ,


-- ** forward #method:forward#

#if ENABLE_OVERLOADING
    SearchContextForwardMethodInfo          ,
#endif
    searchContextForward                    ,


-- ** forward2 #method:forward2#

#if ENABLE_OVERLOADING
    SearchContextForward2MethodInfo         ,
#endif
    searchContextForward2                   ,


-- ** forwardAsync #method:forwardAsync#

#if ENABLE_OVERLOADING
    SearchContextForwardAsyncMethodInfo     ,
#endif
    searchContextForwardAsync               ,


-- ** forwardFinish #method:forwardFinish#

#if ENABLE_OVERLOADING
    SearchContextForwardFinishMethodInfo    ,
#endif
    searchContextForwardFinish              ,


-- ** forwardFinish2 #method:forwardFinish2#

#if ENABLE_OVERLOADING
    SearchContextForwardFinish2MethodInfo   ,
#endif
    searchContextForwardFinish2             ,


-- ** getBuffer #method:getBuffer#

#if ENABLE_OVERLOADING
    SearchContextGetBufferMethodInfo        ,
#endif
    searchContextGetBuffer                  ,


-- ** getHighlight #method:getHighlight#

#if ENABLE_OVERLOADING
    SearchContextGetHighlightMethodInfo     ,
#endif
    searchContextGetHighlight               ,


-- ** getMatchStyle #method:getMatchStyle#

#if ENABLE_OVERLOADING
    SearchContextGetMatchStyleMethodInfo    ,
#endif
    searchContextGetMatchStyle              ,


-- ** getOccurrencePosition #method:getOccurrencePosition#

#if ENABLE_OVERLOADING
    SearchContextGetOccurrencePositionMethodInfo,
#endif
    searchContextGetOccurrencePosition      ,


-- ** getOccurrencesCount #method:getOccurrencesCount#

#if ENABLE_OVERLOADING
    SearchContextGetOccurrencesCountMethodInfo,
#endif
    searchContextGetOccurrencesCount        ,


-- ** getRegexError #method:getRegexError#

#if ENABLE_OVERLOADING
    SearchContextGetRegexErrorMethodInfo    ,
#endif
    searchContextGetRegexError              ,


-- ** getSettings #method:getSettings#

#if ENABLE_OVERLOADING
    SearchContextGetSettingsMethodInfo      ,
#endif
    searchContextGetSettings                ,


-- ** new #method:new#

    searchContextNew                        ,


-- ** replace #method:replace#

#if ENABLE_OVERLOADING
    SearchContextReplaceMethodInfo          ,
#endif
    searchContextReplace                    ,


-- ** replace2 #method:replace2#

#if ENABLE_OVERLOADING
    SearchContextReplace2MethodInfo         ,
#endif
    searchContextReplace2                   ,


-- ** replaceAll #method:replaceAll#

#if ENABLE_OVERLOADING
    SearchContextReplaceAllMethodInfo       ,
#endif
    searchContextReplaceAll                 ,


-- ** setHighlight #method:setHighlight#

#if ENABLE_OVERLOADING
    SearchContextSetHighlightMethodInfo     ,
#endif
    searchContextSetHighlight               ,


-- ** setMatchStyle #method:setMatchStyle#

#if ENABLE_OVERLOADING
    SearchContextSetMatchStyleMethodInfo    ,
#endif
    searchContextSetMatchStyle              ,


-- ** setSettings #method:setSettings#

#if ENABLE_OVERLOADING
    SearchContextSetSettingsMethodInfo      ,
#endif
    searchContextSetSettings                ,




 -- * Properties
-- ** buffer #attr:buffer#
{- | The 'GI.GtkSource.Objects.Buffer.Buffer' associated to the search context.

/Since: 3.10/
-}
#if ENABLE_OVERLOADING
    SearchContextBufferPropertyInfo         ,
#endif
    constructSearchContextBuffer            ,
    getSearchContextBuffer                  ,
#if ENABLE_OVERLOADING
    searchContextBuffer                     ,
#endif


-- ** highlight #attr:highlight#
{- | Highlight the search occurrences.

/Since: 3.10/
-}
#if ENABLE_OVERLOADING
    SearchContextHighlightPropertyInfo      ,
#endif
    constructSearchContextHighlight         ,
    getSearchContextHighlight               ,
#if ENABLE_OVERLOADING
    searchContextHighlight                  ,
#endif
    setSearchContextHighlight               ,


-- ** matchStyle #attr:matchStyle#
{- | A 'GI.GtkSource.Objects.Style.Style', or 'Nothing' for theme\'s scheme default style.

/Since: 3.16/
-}
#if ENABLE_OVERLOADING
    SearchContextMatchStylePropertyInfo     ,
#endif
    clearSearchContextMatchStyle            ,
    constructSearchContextMatchStyle        ,
    getSearchContextMatchStyle              ,
#if ENABLE_OVERLOADING
    searchContextMatchStyle                 ,
#endif
    setSearchContextMatchStyle              ,


-- ** occurrencesCount #attr:occurrencesCount#
{- | The total number of search occurrences. If the search is disabled,
the value is 0. If the buffer is not already fully scanned, the value
is -1.

/Since: 3.10/
-}
#if ENABLE_OVERLOADING
    SearchContextOccurrencesCountPropertyInfo,
#endif
    getSearchContextOccurrencesCount        ,
#if ENABLE_OVERLOADING
    searchContextOccurrencesCount           ,
#endif


-- ** regexError #attr:regexError#
{- | If the regex search pattern doesn\'t follow all the rules, this
property will be set. If the pattern is valid, the value is 'Nothing'.

Free with 'GI.GLib.Structs.Error.errorFree'.

/Since: 3.10/
-}
#if ENABLE_OVERLOADING
    SearchContextRegexErrorPropertyInfo     ,
#endif
    getSearchContextRegexError              ,
#if ENABLE_OVERLOADING
    searchContextRegexError                 ,
#endif


-- ** settings #attr:settings#
{- | The 'GI.GtkSource.Objects.SearchSettings.SearchSettings' associated to the search context.

/Since: 3.10/
-}
#if ENABLE_OVERLOADING
    SearchContextSettingsPropertyInfo       ,
#endif
    clearSearchContextSettings              ,
    constructSearchContextSettings          ,
    getSearchContextSettings                ,
#if ENABLE_OVERLOADING
    searchContextSettings                   ,
#endif
    setSearchContextSettings                ,




    ) 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
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gtk.Structs.TextIter as Gtk.TextIter
import {-# SOURCE #-} qualified GI.GtkSource.Objects.Buffer as GtkSource.Buffer
import {-# SOURCE #-} qualified GI.GtkSource.Objects.SearchSettings as GtkSource.SearchSettings
import {-# SOURCE #-} qualified GI.GtkSource.Objects.Style as GtkSource.Style

-- | Memory-managed wrapper type.
newtype SearchContext = SearchContext (ManagedPtr SearchContext)
foreign import ccall "gtk_source_search_context_get_type"
    c_gtk_source_search_context_get_type :: IO GType

instance GObject SearchContext where
    gobjectType = c_gtk_source_search_context_get_type


-- | Type class for types which can be safely cast to `SearchContext`, for instance with `toSearchContext`.
class (GObject o, O.IsDescendantOf SearchContext o) => IsSearchContext o
instance (GObject o, O.IsDescendantOf SearchContext o) => IsSearchContext o

instance O.HasParentTypes SearchContext
type instance O.ParentTypes SearchContext = '[GObject.Object.Object]

-- | Cast to `SearchContext`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toSearchContext :: (MonadIO m, IsSearchContext o) => o -> m SearchContext
toSearchContext = liftIO . unsafeCastTo SearchContext

-- | A convenience alias for `Nothing` :: `Maybe` `SearchContext`.
noSearchContext :: Maybe SearchContext
noSearchContext = Nothing

#if ENABLE_OVERLOADING
type family ResolveSearchContextMethod (t :: Symbol) (o :: *) :: * where
    ResolveSearchContextMethod "backward" o = SearchContextBackwardMethodInfo
    ResolveSearchContextMethod "backward2" o = SearchContextBackward2MethodInfo
    ResolveSearchContextMethod "backwardAsync" o = SearchContextBackwardAsyncMethodInfo
    ResolveSearchContextMethod "backwardFinish" o = SearchContextBackwardFinishMethodInfo
    ResolveSearchContextMethod "backwardFinish2" o = SearchContextBackwardFinish2MethodInfo
    ResolveSearchContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSearchContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSearchContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSearchContextMethod "forward" o = SearchContextForwardMethodInfo
    ResolveSearchContextMethod "forward2" o = SearchContextForward2MethodInfo
    ResolveSearchContextMethod "forwardAsync" o = SearchContextForwardAsyncMethodInfo
    ResolveSearchContextMethod "forwardFinish" o = SearchContextForwardFinishMethodInfo
    ResolveSearchContextMethod "forwardFinish2" o = SearchContextForwardFinish2MethodInfo
    ResolveSearchContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSearchContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSearchContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSearchContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSearchContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSearchContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSearchContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSearchContextMethod "replace" o = SearchContextReplaceMethodInfo
    ResolveSearchContextMethod "replace2" o = SearchContextReplace2MethodInfo
    ResolveSearchContextMethod "replaceAll" o = SearchContextReplaceAllMethodInfo
    ResolveSearchContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSearchContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSearchContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSearchContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSearchContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSearchContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSearchContextMethod "getBuffer" o = SearchContextGetBufferMethodInfo
    ResolveSearchContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSearchContextMethod "getHighlight" o = SearchContextGetHighlightMethodInfo
    ResolveSearchContextMethod "getMatchStyle" o = SearchContextGetMatchStyleMethodInfo
    ResolveSearchContextMethod "getOccurrencePosition" o = SearchContextGetOccurrencePositionMethodInfo
    ResolveSearchContextMethod "getOccurrencesCount" o = SearchContextGetOccurrencesCountMethodInfo
    ResolveSearchContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSearchContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSearchContextMethod "getRegexError" o = SearchContextGetRegexErrorMethodInfo
    ResolveSearchContextMethod "getSettings" o = SearchContextGetSettingsMethodInfo
    ResolveSearchContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSearchContextMethod "setHighlight" o = SearchContextSetHighlightMethodInfo
    ResolveSearchContextMethod "setMatchStyle" o = SearchContextSetMatchStyleMethodInfo
    ResolveSearchContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSearchContextMethod "setSettings" o = SearchContextSetSettingsMethodInfo
    ResolveSearchContextMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSearchContextMethod t SearchContext, O.MethodInfo info SearchContext p) => OL.IsLabel t (SearchContext -> 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 "buffer"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "Buffer"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@buffer@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #buffer
@
-}
getSearchContextBuffer :: (MonadIO m, IsSearchContext o) => o -> m GtkSource.Buffer.Buffer
getSearchContextBuffer obj = liftIO $ checkUnexpectedNothing "getSearchContextBuffer" $ B.Properties.getObjectPropertyObject obj "buffer" GtkSource.Buffer.Buffer

{- |
Construct a `GValueConstruct` with valid value for the “@buffer@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSearchContextBuffer :: (IsSearchContext o, GtkSource.Buffer.IsBuffer a) => a -> IO (GValueConstruct o)
constructSearchContextBuffer val = B.Properties.constructObjectPropertyObject "buffer" (Just val)

#if ENABLE_OVERLOADING
data SearchContextBufferPropertyInfo
instance AttrInfo SearchContextBufferPropertyInfo where
    type AttrAllowedOps SearchContextBufferPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SearchContextBufferPropertyInfo = GtkSource.Buffer.IsBuffer
    type AttrBaseTypeConstraint SearchContextBufferPropertyInfo = IsSearchContext
    type AttrGetType SearchContextBufferPropertyInfo = GtkSource.Buffer.Buffer
    type AttrLabel SearchContextBufferPropertyInfo = "buffer"
    type AttrOrigin SearchContextBufferPropertyInfo = SearchContext
    attrGet _ = getSearchContextBuffer
    attrSet _ = undefined
    attrConstruct _ = constructSearchContextBuffer
    attrClear _ = undefined
#endif

-- VVV Prop "highlight"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@highlight@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #highlight
@
-}
getSearchContextHighlight :: (MonadIO m, IsSearchContext o) => o -> m Bool
getSearchContextHighlight obj = liftIO $ B.Properties.getObjectPropertyBool obj "highlight"

{- |
Set the value of the “@highlight@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' searchContext [ #highlight 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSearchContextHighlight :: (MonadIO m, IsSearchContext o) => o -> Bool -> m ()
setSearchContextHighlight obj val = liftIO $ B.Properties.setObjectPropertyBool obj "highlight" val

{- |
Construct a `GValueConstruct` with valid value for the “@highlight@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSearchContextHighlight :: (IsSearchContext o) => Bool -> IO (GValueConstruct o)
constructSearchContextHighlight val = B.Properties.constructObjectPropertyBool "highlight" val

#if ENABLE_OVERLOADING
data SearchContextHighlightPropertyInfo
instance AttrInfo SearchContextHighlightPropertyInfo where
    type AttrAllowedOps SearchContextHighlightPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SearchContextHighlightPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SearchContextHighlightPropertyInfo = IsSearchContext
    type AttrGetType SearchContextHighlightPropertyInfo = Bool
    type AttrLabel SearchContextHighlightPropertyInfo = "highlight"
    type AttrOrigin SearchContextHighlightPropertyInfo = SearchContext
    attrGet _ = getSearchContextHighlight
    attrSet _ = setSearchContextHighlight
    attrConstruct _ = constructSearchContextHighlight
    attrClear _ = undefined
#endif

-- VVV Prop "match-style"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "Style"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just True)

{- |
Get the value of the “@match-style@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #matchStyle
@
-}
getSearchContextMatchStyle :: (MonadIO m, IsSearchContext o) => o -> m GtkSource.Style.Style
getSearchContextMatchStyle obj = liftIO $ checkUnexpectedNothing "getSearchContextMatchStyle" $ B.Properties.getObjectPropertyObject obj "match-style" GtkSource.Style.Style

{- |
Set the value of the “@match-style@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' searchContext [ #matchStyle 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSearchContextMatchStyle :: (MonadIO m, IsSearchContext o, GtkSource.Style.IsStyle a) => o -> a -> m ()
setSearchContextMatchStyle obj val = liftIO $ B.Properties.setObjectPropertyObject obj "match-style" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@match-style@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSearchContextMatchStyle :: (IsSearchContext o, GtkSource.Style.IsStyle a) => a -> IO (GValueConstruct o)
constructSearchContextMatchStyle val = B.Properties.constructObjectPropertyObject "match-style" (Just val)

{- |
Set the value of the “@match-style@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #matchStyle
@
-}
clearSearchContextMatchStyle :: (MonadIO m, IsSearchContext o) => o -> m ()
clearSearchContextMatchStyle obj = liftIO $ B.Properties.setObjectPropertyObject obj "match-style" (Nothing :: Maybe GtkSource.Style.Style)

#if ENABLE_OVERLOADING
data SearchContextMatchStylePropertyInfo
instance AttrInfo SearchContextMatchStylePropertyInfo where
    type AttrAllowedOps SearchContextMatchStylePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SearchContextMatchStylePropertyInfo = GtkSource.Style.IsStyle
    type AttrBaseTypeConstraint SearchContextMatchStylePropertyInfo = IsSearchContext
    type AttrGetType SearchContextMatchStylePropertyInfo = GtkSource.Style.Style
    type AttrLabel SearchContextMatchStylePropertyInfo = "match-style"
    type AttrOrigin SearchContextMatchStylePropertyInfo = SearchContext
    attrGet _ = getSearchContextMatchStyle
    attrSet _ = setSearchContextMatchStyle
    attrConstruct _ = constructSearchContextMatchStyle
    attrClear _ = clearSearchContextMatchStyle
#endif

-- VVV Prop "occurrences-count"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@occurrences-count@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #occurrencesCount
@
-}
getSearchContextOccurrencesCount :: (MonadIO m, IsSearchContext o) => o -> m Int32
getSearchContextOccurrencesCount obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "occurrences-count"

#if ENABLE_OVERLOADING
data SearchContextOccurrencesCountPropertyInfo
instance AttrInfo SearchContextOccurrencesCountPropertyInfo where
    type AttrAllowedOps SearchContextOccurrencesCountPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint SearchContextOccurrencesCountPropertyInfo = (~) ()
    type AttrBaseTypeConstraint SearchContextOccurrencesCountPropertyInfo = IsSearchContext
    type AttrGetType SearchContextOccurrencesCountPropertyInfo = Int32
    type AttrLabel SearchContextOccurrencesCountPropertyInfo = "occurrences-count"
    type AttrOrigin SearchContextOccurrencesCountPropertyInfo = SearchContext
    attrGet _ = getSearchContextOccurrencesCount
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "regex-error"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@regex-error@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #regexError
@
-}
getSearchContextRegexError :: (MonadIO m, IsSearchContext o) => o -> m (Ptr ())
getSearchContextRegexError obj = liftIO $ B.Properties.getObjectPropertyPtr obj "regex-error"

#if ENABLE_OVERLOADING
data SearchContextRegexErrorPropertyInfo
instance AttrInfo SearchContextRegexErrorPropertyInfo where
    type AttrAllowedOps SearchContextRegexErrorPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint SearchContextRegexErrorPropertyInfo = (~) ()
    type AttrBaseTypeConstraint SearchContextRegexErrorPropertyInfo = IsSearchContext
    type AttrGetType SearchContextRegexErrorPropertyInfo = (Ptr ())
    type AttrLabel SearchContextRegexErrorPropertyInfo = "regex-error"
    type AttrOrigin SearchContextRegexErrorPropertyInfo = SearchContext
    attrGet _ = getSearchContextRegexError
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

-- VVV Prop "settings"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "SearchSettings"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just True)

{- |
Get the value of the “@settings@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' searchContext #settings
@
-}
getSearchContextSettings :: (MonadIO m, IsSearchContext o) => o -> m GtkSource.SearchSettings.SearchSettings
getSearchContextSettings obj = liftIO $ checkUnexpectedNothing "getSearchContextSettings" $ B.Properties.getObjectPropertyObject obj "settings" GtkSource.SearchSettings.SearchSettings

{- |
Set the value of the “@settings@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' searchContext [ #settings 'Data.GI.Base.Attributes.:=' value ]
@
-}
setSearchContextSettings :: (MonadIO m, IsSearchContext o, GtkSource.SearchSettings.IsSearchSettings a) => o -> a -> m ()
setSearchContextSettings obj val = liftIO $ B.Properties.setObjectPropertyObject obj "settings" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@settings@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructSearchContextSettings :: (IsSearchContext o, GtkSource.SearchSettings.IsSearchSettings a) => a -> IO (GValueConstruct o)
constructSearchContextSettings val = B.Properties.constructObjectPropertyObject "settings" (Just val)

{- |
Set the value of the “@settings@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #settings
@
-}
clearSearchContextSettings :: (MonadIO m, IsSearchContext o) => o -> m ()
clearSearchContextSettings obj = liftIO $ B.Properties.setObjectPropertyObject obj "settings" (Nothing :: Maybe GtkSource.SearchSettings.SearchSettings)

#if ENABLE_OVERLOADING
data SearchContextSettingsPropertyInfo
instance AttrInfo SearchContextSettingsPropertyInfo where
    type AttrAllowedOps SearchContextSettingsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SearchContextSettingsPropertyInfo = GtkSource.SearchSettings.IsSearchSettings
    type AttrBaseTypeConstraint SearchContextSettingsPropertyInfo = IsSearchContext
    type AttrGetType SearchContextSettingsPropertyInfo = GtkSource.SearchSettings.SearchSettings
    type AttrLabel SearchContextSettingsPropertyInfo = "settings"
    type AttrOrigin SearchContextSettingsPropertyInfo = SearchContext
    attrGet _ = getSearchContextSettings
    attrSet _ = setSearchContextSettings
    attrConstruct _ = constructSearchContextSettings
    attrClear _ = clearSearchContextSettings
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList SearchContext
type instance O.AttributeList SearchContext = SearchContextAttributeList
type SearchContextAttributeList = ('[ '("buffer", SearchContextBufferPropertyInfo), '("highlight", SearchContextHighlightPropertyInfo), '("matchStyle", SearchContextMatchStylePropertyInfo), '("occurrencesCount", SearchContextOccurrencesCountPropertyInfo), '("regexError", SearchContextRegexErrorPropertyInfo), '("settings", SearchContextSettingsPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
searchContextBuffer :: AttrLabelProxy "buffer"
searchContextBuffer = AttrLabelProxy

searchContextHighlight :: AttrLabelProxy "highlight"
searchContextHighlight = AttrLabelProxy

searchContextMatchStyle :: AttrLabelProxy "matchStyle"
searchContextMatchStyle = AttrLabelProxy

searchContextOccurrencesCount :: AttrLabelProxy "occurrencesCount"
searchContextOccurrencesCount = AttrLabelProxy

searchContextRegexError :: AttrLabelProxy "regexError"
searchContextRegexError = AttrLabelProxy

searchContextSettings :: AttrLabelProxy "settings"
searchContextSettings = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList SearchContext = SearchContextSignalList
type SearchContextSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method SearchContext::new
-- method type : Constructor
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "settings", argType = TInterface (Name {namespace = "GtkSource", name = "SearchSettings"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchSettings, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "SearchContext"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_new" gtk_source_search_context_new ::
    Ptr GtkSource.Buffer.Buffer ->          -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.SearchSettings.SearchSettings -> -- settings : TInterface (Name {namespace = "GtkSource", name = "SearchSettings"})
    IO (Ptr SearchContext)

{- |
Creates a new search context, associated with /@buffer@/, and customized with
/@settings@/. If /@settings@/ is 'Nothing', a new 'GI.GtkSource.Objects.SearchSettings.SearchSettings' object will
be created, that you can retrieve with
'GI.GtkSource.Objects.SearchContext.searchContextGetSettings'.

/Since: 3.10/
-}
searchContextNew ::
    (B.CallStack.HasCallStack, MonadIO m, GtkSource.Buffer.IsBuffer a, GtkSource.SearchSettings.IsSearchSettings b) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Maybe (b)
    {- ^ /@settings@/: a 'GI.GtkSource.Objects.SearchSettings.SearchSettings', or 'Nothing'. -}
    -> m SearchContext
    {- ^ __Returns:__ a new search context. -}
searchContextNew buffer settings = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeSettings <- case settings of
        Nothing -> return nullPtr
        Just jSettings -> do
            jSettings' <- unsafeManagedPtrCastPtr jSettings
            return jSettings'
    result <- gtk_source_search_context_new buffer' maybeSettings
    checkUnexpectedReturnNULL "searchContextNew" result
    result' <- (wrapObject SearchContext) result
    touchManagedPtr buffer
    whenJust settings touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method SearchContext::backward
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_backward" gtk_source_search_context_backward ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO CInt

{-# DEPRECATED searchContextBackward ["(Since version 3.22)","Use 'GI.GtkSource.Objects.SearchContext.searchContextBackward2' instead."] #-}
{- |
Synchronous backward search. It is recommended to use the asynchronous
functions instead, to not block the user interface. However, if you are sure
that the /@buffer@/ is small, this function is more convenient to use.

/Since: 3.10/
-}
searchContextBackward ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))
    {- ^ __Returns:__ whether a match was found. -}
searchContextBackward search iter = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    result <- gtk_source_search_context_backward search' iter' matchStart matchEnd
    let result' = (/= 0) result
    matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
    matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
    touchManagedPtr search
    touchManagedPtr iter
    return (result', matchStart', matchEnd')

#if ENABLE_OVERLOADING
data SearchContextBackwardMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextBackwardMethodInfo a signature where
    overloadedMethod _ = searchContextBackward

#endif

-- method SearchContext::backward2
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "has_wrapped_around", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location to know whether the\n  search has wrapped around, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_backward2" gtk_source_search_context_backward2 ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr CInt ->                             -- has_wrapped_around : TBasicType TBoolean
    IO CInt

{- |
Synchronous backward search. It is recommended to use the asynchronous
functions instead, to not block the user interface. However, if you are sure
that the /@buffer@/ is small, this function is more convenient to use.

The difference with 'GI.GtkSource.Objects.SearchContext.searchContextBackward' is that the
/@hasWrappedAround@/ out parameter has been added for convenience.

If the 'GI.GtkSource.Objects.SearchSettings.SearchSettings':@/wrap-around/@ property is 'False', this function
doesn\'t try to wrap around.

The /@hasWrappedAround@/ out parameter is set independently of whether a match
is found. So if this function returns 'False', /@hasWrappedAround@/ will have
the same value as the 'GI.GtkSource.Objects.SearchSettings.SearchSettings':@/wrap-around/@ property.

/Since: 3.22/
-}
searchContextBackward2 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))
    {- ^ __Returns:__ whether a match was found. -}
searchContextBackward2 search iter = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    hasWrappedAround <- allocMem :: IO (Ptr CInt)
    result <- gtk_source_search_context_backward2 search' iter' matchStart matchEnd hasWrappedAround
    let result' = (/= 0) result
    matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
    matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
    hasWrappedAround' <- peek hasWrappedAround
    let hasWrappedAround'' = (/= 0) hasWrappedAround'
    touchManagedPtr search
    touchManagedPtr iter
    freeMem hasWrappedAround
    return (result', matchStart', matchEnd', hasWrappedAround'')

#if ENABLE_OVERLOADING
data SearchContextBackward2MethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextBackward2MethodInfo a signature where
    overloadedMethod _ = searchContextBackward2

#endif

-- method SearchContext::backward_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback to call when the operation is finished.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the data to pass to the @callback function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_backward_async" gtk_source_search_context_backward_async ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
The asynchronous version of 'GI.GtkSource.Objects.SearchContext.searchContextBackward2'.

See the documentation of 'GI.GtkSource.Objects.SearchContext.searchContextBackward2' for more
details.

See the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' documentation to know how to use this function.

If the operation is cancelled, the /@callback@/ will only be called if
/@cancellable@/ was not 'Nothing'. 'GI.GtkSource.Objects.SearchContext.searchContextBackwardAsync' takes
ownership of /@cancellable@/, so you can unref it after calling this function.

/Since: 3.10/
-}
searchContextBackwardAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable', or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback' to call when the operation is finished. -}
    -> m ()
searchContextBackwardAsync search iter cancellable callback = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    gtk_source_search_context_backward_async search' iter' maybeCancellable maybeCallback userData
    touchManagedPtr search
    touchManagedPtr iter
    whenJust cancellable touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data SearchContextBackwardAsyncMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSearchContext a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SearchContextBackwardAsyncMethodInfo a signature where
    overloadedMethod _ = searchContextBackwardAsync

#endif

-- method SearchContext::backward_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_search_context_backward_finish" gtk_source_search_context_backward_finish ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{-# DEPRECATED searchContextBackwardFinish ["(Since version 3.22)","Use 'GI.GtkSource.Objects.SearchContext.searchContextBackwardFinish2' instead."] #-}
{- |
Finishes a backward search started with
'GI.GtkSource.Objects.SearchContext.searchContextBackwardAsync'.

/Since: 3.10/
-}
searchContextBackwardFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextBackwardFinish search result_ = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result_' <- unsafeManagedPtrCastPtr result_
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    onException (do
        _ <- propagateGError $ gtk_source_search_context_backward_finish search' result_' matchStart matchEnd
        matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
        matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
        touchManagedPtr search
        touchManagedPtr result_
        return (matchStart', matchEnd')
     ) (do
        freeMem matchStart
        freeMem matchEnd
     )

#if ENABLE_OVERLOADING
data SearchContextBackwardFinishMethodInfo
instance (signature ~ (b -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))), MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SearchContextBackwardFinishMethodInfo a signature where
    overloadedMethod _ = searchContextBackwardFinish

#endif

-- method SearchContext::backward_finish2
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "has_wrapped_around", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location to know whether the\n  search has wrapped around, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_search_context_backward_finish2" gtk_source_search_context_backward_finish2 ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr CInt ->                             -- has_wrapped_around : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes a backward search started with
'GI.GtkSource.Objects.SearchContext.searchContextBackwardAsync'.

See the documentation of 'GI.GtkSource.Objects.SearchContext.searchContextBackward2' for more
details.

/Since: 3.22/
-}
searchContextBackwardFinish2 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextBackwardFinish2 search result_ = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result_' <- unsafeManagedPtrCastPtr result_
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    hasWrappedAround <- allocMem :: IO (Ptr CInt)
    onException (do
        _ <- propagateGError $ gtk_source_search_context_backward_finish2 search' result_' matchStart matchEnd hasWrappedAround
        matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
        matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
        hasWrappedAround' <- peek hasWrappedAround
        let hasWrappedAround'' = (/= 0) hasWrappedAround'
        touchManagedPtr search
        touchManagedPtr result_
        freeMem hasWrappedAround
        return (matchStart', matchEnd', hasWrappedAround'')
     ) (do
        freeMem matchStart
        freeMem matchEnd
        freeMem hasWrappedAround
     )

#if ENABLE_OVERLOADING
data SearchContextBackwardFinish2MethodInfo
instance (signature ~ (b -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))), MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SearchContextBackwardFinish2MethodInfo a signature where
    overloadedMethod _ = searchContextBackwardFinish2

#endif

-- method SearchContext::forward
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_forward" gtk_source_search_context_forward ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO CInt

{-# DEPRECATED searchContextForward ["(Since version 3.22)","Use 'GI.GtkSource.Objects.SearchContext.searchContextForward2' instead."] #-}
{- |
Synchronous forward search. It is recommended to use the asynchronous
functions instead, to not block the user interface. However, if you are sure
that the /@buffer@/ is small, this function is more convenient to use.

/Since: 3.10/
-}
searchContextForward ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))
    {- ^ __Returns:__ whether a match was found. -}
searchContextForward search iter = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    result <- gtk_source_search_context_forward search' iter' matchStart matchEnd
    let result' = (/= 0) result
    matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
    matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
    touchManagedPtr search
    touchManagedPtr iter
    return (result', matchStart', matchEnd')

#if ENABLE_OVERLOADING
data SearchContextForwardMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextForwardMethodInfo a signature where
    overloadedMethod _ = searchContextForward

#endif

-- method SearchContext::forward2
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "has_wrapped_around", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location to know whether the\n  search has wrapped around, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_forward2" gtk_source_search_context_forward2 ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr CInt ->                             -- has_wrapped_around : TBasicType TBoolean
    IO CInt

{- |
Synchronous forward search. It is recommended to use the asynchronous
functions instead, to not block the user interface. However, if you are sure
that the /@buffer@/ is small, this function is more convenient to use.

The difference with 'GI.GtkSource.Objects.SearchContext.searchContextForward' is that the
/@hasWrappedAround@/ out parameter has been added for convenience.

If the 'GI.GtkSource.Objects.SearchSettings.SearchSettings':@/wrap-around/@ property is 'False', this function
doesn\'t try to wrap around.

The /@hasWrappedAround@/ out parameter is set independently of whether a match
is found. So if this function returns 'False', /@hasWrappedAround@/ will have
the same value as the 'GI.GtkSource.Objects.SearchSettings.SearchSettings':@/wrap-around/@ property.

/Since: 3.22/
-}
searchContextForward2 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))
    {- ^ __Returns:__ whether a match was found. -}
searchContextForward2 search iter = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    hasWrappedAround <- allocMem :: IO (Ptr CInt)
    result <- gtk_source_search_context_forward2 search' iter' matchStart matchEnd hasWrappedAround
    let result' = (/= 0) result
    matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
    matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
    hasWrappedAround' <- peek hasWrappedAround
    let hasWrappedAround'' = (/= 0) hasWrappedAround'
    touchManagedPtr search
    touchManagedPtr iter
    freeMem hasWrappedAround
    return (result', matchStart', matchEnd', hasWrappedAround'')

#if ENABLE_OVERLOADING
data SearchContextForward2MethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextForward2MethodInfo a signature where
    overloadedMethod _ = searchContextForward2

#endif

-- method SearchContext::forward_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of search.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback to call when the operation is finished.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the data to pass to the @callback function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_forward_async" gtk_source_search_context_forward_async ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
The asynchronous version of 'GI.GtkSource.Objects.SearchContext.searchContextForward2'.

See the documentation of 'GI.GtkSource.Objects.SearchContext.searchContextForward2' for more
details.

See the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' documentation to know how to use this function.

If the operation is cancelled, the /@callback@/ will only be called if
/@cancellable@/ was not 'Nothing'. 'GI.GtkSource.Objects.SearchContext.searchContextForwardAsync' takes
ownership of /@cancellable@/, so you can unref it after calling this function.

/Since: 3.10/
-}
searchContextForwardAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: start of search. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable', or 'Nothing'. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback' to call when the operation is finished. -}
    -> m ()
searchContextForwardAsync search iter cancellable callback = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    iter' <- unsafeManagedPtrGetPtr iter
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    gtk_source_search_context_forward_async search' iter' maybeCancellable maybeCallback userData
    touchManagedPtr search
    touchManagedPtr iter
    whenJust cancellable touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data SearchContextForwardAsyncMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSearchContext a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SearchContextForwardAsyncMethodInfo a signature where
    overloadedMethod _ = searchContextForwardAsync

#endif

-- method SearchContext::forward_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_search_context_forward_finish" gtk_source_search_context_forward_finish ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{-# DEPRECATED searchContextForwardFinish ["(Since version 3.22)","Use 'GI.GtkSource.Objects.SearchContext.searchContextForwardFinish2' instead."] #-}
{- |
Finishes a forward search started with
'GI.GtkSource.Objects.SearchContext.searchContextForwardAsync'.

/Since: 3.10/
-}
searchContextForwardFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextForwardFinish search result_ = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result_' <- unsafeManagedPtrCastPtr result_
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    onException (do
        _ <- propagateGError $ gtk_source_search_context_forward_finish search' result_' matchStart matchEnd
        matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
        matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
        touchManagedPtr search
        touchManagedPtr result_
        return (matchStart', matchEnd')
     ) (do
        freeMem matchStart
        freeMem matchEnd
     )

#if ENABLE_OVERLOADING
data SearchContextForwardFinishMethodInfo
instance (signature ~ (b -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))), MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SearchContextForwardFinishMethodInfo a signature where
    overloadedMethod _ = searchContextForwardFinish

#endif

-- method SearchContext::forward_finish2
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for start of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of match, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "has_wrapped_around", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location to know whether the\n  search has wrapped around, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_search_context_forward_finish2" gtk_source_search_context_forward_finish2 ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr CInt ->                             -- has_wrapped_around : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes a forward search started with
'GI.GtkSource.Objects.SearchContext.searchContextForwardAsync'.

See the documentation of 'GI.GtkSource.Objects.SearchContext.searchContextForward2' for more
details.

/Since: 3.22/
-}
searchContextForwardFinish2 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextForwardFinish2 search result_ = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result_' <- unsafeManagedPtrCastPtr result_
    matchStart <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    matchEnd <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
    hasWrappedAround <- allocMem :: IO (Ptr CInt)
    onException (do
        _ <- propagateGError $ gtk_source_search_context_forward_finish2 search' result_' matchStart matchEnd hasWrappedAround
        matchStart' <- (wrapBoxed Gtk.TextIter.TextIter) matchStart
        matchEnd' <- (wrapBoxed Gtk.TextIter.TextIter) matchEnd
        hasWrappedAround' <- peek hasWrappedAround
        let hasWrappedAround'' = (/= 0) hasWrappedAround'
        touchManagedPtr search
        touchManagedPtr result_
        freeMem hasWrappedAround
        return (matchStart', matchEnd', hasWrappedAround'')
     ) (do
        freeMem matchStart
        freeMem matchEnd
        freeMem hasWrappedAround
     )

#if ENABLE_OVERLOADING
data SearchContextForwardFinish2MethodInfo
instance (signature ~ (b -> m ((Gtk.TextIter.TextIter, Gtk.TextIter.TextIter, Bool))), MonadIO m, IsSearchContext a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SearchContextForwardFinish2MethodInfo a signature where
    overloadedMethod _ = searchContextForwardFinish2

#endif

-- method SearchContext::get_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Buffer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_get_buffer" gtk_source_search_context_get_buffer ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO (Ptr GtkSource.Buffer.Buffer)

{- |
/No description available in the introspection data./

/Since: 3.10/
-}
searchContextGetBuffer ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m GtkSource.Buffer.Buffer
    {- ^ __Returns:__ the associated buffer. -}
searchContextGetBuffer search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_buffer search'
    checkUnexpectedReturnNULL "searchContextGetBuffer" result
    result' <- (newObject GtkSource.Buffer.Buffer) result
    touchManagedPtr search
    return result'

#if ENABLE_OVERLOADING
data SearchContextGetBufferMethodInfo
instance (signature ~ (m GtkSource.Buffer.Buffer), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetBufferMethodInfo a signature where
    overloadedMethod _ = searchContextGetBuffer

#endif

-- method SearchContext::get_highlight
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_get_highlight" gtk_source_search_context_get_highlight ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO CInt

{- |
/No description available in the introspection data./

/Since: 3.10/
-}
searchContextGetHighlight ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m Bool
    {- ^ __Returns:__ whether to highlight the search occurrences. -}
searchContextGetHighlight search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_highlight search'
    let result' = (/= 0) result
    touchManagedPtr search
    return result'

#if ENABLE_OVERLOADING
data SearchContextGetHighlightMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetHighlightMethodInfo a signature where
    overloadedMethod _ = searchContextGetHighlight

#endif

-- method SearchContext::get_match_style
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Style"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_get_match_style" gtk_source_search_context_get_match_style ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO (Ptr GtkSource.Style.Style)

{- |
/No description available in the introspection data./

/Since: 3.16/
-}
searchContextGetMatchStyle ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m GtkSource.Style.Style
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.Style.Style' to apply on search matches. -}
searchContextGetMatchStyle search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_match_style search'
    checkUnexpectedReturnNULL "searchContextGetMatchStyle" result
    result' <- (newObject GtkSource.Style.Style) result
    touchManagedPtr search
    return result'

#if ENABLE_OVERLOADING
data SearchContextGetMatchStyleMethodInfo
instance (signature ~ (m GtkSource.Style.Style), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetMatchStyleMethodInfo a signature where
    overloadedMethod _ = searchContextGetMatchStyle

#endif

-- method SearchContext::get_occurrence_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the occurrence.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the occurrence.", 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 "gtk_source_search_context_get_occurrence_position" gtk_source_search_context_get_occurrence_position ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO Int32

{- |
Gets the position of a search occurrence. If the buffer is not already fully
scanned, the position may be unknown, and -1 is returned. If 0 is returned,
it means that this part of the buffer has already been scanned, and that
/@matchStart@/ and /@matchEnd@/ don\'t delimit an occurrence.

/Since: 3.10/
-}
searchContextGetOccurrencePosition ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchStart@/: the start of the occurrence. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchEnd@/: the end of the occurrence. -}
    -> m Int32
    {- ^ __Returns:__ the position of the search occurrence. The first occurrence has the
position 1 (not 0). Returns 0 if /@matchStart@/ and /@matchEnd@/ don\'t delimit
an occurrence. Returns -1 if the position is not yet known. -}
searchContextGetOccurrencePosition search matchStart matchEnd = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    matchStart' <- unsafeManagedPtrGetPtr matchStart
    matchEnd' <- unsafeManagedPtrGetPtr matchEnd
    result <- gtk_source_search_context_get_occurrence_position search' matchStart' matchEnd'
    touchManagedPtr search
    touchManagedPtr matchStart
    touchManagedPtr matchEnd
    return result

#if ENABLE_OVERLOADING
data SearchContextGetOccurrencePositionMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m Int32), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetOccurrencePositionMethodInfo a signature where
    overloadedMethod _ = searchContextGetOccurrencePosition

#endif

-- method SearchContext::get_occurrences_count
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", 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 "gtk_source_search_context_get_occurrences_count" gtk_source_search_context_get_occurrences_count ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO Int32

{- |
Gets the total number of search occurrences. If the buffer is not already
fully scanned, the total number of occurrences is unknown, and -1 is
returned.

/Since: 3.10/
-}
searchContextGetOccurrencesCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m Int32
    {- ^ __Returns:__ the total number of search occurrences, or -1 if unknown. -}
searchContextGetOccurrencesCount search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_occurrences_count search'
    touchManagedPtr search
    return result

#if ENABLE_OVERLOADING
data SearchContextGetOccurrencesCountMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetOccurrencesCountMethodInfo a signature where
    overloadedMethod _ = searchContextGetOccurrencesCount

#endif

-- method SearchContext::get_regex_error
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TError
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_get_regex_error" gtk_source_search_context_get_regex_error ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO (Ptr GError)

{- |
Regular expression patterns must follow certain rules. If
'GI.GtkSource.Objects.SearchSettings.SearchSettings':@/search-text/@ breaks a rule, the error can be retrieved
with this function. The error domain is @/G_REGEX_ERROR/@.

Free the return value with 'GI.GLib.Structs.Error.errorFree'.

/Since: 3.10/
-}
searchContextGetRegexError ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m (Maybe GError)
    {- ^ __Returns:__ the 'GError', or 'Nothing' if the pattern is valid. -}
searchContextGetRegexError search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_regex_error search'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed GError) result'
        return result''
    touchManagedPtr search
    return maybeResult

#if ENABLE_OVERLOADING
data SearchContextGetRegexErrorMethodInfo
instance (signature ~ (m (Maybe GError)), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetRegexErrorMethodInfo a signature where
    overloadedMethod _ = searchContextGetRegexError

#endif

-- method SearchContext::get_settings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "SearchSettings"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_get_settings" gtk_source_search_context_get_settings ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    IO (Ptr GtkSource.SearchSettings.SearchSettings)

{- |
/No description available in the introspection data./

/Since: 3.10/
-}
searchContextGetSettings ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> m GtkSource.SearchSettings.SearchSettings
    {- ^ __Returns:__ the search settings. -}
searchContextGetSettings search = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    result <- gtk_source_search_context_get_settings search'
    checkUnexpectedReturnNULL "searchContextGetSettings" result
    result' <- (newObject GtkSource.SearchSettings.SearchSettings) result
    touchManagedPtr search
    return result'

#if ENABLE_OVERLOADING
data SearchContextGetSettingsMethodInfo
instance (signature ~ (m GtkSource.SearchSettings.SearchSettings), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextGetSettingsMethodInfo a signature where
    overloadedMethod _ = searchContextGetSettings

#endif

-- method SearchContext::replace
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the match to replace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the match to replace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the replacement text.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace_length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @replace in bytes, or -1.", 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 "gtk_source_search_context_replace" gtk_source_search_context_replace ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- replace : TBasicType TUTF8
    Int32 ->                                -- replace_length : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{-# DEPRECATED searchContextReplace ["(Since version 3.22)","Use 'GI.GtkSource.Objects.SearchContext.searchContextReplace2' instead."] #-}
{- |
Replaces a search match by another text. If /@matchStart@/ and /@matchEnd@/
doesn\'t correspond to a search match, 'False' is returned.

For a regular expression replacement, you can check if /@replace@/ is valid by
calling 'GI.GLib.Functions.regexCheckReplacement'. The /@replace@/ text can contain
backreferences; read the 'GI.GLib.Structs.Regex.regexReplace' documentation for more details.

/Since: 3.10/
-}
searchContextReplace ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchStart@/: the start of the match to replace. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchEnd@/: the end of the match to replace. -}
    -> T.Text
    {- ^ /@replace@/: the replacement text. -}
    -> Int32
    {- ^ /@replaceLength@/: the length of /@replace@/ in bytes, or -1. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextReplace search matchStart matchEnd replace replaceLength = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    matchStart' <- unsafeManagedPtrGetPtr matchStart
    matchEnd' <- unsafeManagedPtrGetPtr matchEnd
    replace' <- textToCString replace
    onException (do
        _ <- propagateGError $ gtk_source_search_context_replace search' matchStart' matchEnd' replace' replaceLength
        touchManagedPtr search
        touchManagedPtr matchStart
        touchManagedPtr matchEnd
        freeMem replace'
        return ()
     ) (do
        freeMem replace'
     )

#if ENABLE_OVERLOADING
data SearchContextReplaceMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> T.Text -> Int32 -> m ()), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextReplaceMethodInfo a signature where
    overloadedMethod _ = searchContextReplace

#endif

-- method SearchContext::replace2
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the match to replace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the match to replace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the replacement text.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace_length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @replace in bytes, or -1.", 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 "gtk_source_search_context_replace2" gtk_source_search_context_replace2 ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr Gtk.TextIter.TextIter ->            -- match_start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- match_end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- replace : TBasicType TUTF8
    Int32 ->                                -- replace_length : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Replaces a search match by another text. If /@matchStart@/ and /@matchEnd@/
doesn\'t correspond to a search match, 'False' is returned.

Unlike with 'GI.GtkSource.Objects.SearchContext.searchContextReplace', the /@matchStart@/ and
/@matchEnd@/ iters are revalidated to point to the replacement text boundaries.

For a regular expression replacement, you can check if /@replace@/ is valid by
calling 'GI.GLib.Functions.regexCheckReplacement'. The /@replace@/ text can contain
backreferences; read the 'GI.GLib.Structs.Regex.regexReplace' documentation for more details.

/Since: 3.22/
-}
searchContextReplace2 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchStart@/: the start of the match to replace. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@matchEnd@/: the end of the match to replace. -}
    -> T.Text
    {- ^ /@replace@/: the replacement text. -}
    -> Int32
    {- ^ /@replaceLength@/: the length of /@replace@/ in bytes, or -1. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextReplace2 search matchStart matchEnd replace replaceLength = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    matchStart' <- unsafeManagedPtrGetPtr matchStart
    matchEnd' <- unsafeManagedPtrGetPtr matchEnd
    replace' <- textToCString replace
    onException (do
        _ <- propagateGError $ gtk_source_search_context_replace2 search' matchStart' matchEnd' replace' replaceLength
        touchManagedPtr search
        touchManagedPtr matchStart
        touchManagedPtr matchEnd
        freeMem replace'
        return ()
     ) (do
        freeMem replace'
     )

#if ENABLE_OVERLOADING
data SearchContextReplace2MethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> T.Text -> Int32 -> m ()), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextReplace2MethodInfo a signature where
    overloadedMethod _ = searchContextReplace2

#endif

-- method SearchContext::replace_all
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the replacement text.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replace_length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @replace in bytes, or -1.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_search_context_replace_all" gtk_source_search_context_replace_all ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    CString ->                              -- replace : TBasicType TUTF8
    Int32 ->                                -- replace_length : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO Word32

{- |
Replaces all search matches by another text. It is a synchronous function, so
it can block the user interface.

For a regular expression replacement, you can check if /@replace@/ is valid by
calling 'GI.GLib.Functions.regexCheckReplacement'. The /@replace@/ text can contain
backreferences; read the 'GI.GLib.Structs.Regex.regexReplace' documentation for more details.

/Since: 3.10/
-}
searchContextReplaceAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> T.Text
    {- ^ /@replace@/: the replacement text. -}
    -> Int32
    {- ^ /@replaceLength@/: the length of /@replace@/ in bytes, or -1. -}
    -> m Word32
    {- ^ __Returns:__ the number of replaced matches. /(Can throw 'Data.GI.Base.GError.GError')/ -}
searchContextReplaceAll search replace replaceLength = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    replace' <- textToCString replace
    onException (do
        result <- propagateGError $ gtk_source_search_context_replace_all search' replace' replaceLength
        touchManagedPtr search
        freeMem replace'
        return result
     ) (do
        freeMem replace'
     )

#if ENABLE_OVERLOADING
data SearchContextReplaceAllMethodInfo
instance (signature ~ (T.Text -> Int32 -> m Word32), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextReplaceAllMethodInfo a signature where
    overloadedMethod _ = searchContextReplaceAll

#endif

-- method SearchContext::set_highlight
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "highlight", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the setting.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_set_highlight" gtk_source_search_context_set_highlight ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    CInt ->                                 -- highlight : TBasicType TBoolean
    IO ()

{- |
Enables or disables the search occurrences highlighting.

/Since: 3.10/
-}
searchContextSetHighlight ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Bool
    {- ^ /@highlight@/: the setting. -}
    -> m ()
searchContextSetHighlight search highlight = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    let highlight' = (fromIntegral . fromEnum) highlight
    gtk_source_search_context_set_highlight search' highlight'
    touchManagedPtr search
    return ()

#if ENABLE_OVERLOADING
data SearchContextSetHighlightMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSearchContext a) => O.MethodInfo SearchContextSetHighlightMethodInfo a signature where
    overloadedMethod _ = searchContextSetHighlight

#endif

-- method SearchContext::set_match_style
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_style", argType = TInterface (Name {namespace = "GtkSource", name = "Style"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkSourceStyle, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_set_match_style" gtk_source_search_context_set_match_style ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr GtkSource.Style.Style ->            -- match_style : TInterface (Name {namespace = "GtkSource", name = "Style"})
    IO ()

{- |
Set the style to apply on search matches. If /@matchStyle@/ is 'Nothing', default
theme\'s scheme \'match-style\' will be used.
To enable or disable the search highlighting, use
'GI.GtkSource.Objects.SearchContext.searchContextSetHighlight'.

/Since: 3.16/
-}
searchContextSetMatchStyle ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, GtkSource.Style.IsStyle b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Maybe (b)
    {- ^ /@matchStyle@/: a 'GI.GtkSource.Objects.Style.Style', or 'Nothing'. -}
    -> m ()
searchContextSetMatchStyle search matchStyle = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    maybeMatchStyle <- case matchStyle of
        Nothing -> return nullPtr
        Just jMatchStyle -> do
            jMatchStyle' <- unsafeManagedPtrCastPtr jMatchStyle
            return jMatchStyle'
    gtk_source_search_context_set_match_style search' maybeMatchStyle
    touchManagedPtr search
    whenJust matchStyle touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data SearchContextSetMatchStyleMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsSearchContext a, GtkSource.Style.IsStyle b) => O.MethodInfo SearchContextSetMatchStyleMethodInfo a signature where
    overloadedMethod _ = searchContextSetMatchStyle

#endif

-- method SearchContext::set_settings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "search", argType = TInterface (Name {namespace = "GtkSource", name = "SearchContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSearchContext.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "settings", argType = TInterface (Name {namespace = "GtkSource", name = "SearchSettings"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the new #GtkSourceSearchSettings, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_search_context_set_settings" gtk_source_search_context_set_settings ::
    Ptr SearchContext ->                    -- search : TInterface (Name {namespace = "GtkSource", name = "SearchContext"})
    Ptr GtkSource.SearchSettings.SearchSettings -> -- settings : TInterface (Name {namespace = "GtkSource", name = "SearchSettings"})
    IO ()

{-# DEPRECATED searchContextSetSettings ["(Since version 3.24)","The 'GI.GtkSource.Objects.SearchContext.SearchContext':@/settings/@ property will become a","construct-only property in a future version. Create a new","'GI.GtkSource.Objects.SearchContext.SearchContext' instead, or change the 'GI.GtkSource.Objects.SearchSettings.SearchSettings'","properties. When the 'GI.GtkSource.Objects.SearchContext.SearchContext':@/settings/@ property will become","construct-only, it will be possible to simplify some code that needed to","listen to the notify::settings signal."] #-}
{- |
Associate a 'GI.GtkSource.Objects.SearchSettings.SearchSettings' with the search context. If /@settings@/ is
'Nothing', a new one will be created.

The search context holds a reference to /@settings@/.

/Since: 3.10/
-}
searchContextSetSettings ::
    (B.CallStack.HasCallStack, MonadIO m, IsSearchContext a, GtkSource.SearchSettings.IsSearchSettings b) =>
    a
    {- ^ /@search@/: a 'GI.GtkSource.Objects.SearchContext.SearchContext'. -}
    -> Maybe (b)
    {- ^ /@settings@/: the new 'GI.GtkSource.Objects.SearchSettings.SearchSettings', or 'Nothing'. -}
    -> m ()
searchContextSetSettings search settings = liftIO $ do
    search' <- unsafeManagedPtrCastPtr search
    maybeSettings <- case settings of
        Nothing -> return nullPtr
        Just jSettings -> do
            jSettings' <- unsafeManagedPtrCastPtr jSettings
            return jSettings'
    gtk_source_search_context_set_settings search' maybeSettings
    touchManagedPtr search
    whenJust settings touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data SearchContextSetSettingsMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsSearchContext a, GtkSource.SearchSettings.IsSearchSettings b) => O.MethodInfo SearchContextSetSettingsMethodInfo a signature where
    overloadedMethod _ = searchContextSetSettings

#endif