Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A GPatternSpec struct is the 'compiled' form of a pattern. This structure is opaque and its fields cannot be accessed directly.
Synopsis
- newtype PatternSpec = PatternSpec (ManagedPtr PatternSpec)
- patternSpecCopy :: (HasCallStack, MonadIO m) => PatternSpec -> m PatternSpec
- patternSpecEqual :: (HasCallStack, MonadIO m) => PatternSpec -> PatternSpec -> m Bool
- patternSpecFree :: (HasCallStack, MonadIO m) => PatternSpec -> m ()
- patternSpecMatch :: (HasCallStack, MonadIO m) => PatternSpec -> Word64 -> Text -> Maybe Text -> m Bool
- patternSpecMatchString :: (HasCallStack, MonadIO m) => PatternSpec -> Text -> m Bool
- patternSpecNew :: (HasCallStack, MonadIO m) => Text -> m PatternSpec
Exported types
newtype PatternSpec Source #
Memory-managed wrapper type.
Instances
Eq PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec (==) :: PatternSpec -> PatternSpec -> Bool # (/=) :: PatternSpec -> PatternSpec -> Bool # | |
GBoxed PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec | |
ManagedPtrNewtype PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec | |
TypedObject PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec | |
HasParentTypes PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec | |
IsGValue (Maybe PatternSpec) Source # | Convert |
Defined in GI.GLib.Structs.PatternSpec gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe PatternSpec -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe PatternSpec) # | |
type ParentTypes PatternSpec Source # | |
Defined in GI.GLib.Structs.PatternSpec |
Methods
Click to display all available methods, including inherited ones
copy
:: (HasCallStack, MonadIO m) | |
=> PatternSpec |
|
-> m PatternSpec | Returns: a copy of |
Copies pspec
in a new PatternSpec
.
Since: 2.70
equal
:: (HasCallStack, MonadIO m) | |
=> PatternSpec |
|
-> PatternSpec |
|
-> m Bool | Returns: Whether the compiled patterns are equal |
Compares two compiled pattern specs and returns whether they will match the same set of strings.
free
:: (HasCallStack, MonadIO m) | |
=> PatternSpec |
|
-> m () |
Frees the memory allocated for the PatternSpec
.
match
:: (HasCallStack, MonadIO m) | |
=> PatternSpec |
|
-> Word64 |
|
-> Text |
|
-> Maybe Text |
|
-> m Bool | Returns: |
Matches a string against a compiled pattern. Passing the correct
length of the string given is mandatory. The reversed string can be
omitted by passing Nothing
, this is more efficient if the reversed
version of the string to be matched is not at hand, as
g_pattern_match()
will only construct it if the compiled pattern
requires reverse matches.
Note that, if the user code will (possibly) match a string against a
multitude of patterns containing wildcards, chances are high that
some patterns will require a reversed string. In this case, it's
more efficient to provide the reversed string to avoid multiple
constructions thereof in the various calls to g_pattern_match()
.
Note also that the reverse of a UTF-8 encoded string can in general
not be obtained by strreverse
. This works only if the string
does not contain any multibyte characters. GLib offers the
utf8Strreverse
function to reverse UTF-8 encoded strings.
Since: 2.70
matchString
patternSpecMatchString Source #
:: (HasCallStack, MonadIO m) | |
=> PatternSpec |
|
-> Text |
|
-> m Bool | Returns: |
Matches a string against a compiled pattern. If the string is to be
matched against more than one pattern, consider using
g_pattern_match()
instead while supplying the reversed string.
Since: 2.70
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m PatternSpec | Returns: a newly-allocated |
Compiles a pattern to a PatternSpec
.