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

The g_regex_*() functions implement regular
expression pattern matching using syntax and semantics similar to
Perl regular expression.

Some functions accept a /@startPosition@/ argument, setting it differs
from just passing over a shortened string and setting @/G_REGEX_MATCH_NOTBOL/@
in the case of a pattern that begins with any kind of lookbehind assertion.
For example, consider the pattern \"\\Biss\\B\" which finds occurrences of \"iss\"
in the middle of words. (\"\\B\" matches only if the current position in the
subject is not a word boundary.) When applied to the string \"Mississipi\"
from the fourth byte, namely \"issipi\", it does not match, because \"\\B\" is
always false at the start of the subject, which is deemed to be a word
boundary. However, if the entire string is passed , but with
/@startPosition@/ set to 4, it finds the second occurrence of \"iss\" because
it is able to look behind the starting point to discover that it is
preceded by a letter.

Note that, unless you set the @/G_REGEX_RAW/@ flag, all the strings passed
to these functions must be encoded in UTF-8. The lengths and the positions
inside the strings are in bytes and not in characters, so, for instance,
\"\\xc3\\xa0\" (i.e. \"à\") is two bytes long but it is treated as a
single character. If you set @/G_REGEX_RAW/@ the strings can be non-valid
UTF-8 strings and a byte is treated as a character, so \"\\xc3\\xa0\" is two
bytes and two characters long.

When matching a pattern, \"\\n\" matches only against a \"\\n\" character in
the string, and \"\\r\" matches only a \"\\r\" character. To match any newline
sequence use \"\\R\". This particular group matches either the two-character
sequence CR + LF (\"\\r\\n\"), or one of the single characters LF (linefeed,
U+000A, \"\\n\"), VT vertical tab, U+000B, \"\\v\"), FF (formfeed, U+000C, \"\\f\"),
CR (carriage return, U+000D, \"\\r\"), NEL (next line, U+0085), LS (line
separator, U+2028), or PS (paragraph separator, U+2029).

The behaviour of the dot, circumflex, and dollar metacharacters are
affected by newline characters, the default is to recognize any newline
character (the same characters recognized by \"\\R\"). This can be changed
with @/G_REGEX_NEWLINE_CR/@, @/G_REGEX_NEWLINE_LF/@ and @/G_REGEX_NEWLINE_CRLF/@
compile options, and with @/G_REGEX_MATCH_NEWLINE_ANY/@,
@/G_REGEX_MATCH_NEWLINE_CR/@, @/G_REGEX_MATCH_NEWLINE_LF/@ and
@/G_REGEX_MATCH_NEWLINE_CRLF/@ match options. These settings are also
relevant when compiling a pattern if @/G_REGEX_EXTENDED/@ is set, and an
unescaped \"#\" outside a character class is encountered. This indicates
a comment that lasts until after the next newline.

When setting the 'GI.GLib.Flags.RegexCompileFlagsJavascriptCompat' flag, pattern syntax and pattern
matching is changed to be compatible with the way that regular expressions
work in JavaScript. More precisely, a lonely \']\' character in the pattern
is a syntax error; the \'\\x\' escape only allows 0 to 2 hexadecimal digits, and
you must use the \'\\u\' escape sequence with 4 hex digits to specify a unicode
codepoint instead of \'\\x\' or \'x{....}\'. If \'\\x\' or \'\\u\' are not followed by
the specified number of hex digits, they match \'x\' and \'u\' literally; also
\'\\U\' always matches \'U\' instead of being an error in the pattern. Finally,
pattern matching is modified so that back references to an unset subpattern
group produces a match with the empty string instead of an error. See
pcreapi(3) for more information.

Creating and manipulating the same 'GI.GLib.Structs.Regex.Regex' structure from different
threads is not a problem as 'GI.GLib.Structs.Regex.Regex' does not modify its internal
state between creation and destruction, on the other hand 'GI.GLib.Structs.MatchInfo.MatchInfo'
is not threadsafe.

The regular expressions low-level functionalities are obtained through
the excellent
<http://www.pcre.org/ PCRE>
library written by Philip Hazel.

@since 2.14
-}

module GI.GLib.Structs.Regex
    ( 

-- * Exported types
    Regex(..)                               ,
    noRegex                                 ,


 -- * Methods
-- ** checkReplacement #method:checkReplacement#

    regexCheckReplacement                   ,


-- ** errorQuark #method:errorQuark#

    regexErrorQuark                         ,


-- ** escapeNul #method:escapeNul#

    regexEscapeNul                          ,


-- ** escapeString #method:escapeString#

    regexEscapeString                       ,


-- ** getCaptureCount #method:getCaptureCount#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetCaptureCountMethodInfo          ,
#endif
    regexGetCaptureCount                    ,


-- ** getCompileFlags #method:getCompileFlags#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetCompileFlagsMethodInfo          ,
#endif
    regexGetCompileFlags                    ,


-- ** getHasCrOrLf #method:getHasCrOrLf#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetHasCrOrLfMethodInfo             ,
#endif
    regexGetHasCrOrLf                       ,


-- ** getMatchFlags #method:getMatchFlags#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetMatchFlagsMethodInfo            ,
#endif
    regexGetMatchFlags                      ,


-- ** getMaxBackref #method:getMaxBackref#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetMaxBackrefMethodInfo            ,
#endif
    regexGetMaxBackref                      ,


-- ** getMaxLookbehind #method:getMaxLookbehind#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetMaxLookbehindMethodInfo         ,
#endif
    regexGetMaxLookbehind                   ,


-- ** getPattern #method:getPattern#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetPatternMethodInfo               ,
#endif
    regexGetPattern                         ,


-- ** getStringNumber #method:getStringNumber#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexGetStringNumberMethodInfo          ,
#endif
    regexGetStringNumber                    ,


-- ** match #method:match#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexMatchMethodInfo                    ,
#endif
    regexMatch                              ,


-- ** matchAll #method:matchAll#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexMatchAllMethodInfo                 ,
#endif
    regexMatchAll                           ,


-- ** matchAllFull #method:matchAllFull#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexMatchAllFullMethodInfo             ,
#endif
    regexMatchAllFull                       ,


-- ** matchFull #method:matchFull#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexMatchFullMethodInfo                ,
#endif
    regexMatchFull                          ,


-- ** matchSimple #method:matchSimple#

    regexMatchSimple                        ,


-- ** new #method:new#

    regexNew                                ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexRefMethodInfo                      ,
#endif
    regexRef                                ,


-- ** replace #method:replace#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexReplaceMethodInfo                  ,
#endif
    regexReplace                            ,


-- ** replaceLiteral #method:replaceLiteral#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexReplaceLiteralMethodInfo           ,
#endif
    regexReplaceLiteral                     ,


-- ** split #method:split#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexSplitMethodInfo                    ,
#endif
    regexSplit                              ,


-- ** splitFull #method:splitFull#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexSplitFullMethodInfo                ,
#endif
    regexSplitFull                          ,


-- ** splitSimple #method:splitSimple#

    regexSplitSimple                        ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegexUnrefMethodInfo                    ,
#endif
    regexUnref                              ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.MatchInfo as GLib.MatchInfo

-- | Memory-managed wrapper type.
newtype Regex = Regex (ManagedPtr Regex)
foreign import ccall "g_regex_get_type" c_g_regex_get_type :: 
    IO GType

instance BoxedObject Regex where
    boxedType _ = c_g_regex_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `Regex`.
noRegex :: Maybe Regex
noRegex = Nothing


#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Regex
type instance O.AttributeList Regex = RegexAttributeList
type RegexAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method Regex::new
-- method type : Constructor
-- Args : [Arg {argCName = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the regular expression", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compile_options", argType = TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "compile options for the regular expression, or 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options for the regular expression, or 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Regex"}))
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_new" g_regex_new :: 
    CString ->                              -- pattern : TBasicType TUTF8
    CUInt ->                                -- compile_options : TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"})
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Regex)

{- |
Compiles the regular expression to an internal form, and does
the initial setup of the 'GI.GLib.Structs.Regex.Regex' structure.

@since 2.14
-}
regexNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@pattern@/: the regular expression -}
    -> [GLib.Flags.RegexCompileFlags]
    {- ^ /@compileOptions@/: compile options for the regular expression, or 0 -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options for the regular expression, or 0 -}
    -> m (Maybe Regex)
    {- ^ __Returns:__ a 'GI.GLib.Structs.Regex.Regex' structure or 'Nothing' if an error occured. Call
  'GI.GLib.Structs.Regex.regexUnref' when you are done with it /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexNew pattern compileOptions matchOptions = liftIO $ do
    pattern' <- textToCString pattern
    let compileOptions' = gflagsToWord compileOptions
    let matchOptions' = gflagsToWord matchOptions
    onException (do
        result <- propagateGError $ g_regex_new pattern' compileOptions' matchOptions'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (wrapBoxed Regex) result'
            return result''
        freeMem pattern'
        return maybeResult
     ) (do
        freeMem pattern'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::get_capture_count
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_get_capture_count" g_regex_get_capture_count :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO Int32

{- |
Returns the number of capturing subpatterns in the pattern.

@since 2.14
-}
regexGetCaptureCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m Int32
    {- ^ __Returns:__ the number of capturing subpatterns -}
regexGetCaptureCount regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_capture_count regex'
    touchManagedPtr regex
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetCaptureCountMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo RegexGetCaptureCountMethodInfo Regex signature where
    overloadedMethod _ = regexGetCaptureCount

#endif

-- method Regex::get_compile_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_get_compile_flags" g_regex_get_compile_flags :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO CUInt

{- |
Returns the compile options that /@regex@/ was created with.

Depending on the version of PCRE that is used, this may or may not
include flags set by option expressions such as @(?i)@ found at the
top-level within the compiled pattern.

@since 2.26
-}
regexGetCompileFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m [GLib.Flags.RegexCompileFlags]
    {- ^ __Returns:__ flags from 'GI.GLib.Flags.RegexCompileFlags' -}
regexGetCompileFlags regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_compile_flags regex'
    let result' = wordToGFlags result
    touchManagedPtr regex
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetCompileFlagsMethodInfo
instance (signature ~ (m [GLib.Flags.RegexCompileFlags]), MonadIO m) => O.MethodInfo RegexGetCompileFlagsMethodInfo Regex signature where
    overloadedMethod _ = regexGetCompileFlags

#endif

-- method Regex::get_has_cr_or_lf
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", 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 "g_regex_get_has_cr_or_lf" g_regex_get_has_cr_or_lf :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO CInt

{- |
Checks whether the pattern contains explicit CR or LF references.

@since 2.34
-}
regexGetHasCrOrLf ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the pattern contains explicit CR or LF references -}
regexGetHasCrOrLf regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_has_cr_or_lf regex'
    let result' = (/= 0) result
    touchManagedPtr regex
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetHasCrOrLfMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo RegexGetHasCrOrLfMethodInfo Regex signature where
    overloadedMethod _ = regexGetHasCrOrLf

#endif

-- method Regex::get_match_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_get_match_flags" g_regex_get_match_flags :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO CUInt

{- |
Returns the match options that /@regex@/ was created with.

@since 2.26
-}
regexGetMatchFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m [GLib.Flags.RegexMatchFlags]
    {- ^ __Returns:__ flags from 'GI.GLib.Flags.RegexMatchFlags' -}
regexGetMatchFlags regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_match_flags regex'
    let result' = wordToGFlags result
    touchManagedPtr regex
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetMatchFlagsMethodInfo
instance (signature ~ (m [GLib.Flags.RegexMatchFlags]), MonadIO m) => O.MethodInfo RegexGetMatchFlagsMethodInfo Regex signature where
    overloadedMethod _ = regexGetMatchFlags

#endif

-- method Regex::get_max_backref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_get_max_backref" g_regex_get_max_backref :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO Int32

{- |
Returns the number of the highest back reference
in the pattern, or 0 if the pattern does not contain
back references.

@since 2.14
-}
regexGetMaxBackref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m Int32
    {- ^ __Returns:__ the number of the highest back reference -}
regexGetMaxBackref regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_max_backref regex'
    touchManagedPtr regex
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetMaxBackrefMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo RegexGetMaxBackrefMethodInfo Regex signature where
    overloadedMethod _ = regexGetMaxBackref

#endif

-- method Regex::get_max_lookbehind
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", 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 "g_regex_get_max_lookbehind" g_regex_get_max_lookbehind :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO Int32

{- |
Gets the number of characters in the longest lookbehind assertion in the
pattern. This information is useful when doing multi-segment matching using
the partial matching facilities.

@since 2.38
-}
regexGetMaxLookbehind ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> m Int32
    {- ^ __Returns:__ the number of characters in the longest lookbehind assertion. -}
regexGetMaxLookbehind regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_max_lookbehind regex'
    touchManagedPtr regex
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetMaxLookbehindMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo RegexGetMaxLookbehindMethodInfo Regex signature where
    overloadedMethod _ = regexGetMaxLookbehind

#endif

-- method Regex::get_pattern
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_get_pattern" g_regex_get_pattern :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO CString

{- |
Gets the pattern string associated with /@regex@/, i.e. a copy of
the string passed to 'GI.GLib.Structs.Regex.regexNew'.

@since 2.14
-}
regexGetPattern ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> m T.Text
    {- ^ __Returns:__ the pattern of /@regex@/ -}
regexGetPattern regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_get_pattern regex'
    checkUnexpectedReturnNULL "regexGetPattern" result
    result' <- cstringToText result
    touchManagedPtr regex
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetPatternMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo RegexGetPatternMethodInfo Regex signature where
    overloadedMethod _ = regexGetPattern

#endif

-- method Regex::get_string_number
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the subexpression", 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 "g_regex_get_string_number" g_regex_get_string_number :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    CString ->                              -- name : TBasicType TUTF8
    IO Int32

{- |
Retrieves the number of the subexpression named /@name@/.

@since 2.14
-}
regexGetStringNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: 'GI.GLib.Structs.Regex.Regex' structure -}
    -> T.Text
    {- ^ /@name@/: name of the subexpression -}
    -> m Int32
    {- ^ __Returns:__ The number of the subexpression or -1 if /@name@/
  does not exists -}
regexGetStringNumber regex name = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    name' <- textToCString name
    result <- g_regex_get_string_number regex' name'
    touchManagedPtr regex
    freeMem name'
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexGetStringNumberMethodInfo
instance (signature ~ (T.Text -> m Int32), MonadIO m) => O.MethodInfo RegexGetStringNumberMethodInfo Regex signature where
    overloadedMethod _ = regexGetStringNumber

#endif

-- method Regex::match
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure from g_regex_new()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to location where to store\n    the #GMatchInfo, or %NULL if you do not need it", 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 "g_regex_match" g_regex_match :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    CString ->                              -- string : TBasicType TUTF8
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GLib.MatchInfo.MatchInfo) ->   -- match_info : TInterface (Name {namespace = "GLib", name = "MatchInfo"})
    IO CInt

{- |
Scans for a match in string for the pattern in /@regex@/.
The /@matchOptions@/ are combined with the match options specified
when the /@regex@/ structure was created, letting you have more
flexibility in reusing 'GI.GLib.Structs.Regex.Regex' structures.

A 'GI.GLib.Structs.MatchInfo.MatchInfo' structure, used to get information on the match,
is stored in /@matchInfo@/ if not 'Nothing'. Note that if /@matchInfo@/
is not 'Nothing' then it is created even if the function returns 'False',
i.e. you must free it regardless if regular expression actually matched.

To retrieve all the non-overlapping matches of the pattern in
string you can use 'GI.GLib.Structs.MatchInfo.matchInfoNext'.


=== /C code/
>
>static void
>print_uppercase_words (const gchar *string)
>{
>  // Print all uppercase-only words.
>  GRegex *regex;
>  GMatchInfo *match_info;
> 
>  regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
>  g_regex_match (regex, string, 0, &match_info);
>  while (g_match_info_matches (match_info))
>    {
>      gchar *word = g_match_info_fetch (match_info, 0);
>      g_print ("Found: %s\n", word);
>      g_free (word);
>      g_match_info_next (match_info, NULL);
>    }
>  g_match_info_free (match_info);
>  g_regex_unref (regex);
>}


/@string@/ is not copied and is used in 'GI.GLib.Structs.MatchInfo.MatchInfo' internally. If
you use any 'GI.GLib.Structs.MatchInfo.MatchInfo' method (except 'GI.GLib.Structs.MatchInfo.matchInfoFree') after
freeing or modifying /@string@/ then the behaviour is undefined.

@since 2.14
-}
regexMatch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure from 'GI.GLib.Structs.Regex.regexNew' -}
    -> T.Text
    {- ^ /@string@/: the string to scan for matches -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options -}
    -> m ((Bool, GLib.MatchInfo.MatchInfo))
    {- ^ __Returns:__ 'True' is the string matched, 'False' otherwise -}
regexMatch regex string matchOptions = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- textToCString string
    let matchOptions' = gflagsToWord matchOptions
    matchInfo <- allocMem :: IO (Ptr (Ptr GLib.MatchInfo.MatchInfo))
    result <- g_regex_match regex' string' matchOptions' matchInfo
    let result' = (/= 0) result
    matchInfo' <- peek matchInfo
    matchInfo'' <- (wrapBoxed GLib.MatchInfo.MatchInfo) matchInfo'
    touchManagedPtr regex
    freeMem string'
    freeMem matchInfo
    return (result', matchInfo'')

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexMatchMethodInfo
instance (signature ~ (T.Text -> [GLib.Flags.RegexMatchFlags] -> m ((Bool, GLib.MatchInfo.MatchInfo))), MonadIO m) => O.MethodInfo RegexMatchMethodInfo Regex signature where
    overloadedMethod _ = regexMatch

#endif

-- method Regex::match_all
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure from g_regex_new()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to location where to store\n    the #GMatchInfo, or %NULL if you do not need it", 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 "g_regex_match_all" g_regex_match_all :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    CString ->                              -- string : TBasicType TUTF8
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GLib.MatchInfo.MatchInfo) ->   -- match_info : TInterface (Name {namespace = "GLib", name = "MatchInfo"})
    IO CInt

{- |
Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved. This function uses
a different algorithm so it can retrieve all the possible matches.
For more documentation see 'GI.GLib.Structs.Regex.regexMatchAllFull'.

A 'GI.GLib.Structs.MatchInfo.MatchInfo' structure, used to get information on the match, is
stored in /@matchInfo@/ if not 'Nothing'. Note that if /@matchInfo@/ is
not 'Nothing' then it is created even if the function returns 'False',
i.e. you must free it regardless if regular expression actually
matched.

/@string@/ is not copied and is used in 'GI.GLib.Structs.MatchInfo.MatchInfo' internally. If
you use any 'GI.GLib.Structs.MatchInfo.MatchInfo' method (except 'GI.GLib.Structs.MatchInfo.matchInfoFree') after
freeing or modifying /@string@/ then the behaviour is undefined.

@since 2.14
-}
regexMatchAll ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure from 'GI.GLib.Structs.Regex.regexNew' -}
    -> T.Text
    {- ^ /@string@/: the string to scan for matches -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options -}
    -> m ((Bool, GLib.MatchInfo.MatchInfo))
    {- ^ __Returns:__ 'True' is the string matched, 'False' otherwise -}
regexMatchAll regex string matchOptions = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- textToCString string
    let matchOptions' = gflagsToWord matchOptions
    matchInfo <- allocMem :: IO (Ptr (Ptr GLib.MatchInfo.MatchInfo))
    result <- g_regex_match_all regex' string' matchOptions' matchInfo
    let result' = (/= 0) result
    matchInfo' <- peek matchInfo
    matchInfo'' <- (wrapBoxed GLib.MatchInfo.MatchInfo) matchInfo'
    touchManagedPtr regex
    freeMem string'
    freeMem matchInfo
    return (result', matchInfo'')

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexMatchAllMethodInfo
instance (signature ~ (T.Text -> [GLib.Flags.RegexMatchFlags] -> m ((Bool, GLib.MatchInfo.MatchInfo))), MonadIO m) => O.MethodInfo RegexMatchAllMethodInfo Regex signature where
    overloadedMethod _ = regexMatchAll

#endif

-- method Regex::match_all_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure from g_regex_new()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TCArray False (-1) 2 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_position", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "starting index of the string to match, in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to location where to store\n    the #GMatchInfo, or %NULL if you do not need it", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_match_all_full" g_regex_match_all_full :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    Ptr CString ->                          -- string : TCArray False (-1) 2 (TBasicType TUTF8)
    Int64 ->                                -- string_len : TBasicType TInt64
    Int32 ->                                -- start_position : TBasicType TInt
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GLib.MatchInfo.MatchInfo) ->   -- match_info : TInterface (Name {namespace = "GLib", name = "MatchInfo"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved, it is not possible
to obtain all the available matches. For instance matching
\"\<a> \<b> \<c>\" against the pattern \"\<.*>\"
you get \"\<a> \<b> \<c>\".

This function uses a different algorithm (called DFA, i.e. deterministic
finite automaton), so it can retrieve all the possible matches, all
starting at the same point in the string. For instance matching
\"\<a> \<b> \<c>\" against the pattern \"\<.*>;\"
you would obtain three matches: \"\<a> \<b> \<c>\",
\"\<a> \<b>\" and \"\<a>\".

The number of matched strings is retrieved using
'GI.GLib.Structs.MatchInfo.matchInfoGetMatchCount'. To obtain the matched strings and
their position you can use, respectively, 'GI.GLib.Structs.MatchInfo.matchInfoFetch' and
'GI.GLib.Structs.MatchInfo.matchInfoFetchPos'. Note that the strings are returned in
reverse order of length; that is, the longest matching string is
given first.

Note that the DFA algorithm is slower than the standard one and it
is not able to capture substrings, so backreferences do not work.

Setting /@startPosition@/ differs from just passing over a shortened
string and setting @/G_REGEX_MATCH_NOTBOL/@ in the case of a pattern
that begins with any kind of lookbehind assertion, such as \"\\b\".

A 'GI.GLib.Structs.MatchInfo.MatchInfo' structure, used to get information on the match, is
stored in /@matchInfo@/ if not 'Nothing'. Note that if /@matchInfo@/ is
not 'Nothing' then it is created even if the function returns 'False',
i.e. you must free it regardless if regular expression actually
matched.

/@string@/ is not copied and is used in 'GI.GLib.Structs.MatchInfo.MatchInfo' internally. If
you use any 'GI.GLib.Structs.MatchInfo.MatchInfo' method (except 'GI.GLib.Structs.MatchInfo.matchInfoFree') after
freeing or modifying /@string@/ then the behaviour is undefined.

@since 2.14
-}
regexMatchAllFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure from 'GI.GLib.Structs.Regex.regexNew' -}
    -> [T.Text]
    {- ^ /@string@/: the string to scan for matches -}
    -> Int32
    {- ^ /@startPosition@/: starting index of the string to match, in bytes -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options -}
    -> m (GLib.MatchInfo.MatchInfo)
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexMatchAllFull regex string startPosition matchOptions = liftIO $ do
    let stringLen = fromIntegral $ length string
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- packUTF8CArray string
    let matchOptions' = gflagsToWord matchOptions
    matchInfo <- allocMem :: IO (Ptr (Ptr GLib.MatchInfo.MatchInfo))
    onException (do
        _ <- propagateGError $ g_regex_match_all_full regex' string' stringLen startPosition matchOptions' matchInfo
        matchInfo' <- peek matchInfo
        matchInfo'' <- (wrapBoxed GLib.MatchInfo.MatchInfo) matchInfo'
        touchManagedPtr regex
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem matchInfo
        return matchInfo''
     ) (do
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem matchInfo
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexMatchAllFullMethodInfo
instance (signature ~ ([T.Text] -> Int32 -> [GLib.Flags.RegexMatchFlags] -> m (GLib.MatchInfo.MatchInfo)), MonadIO m) => O.MethodInfo RegexMatchAllFullMethodInfo Regex signature where
    overloadedMethod _ = regexMatchAllFull

#endif

-- method Regex::match_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure from g_regex_new()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TCArray False (-1) 2 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_position", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "starting index of the string to match, in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to location where to store\n    the #GMatchInfo, or %NULL if you do not need it", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_match_full" g_regex_match_full :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    Ptr CString ->                          -- string : TCArray False (-1) 2 (TBasicType TUTF8)
    Int64 ->                                -- string_len : TBasicType TInt64
    Int32 ->                                -- start_position : TBasicType TInt
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GLib.MatchInfo.MatchInfo) ->   -- match_info : TInterface (Name {namespace = "GLib", name = "MatchInfo"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Scans for a match in string for the pattern in /@regex@/.
The /@matchOptions@/ are combined with the match options specified
when the /@regex@/ structure was created, letting you have more
flexibility in reusing 'GI.GLib.Structs.Regex.Regex' structures.

Setting /@startPosition@/ differs from just passing over a shortened
string and setting @/G_REGEX_MATCH_NOTBOL/@ in the case of a pattern
that begins with any kind of lookbehind assertion, such as \"\\b\".

A 'GI.GLib.Structs.MatchInfo.MatchInfo' structure, used to get information on the match, is
stored in /@matchInfo@/ if not 'Nothing'. Note that if /@matchInfo@/ is
not 'Nothing' then it is created even if the function returns 'False',
i.e. you must free it regardless if regular expression actually
matched.

/@string@/ is not copied and is used in 'GI.GLib.Structs.MatchInfo.MatchInfo' internally. If
you use any 'GI.GLib.Structs.MatchInfo.MatchInfo' method (except 'GI.GLib.Structs.MatchInfo.matchInfoFree') after
freeing or modifying /@string@/ then the behaviour is undefined.

To retrieve all the non-overlapping matches of the pattern in
string you can use 'GI.GLib.Structs.MatchInfo.matchInfoNext'.


=== /C code/
>
>static void
>print_uppercase_words (const gchar *string)
>{
>  // Print all uppercase-only words.
>  GRegex *regex;
>  GMatchInfo *match_info;
>  GError *error = NULL;
>  
>  regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
>  g_regex_match_full (regex, string, -1, 0, 0, &match_info, &error);
>  while (g_match_info_matches (match_info))
>    {
>      gchar *word = g_match_info_fetch (match_info, 0);
>      g_print ("Found: %s\n", word);
>      g_free (word);
>      g_match_info_next (match_info, &error);
>    }
>  g_match_info_free (match_info);
>  g_regex_unref (regex);
>  if (error != NULL)
>    {
>      g_printerr ("Error while matching: %s\n", error->message);
>      g_error_free (error);
>    }
>}


@since 2.14
-}
regexMatchFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure from 'GI.GLib.Structs.Regex.regexNew' -}
    -> [T.Text]
    {- ^ /@string@/: the string to scan for matches -}
    -> Int32
    {- ^ /@startPosition@/: starting index of the string to match, in bytes -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options -}
    -> m (GLib.MatchInfo.MatchInfo)
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexMatchFull regex string startPosition matchOptions = liftIO $ do
    let stringLen = fromIntegral $ length string
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- packUTF8CArray string
    let matchOptions' = gflagsToWord matchOptions
    matchInfo <- allocMem :: IO (Ptr (Ptr GLib.MatchInfo.MatchInfo))
    onException (do
        _ <- propagateGError $ g_regex_match_full regex' string' stringLen startPosition matchOptions' matchInfo
        matchInfo' <- peek matchInfo
        matchInfo'' <- (wrapBoxed GLib.MatchInfo.MatchInfo) matchInfo'
        touchManagedPtr regex
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem matchInfo
        return matchInfo''
     ) (do
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem matchInfo
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexMatchFullMethodInfo
instance (signature ~ ([T.Text] -> Int32 -> [GLib.Flags.RegexMatchFlags] -> m (GLib.MatchInfo.MatchInfo)), MonadIO m) => O.MethodInfo RegexMatchFullMethodInfo Regex signature where
    overloadedMethod _ = regexMatchFull

#endif

-- method Regex::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Regex"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_ref" g_regex_ref :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO (Ptr Regex)

{- |
Increases reference count of /@regex@/ by 1.

@since 2.14
-}
regexRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m Regex
    {- ^ __Returns:__ /@regex@/ -}
regexRef regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    result <- g_regex_ref regex'
    checkUnexpectedReturnNULL "regexRef" result
    result' <- (wrapBoxed Regex) result
    touchManagedPtr regex
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexRefMethodInfo
instance (signature ~ (m Regex), MonadIO m) => O.MethodInfo RegexRefMethodInfo Regex signature where
    overloadedMethod _ = regexRef

#endif

-- method Regex::replace
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TCArray False (-1) 2 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to perform matches against", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_position", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "starting index of the string to match, in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replacement", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "text to replace each match with", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "options for the match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_replace" g_regex_replace :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    Ptr CString ->                          -- string : TCArray False (-1) 2 (TBasicType TUTF8)
    Int64 ->                                -- string_len : TBasicType TInt64
    Int32 ->                                -- start_position : TBasicType TInt
    CString ->                              -- replacement : TBasicType TUTF8
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Replaces all occurrences of the pattern in /@regex@/ with the
replacement text. Backreferences of the form \'\\number\' or
\'\\g\<number>\' in the replacement text are interpolated by the
number-th captured subexpression of the match, \'\\g\<name>\' refers
to the captured subexpression with the given name. \'\\0\' refers
to the complete match, but \'\\0\' followed by a number is the octal
representation of a character. To include a literal \'\\\' in the
replacement, write \'\\\'.

There are also escapes that changes the case of the following text:

* \\l: Convert to lower case the next character
* \\u: Convert to upper case the next character
* \\L: Convert to lower case till \\E
* \\U: Convert to upper case till \\E
* \\E: End case modification


If you do not need to use backreferences use 'GI.GLib.Structs.Regex.regexReplaceLiteral'.

The /@replacement@/ string must be UTF-8 encoded even if @/G_REGEX_RAW/@ was
passed to 'GI.GLib.Structs.Regex.regexNew'. If you want to use not UTF-8 encoded stings
you can use 'GI.GLib.Structs.Regex.regexReplaceLiteral'.

Setting /@startPosition@/ differs from just passing over a shortened
string and setting @/G_REGEX_MATCH_NOTBOL/@ in the case of a pattern that
begins with any kind of lookbehind assertion, such as \"\\b\".

@since 2.14
-}
regexReplace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> [T.Text]
    {- ^ /@string@/: the string to perform matches against -}
    -> Int32
    {- ^ /@startPosition@/: starting index of the string to match, in bytes -}
    -> T.Text
    {- ^ /@replacement@/: text to replace each match with -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: options for the match -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string containing the replacements /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexReplace regex string startPosition replacement matchOptions = liftIO $ do
    let stringLen = fromIntegral $ length string
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- packUTF8CArray string
    replacement' <- textToCString replacement
    let matchOptions' = gflagsToWord matchOptions
    onException (do
        result <- propagateGError $ g_regex_replace regex' string' stringLen startPosition replacement' matchOptions'
        checkUnexpectedReturnNULL "regexReplace" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr regex
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem replacement'
        return result'
     ) (do
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem replacement'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexReplaceMethodInfo
instance (signature ~ ([T.Text] -> Int32 -> T.Text -> [GLib.Flags.RegexMatchFlags] -> m T.Text), MonadIO m) => O.MethodInfo RegexReplaceMethodInfo Regex signature where
    overloadedMethod _ = regexReplace

#endif

-- method Regex::replace_literal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TCArray False (-1) 2 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to perform matches against", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_position", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "starting index of the string to match, in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "replacement", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "text to replace each match with", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "options for the match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_replace_literal" g_regex_replace_literal :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    Ptr CString ->                          -- string : TCArray False (-1) 2 (TBasicType TUTF8)
    Int64 ->                                -- string_len : TBasicType TInt64
    Int32 ->                                -- start_position : TBasicType TInt
    CString ->                              -- replacement : TBasicType TUTF8
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Replaces all occurrences of the pattern in /@regex@/ with the
replacement text. /@replacement@/ is replaced literally, to
include backreferences use 'GI.GLib.Structs.Regex.regexReplace'.

Setting /@startPosition@/ differs from just passing over a
shortened string and setting @/G_REGEX_MATCH_NOTBOL/@ in the
case of a pattern that begins with any kind of lookbehind
assertion, such as \"\\b\".

@since 2.14
-}
regexReplaceLiteral ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> [T.Text]
    {- ^ /@string@/: the string to perform matches against -}
    -> Int32
    {- ^ /@startPosition@/: starting index of the string to match, in bytes -}
    -> T.Text
    {- ^ /@replacement@/: text to replace each match with -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: options for the match -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string containing the replacements /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexReplaceLiteral regex string startPosition replacement matchOptions = liftIO $ do
    let stringLen = fromIntegral $ length string
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- packUTF8CArray string
    replacement' <- textToCString replacement
    let matchOptions' = gflagsToWord matchOptions
    onException (do
        result <- propagateGError $ g_regex_replace_literal regex' string' stringLen startPosition replacement' matchOptions'
        checkUnexpectedReturnNULL "regexReplaceLiteral" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr regex
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem replacement'
        return result'
     ) (do
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        freeMem replacement'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexReplaceLiteralMethodInfo
instance (signature ~ ([T.Text] -> Int32 -> T.Text -> [GLib.Flags.RegexMatchFlags] -> m T.Text), MonadIO m) => O.MethodInfo RegexReplaceLiteralMethodInfo Regex signature where
    overloadedMethod _ = regexReplaceLiteral

#endif

-- method Regex::split
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to split with the pattern", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match time option flags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_split" g_regex_split :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    CString ->                              -- string : TBasicType TUTF8
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    IO (Ptr CString)

{- |
Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.

As a special case, the result of splitting the empty string \"\" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you\'ll need to check for the
empty string before calling this function.

A pattern that can match empty strings splits /@string@/ into separate
characters wherever it matches the empty string between characters.
For example splitting \"ab c\" using as a separator \"\\s*\", you will get
\"a\", \"b\" and \"c\".

@since 2.14
-}
regexSplit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> T.Text
    {- ^ /@string@/: the string to split with the pattern -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match time option flags -}
    -> m [T.Text]
    {- ^ __Returns:__ a 'Nothing'-terminated gchar ** array. Free
it using 'GI.GLib.Functions.strfreev' -}
regexSplit regex string matchOptions = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- textToCString string
    let matchOptions' = gflagsToWord matchOptions
    result <- g_regex_split regex' string' matchOptions'
    checkUnexpectedReturnNULL "regexSplit" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    touchManagedPtr regex
    freeMem string'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexSplitMethodInfo
instance (signature ~ (T.Text -> [GLib.Flags.RegexMatchFlags] -> m [T.Text]), MonadIO m) => O.MethodInfo RegexSplitMethodInfo Regex signature where
    overloadedMethod _ = regexSplit

#endif

-- method Regex::split_full
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TCArray False (-1) 2 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to split with the pattern", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_position", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "starting index of the string to match, in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match time option flags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_tokens", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum number of tokens to split @string into.\n  If this is less than 1, the string is split completely", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "string_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_regex_split_full" g_regex_split_full :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    Ptr CString ->                          -- string : TCArray False (-1) 2 (TBasicType TUTF8)
    Int64 ->                                -- string_len : TBasicType TInt64
    Int32 ->                                -- start_position : TBasicType TInt
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    Int32 ->                                -- max_tokens : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.

As a special case, the result of splitting the empty string \"\" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you\'ll need to check for the
empty string before calling this function.

A pattern that can match empty strings splits /@string@/ into separate
characters wherever it matches the empty string between characters.
For example splitting \"ab c\" using as a separator \"\\s*\", you will get
\"a\", \"b\" and \"c\".

Setting /@startPosition@/ differs from just passing over a shortened
string and setting @/G_REGEX_MATCH_NOTBOL/@ in the case of a pattern
that begins with any kind of lookbehind assertion, such as \"\\b\".

@since 2.14
-}
regexSplitFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' structure -}
    -> [T.Text]
    {- ^ /@string@/: the string to split with the pattern -}
    -> Int32
    {- ^ /@startPosition@/: starting index of the string to match, in bytes -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match time option flags -}
    -> Int32
    {- ^ /@maxTokens@/: the maximum number of tokens to split /@string@/ into.
  If this is less than 1, the string is split completely -}
    -> m [T.Text]
    {- ^ __Returns:__ a 'Nothing'-terminated gchar ** array. Free
it using 'GI.GLib.Functions.strfreev' /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexSplitFull regex string startPosition matchOptions maxTokens = liftIO $ do
    let stringLen = fromIntegral $ length string
    regex' <- unsafeManagedPtrGetPtr regex
    string' <- packUTF8CArray string
    let matchOptions' = gflagsToWord matchOptions
    onException (do
        result <- propagateGError $ g_regex_split_full regex' string' stringLen startPosition matchOptions' maxTokens
        checkUnexpectedReturnNULL "regexSplitFull" result
        result' <- unpackZeroTerminatedUTF8CArray result
        mapZeroTerminatedCArray freeMem result
        freeMem result
        touchManagedPtr regex
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
        return result'
     ) (do
        (mapCArrayWithLength stringLen) freeMem string'
        freeMem string'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexSplitFullMethodInfo
instance (signature ~ ([T.Text] -> Int32 -> [GLib.Flags.RegexMatchFlags] -> Int32 -> m [T.Text]), MonadIO m) => O.MethodInfo RegexSplitFullMethodInfo Regex signature where
    overloadedMethod _ = regexSplitFull

#endif

-- method Regex::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "regex", argType = TInterface (Name {namespace = "GLib", name = "Regex"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GRegex", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_unref" g_regex_unref :: 
    Ptr Regex ->                            -- regex : TInterface (Name {namespace = "GLib", name = "Regex"})
    IO ()

{- |
Decreases reference count of /@regex@/ by 1. When reference count drops
to zero, it frees all the memory associated with the regex structure.

@since 2.14
-}
regexUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Regex
    {- ^ /@regex@/: a 'GI.GLib.Structs.Regex.Regex' -}
    -> m ()
regexUnref regex = liftIO $ do
    regex' <- unsafeManagedPtrGetPtr regex
    g_regex_unref regex'
    touchManagedPtr regex
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegexUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RegexUnrefMethodInfo Regex signature where
    overloadedMethod _ = regexUnref

#endif

-- method Regex::check_replacement
-- method type : MemberFunction
-- Args : [Arg {argCName = "replacement", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the replacement string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "has_references", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store information about\n  references in @replacement 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 "g_regex_check_replacement" g_regex_check_replacement :: 
    CString ->                              -- replacement : TBasicType TUTF8
    Ptr CInt ->                             -- has_references : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Checks whether /@replacement@/ is a valid replacement string
(see 'GI.GLib.Structs.Regex.regexReplace'), i.e. that all escape sequences in
it are valid.

If /@hasReferences@/ is not 'Nothing' then /@replacement@/ is checked
for pattern references. For instance, replacement text \'foo\\n\'
does not contain references and may be evaluated without information
about actual match, but \'\\0\\1\' (whole match followed by first
subpattern) requires valid 'GI.GLib.Structs.MatchInfo.MatchInfo' object.

@since 2.14
-}
regexCheckReplacement ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@replacement@/: the replacement string -}
    -> m (Bool)
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
regexCheckReplacement replacement = liftIO $ do
    replacement' <- textToCString replacement
    hasReferences <- allocMem :: IO (Ptr CInt)
    onException (do
        _ <- propagateGError $ g_regex_check_replacement replacement' hasReferences
        hasReferences' <- peek hasReferences
        let hasReferences'' = (/= 0) hasReferences'
        freeMem replacement'
        freeMem hasReferences
        return hasReferences''
     ) (do
        freeMem replacement'
        freeMem hasReferences
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::error_quark
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_error_quark" g_regex_error_quark :: 
    IO Word32

{- |
/No description available in the introspection data./
-}
regexErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
regexErrorQuark  = liftIO $ do
    result <- g_regex_error_quark
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::escape_nul
-- method type : MemberFunction
-- Args : [Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to escape", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_escape_nul" g_regex_escape_nul :: 
    CString ->                              -- string : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    IO CString

{- |
Escapes the nul characters in /@string@/ to \"\\x00\".  It can be used
to compile a regex with embedded nul characters.

For completeness, /@length@/ can be -1 for a nul-terminated string.
In this case the output string will be of course equal to /@string@/.

@since 2.30
-}
regexEscapeNul ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@string@/: the string to escape -}
    -> Int32
    {- ^ /@length@/: the length of /@string@/ -}
    -> m T.Text
    {- ^ __Returns:__ a newly-allocated escaped string -}
regexEscapeNul string length_ = liftIO $ do
    string' <- textToCString string
    result <- g_regex_escape_nul string' length_
    checkUnexpectedReturnNULL "regexEscapeNul" result
    result' <- cstringToText result
    freeMem result
    freeMem string'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::escape_string
-- method type : MemberFunction
-- Args : [Arg {argCName = "string", argType = TCArray False (-1) 1 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to escape", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @string, or -1 if @string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_escape_string" g_regex_escape_string :: 
    Ptr CString ->                          -- string : TCArray False (-1) 1 (TBasicType TUTF8)
    Int32 ->                                -- length : TBasicType TInt
    IO CString

{- |
Escapes the special characters used for regular expressions
in /@string@/, for instance \"a.b*c\" becomes \"a\\.b\\*c\". This
function is useful to dynamically generate regular expressions.

/@string@/ can contain nul characters that are replaced with \"\\0\",
in this case remember to specify the correct length of /@string@/
in /@length@/.

@since 2.14
-}
regexEscapeString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@string@/: the string to escape -}
    -> m T.Text
    {- ^ __Returns:__ a newly-allocated escaped string -}
regexEscapeString string = liftIO $ do
    let length_ = fromIntegral $ length string
    string' <- packUTF8CArray string
    result <- g_regex_escape_string string' length_
    checkUnexpectedReturnNULL "regexEscapeString" result
    result' <- cstringToText result
    freeMem result
    (mapCArrayWithLength length_) freeMem string'
    freeMem string'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::match_simple
-- method type : MemberFunction
-- Args : [Arg {argCName = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the regular expression", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compile_options", argType = TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "compile options for the regular expression, or 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options, or 0", 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 "g_regex_match_simple" g_regex_match_simple :: 
    CString ->                              -- pattern : TBasicType TUTF8
    CString ->                              -- string : TBasicType TUTF8
    CUInt ->                                -- compile_options : TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"})
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    IO CInt

{- |
Scans for a match in /@string@/ for /@pattern@/.

This function is equivalent to 'GI.GLib.Structs.Regex.regexMatch' but it does not
require to compile the pattern with 'GI.GLib.Structs.Regex.regexNew', avoiding some
lines of code when you need just to do a match without extracting
substrings, capture counts, and so on.

If this function is to be called on the same /@pattern@/ more than
once, it\'s more efficient to compile the pattern once with
'GI.GLib.Structs.Regex.regexNew' and then use 'GI.GLib.Structs.Regex.regexMatch'.

@since 2.14
-}
regexMatchSimple ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@pattern@/: the regular expression -}
    -> T.Text
    {- ^ /@string@/: the string to scan for matches -}
    -> [GLib.Flags.RegexCompileFlags]
    {- ^ /@compileOptions@/: compile options for the regular expression, or 0 -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options, or 0 -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the string matched, 'False' otherwise -}
regexMatchSimple pattern string compileOptions matchOptions = liftIO $ do
    pattern' <- textToCString pattern
    string' <- textToCString string
    let compileOptions' = gflagsToWord compileOptions
    let matchOptions' = gflagsToWord matchOptions
    result <- g_regex_match_simple pattern' string' compileOptions' matchOptions'
    let result' = (/= 0) result
    freeMem pattern'
    freeMem string'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Regex::split_simple
-- method type : MemberFunction
-- Args : [Arg {argCName = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the regular expression", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to scan for matches", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compile_options", argType = TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "compile options for the regular expression, or 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "match_options", argType = TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "match options, or 0", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_regex_split_simple" g_regex_split_simple :: 
    CString ->                              -- pattern : TBasicType TUTF8
    CString ->                              -- string : TBasicType TUTF8
    CUInt ->                                -- compile_options : TInterface (Name {namespace = "GLib", name = "RegexCompileFlags"})
    CUInt ->                                -- match_options : TInterface (Name {namespace = "GLib", name = "RegexMatchFlags"})
    IO (Ptr CString)

{- |
Breaks the string on the pattern, and returns an array of
the tokens. If the pattern contains capturing parentheses,
then the text for each of the substrings will also be returned.
If the pattern does not match anywhere in the string, then the
whole string is returned as the first token.

This function is equivalent to 'GI.GLib.Structs.Regex.regexSplit' but it does
not require to compile the pattern with 'GI.GLib.Structs.Regex.regexNew', avoiding
some lines of code when you need just to do a split without
extracting substrings, capture counts, and so on.

If this function is to be called on the same /@pattern@/ more than
once, it\'s more efficient to compile the pattern once with
'GI.GLib.Structs.Regex.regexNew' and then use 'GI.GLib.Structs.Regex.regexSplit'.

As a special case, the result of splitting the empty string \"\"
is an empty vector, not a vector containing a single string.
The reason for this special case is that being able to represent
a empty vector is typically more useful than consistent handling
of empty elements. If you do need to represent empty elements,
you\'ll need to check for the empty string before calling this
function.

A pattern that can match empty strings splits /@string@/ into
separate characters wherever it matches the empty string between
characters. For example splitting \"ab c\" using as a separator
\"\\s*\", you will get \"a\", \"b\" and \"c\".

@since 2.14
-}
regexSplitSimple ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@pattern@/: the regular expression -}
    -> T.Text
    {- ^ /@string@/: the string to scan for matches -}
    -> [GLib.Flags.RegexCompileFlags]
    {- ^ /@compileOptions@/: compile options for the regular expression, or 0 -}
    -> [GLib.Flags.RegexMatchFlags]
    {- ^ /@matchOptions@/: match options, or 0 -}
    -> m [T.Text]
    {- ^ __Returns:__ a 'Nothing'-terminated array of strings. Free
it using 'GI.GLib.Functions.strfreev' -}
regexSplitSimple pattern string compileOptions matchOptions = liftIO $ do
    pattern' <- textToCString pattern
    string' <- textToCString string
    let compileOptions' = gflagsToWord compileOptions
    let matchOptions' = gflagsToWord matchOptions
    result <- g_regex_split_simple pattern' string' compileOptions' matchOptions'
    checkUnexpectedReturnNULL "regexSplitSimple" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    freeMem pattern'
    freeMem string'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveRegexMethod (t :: Symbol) (o :: *) :: * where
    ResolveRegexMethod "match" o = RegexMatchMethodInfo
    ResolveRegexMethod "matchAll" o = RegexMatchAllMethodInfo
    ResolveRegexMethod "matchAllFull" o = RegexMatchAllFullMethodInfo
    ResolveRegexMethod "matchFull" o = RegexMatchFullMethodInfo
    ResolveRegexMethod "ref" o = RegexRefMethodInfo
    ResolveRegexMethod "replace" o = RegexReplaceMethodInfo
    ResolveRegexMethod "replaceLiteral" o = RegexReplaceLiteralMethodInfo
    ResolveRegexMethod "split" o = RegexSplitMethodInfo
    ResolveRegexMethod "splitFull" o = RegexSplitFullMethodInfo
    ResolveRegexMethod "unref" o = RegexUnrefMethodInfo
    ResolveRegexMethod "getCaptureCount" o = RegexGetCaptureCountMethodInfo
    ResolveRegexMethod "getCompileFlags" o = RegexGetCompileFlagsMethodInfo
    ResolveRegexMethod "getHasCrOrLf" o = RegexGetHasCrOrLfMethodInfo
    ResolveRegexMethod "getMatchFlags" o = RegexGetMatchFlagsMethodInfo
    ResolveRegexMethod "getMaxBackref" o = RegexGetMaxBackrefMethodInfo
    ResolveRegexMethod "getMaxLookbehind" o = RegexGetMaxLookbehindMethodInfo
    ResolveRegexMethod "getPattern" o = RegexGetPatternMethodInfo
    ResolveRegexMethod "getStringNumber" o = RegexGetStringNumberMethodInfo
    ResolveRegexMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRegexMethod t Regex, O.MethodInfo info Regex p) => O.IsLabelProxy t (Regex -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRegexMethod t Regex, O.MethodInfo info Regex p) => O.IsLabel t (Regex -> 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

#endif