AgsRegexUtil

AgsRegexUtil — regex util with locale conversion

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Includes

#include <ags/lib/ags_regex_util.h>

Description

Wrapper around glibc regex functions to provide regex with locale conversion.

Functions

ags_regex_util_error_quark ()

GQuark
ags_regex_util_error_quark ();

ags_regex_util_alloc ()

AgsRegexUtil *
ags_regex_util_alloc (gchar *app_encoding,
                      gchar *encoding,
                      gboolean is_unichar,
                      gboolean is_unichar2);

Allocate AgsRegexUtil

Parameters

app_encoding

the application encoding

 

encoding

the input encoding

 

is_unichar

is gunichar

 

is_unichar2

is gunichar2

 

Returns

a new AgsRegexUtil

Since: 6.3.2


ags_regex_util_copy ()

gpointer
ags_regex_util_copy (AgsRegexUtil *ptr);

Create a copy of ptr .

Parameters

ptr

the AgsRegexUtil

 

Returns

a pointer of the new AgsRegexUtil

Since: 6.3.2


ags_regex_util_free ()

void
ags_regex_util_free (AgsRegexUtil *ptr);

Free the memory of ptr .

Parameters

ptr

the AgsRegexUtil

 

Since: 6.3.2


ags_regex_util_get_app_encoding ()

gchar *
ags_regex_util_get_app_encoding (AgsRegexUtil *regex_util);

Get application encoding of regex_util .

Parameters

regex_util

the AgsRegexUtil

 

Returns

the application encoding.

[transfer full]

Since: 6.3.2


ags_regex_util_get_encoding ()

gchar *
ags_regex_util_get_encoding (AgsRegexUtil *regex_util);

Get encoding of regex_util .

Parameters

regex_util

the AgsRegexUtil

 

Returns

the encoding.

[transfer full]

Since: 6.3.2


ags_regex_util_compile ()

gboolean
ags_regex_util_compile (AgsRegexUtil *regex_util,
                        const gchar *regex_str,
                        gint compile_flags,
                        GError **error);

Compile regex_str by respecting compile_flags .

Parameters

regex_util

the AgsRegexUtil

 

regex_str

the regular expression

 

compile_flags

the compile flags

 

error

an error that may occure

 

Returns

TRUE on success, otherwise FALSE

Since: 6.3.2


ags_regex_util_match_alloc ()

AgsRegexMatch *
ags_regex_util_match_alloc (AgsRegexUtil *regex_util,
                            guint match_count);

Allocate AgsRegexMatch array.

Parameters

regex_util

the AgsRegexUtil

 

match_count

the match count

 

Returns

the new allocated AgsRegexMatch array

Since: 6.3.2


ags_regex_util_match_copy ()

AgsRegexMatch *
ags_regex_util_match_copy (AgsRegexUtil *regex_util,
                           AgsRegexMatch *match,
                           guint match_count);

Copy match .

Parameters

regex_util

the AgsRegexUtil

 

match

the regex match

 

match_count

the match count

 

Returns

the newly allocated AgsRegexMatch

Since: 6.3.2


ags_regex_util_match_free ()

void
ags_regex_util_match_free (AgsRegexUtil *regex_util,
                           AgsRegexMatch *match);

Free match .

Parameters

regex_util

the AgsRegexUtil

 

match

the regex match

 

Since: 6.3.2


ags_regex_util_match_get_offset ()

void
ags_regex_util_match_get_offset (AgsRegexUtil *regex_util,
                                 AgsRegexMatch *match,
                                 guint nth_match,
                                 gint *start_match_offset,
                                 gint *end_match_offset);

Get offset of match .

Parameters

regex_util

the AgsRegexUtil

 

match

the regex match

 

nth_match

the match position

 

start_match_offset

the start match offset.

[out]

end_match_offset

the end match offset.

[out]

Since: 6.3.2


ags_regex_util_execute ()

gboolean
ags_regex_util_execute (AgsRegexUtil *regex_util,
                        const gchar *str,
                        guint match_count,
                        AgsRegexMatch *match,
                        guint execute_flags,
                        GError **error);

Execute regex_util and fill match .

Parameters

regex_util

the AgsRegexUtil

 

str

the input string

 

match_count

the match count

 

match

the regex match

 

execute_flags

the execute flags

 

error

an error that may occure

 

Returns

TRUE on success, otherwise FALSE

Since: 6.3.2


ags_regex_util_execute_unichar ()

gboolean
ags_regex_util_execute_unichar (AgsRegexUtil *regex_util,
                                const gunichar *str,
                                guint match_count,
                                AgsRegexMatch *match,
                                guint execute_flags,
                                GError **error);

Execute regex_util and fill match .

Parameters

regex_util

the AgsRegexUtil

 

str

the input string

 

match_count

the match count

 

match

the regex match

 

execute_flags

the execute flags

 

error

an error that may occure

 

Returns

TRUE on success, otherwise FALSE

Since: 6.3.2


ags_regex_util_execute_unichar2 ()

gboolean
ags_regex_util_execute_unichar2 (AgsRegexUtil *regex_util,
                                 const gunichar2 *str,
                                 guint match_count,
                                 AgsRegexMatch *match,
                                 guint execute_flags,
                                 GError **error);

Execute regex_util and fill match .

Parameters

regex_util

the AgsRegexUtil

 

str

the input string

 

match_count

the match count

 

match

the regex match

 

execute_flags

the execute flags

 

error

an error that may occure

 

Returns

TRUE on success, otherwise FALSE

Since: 6.3.2

Types and Values

enum AgsRegexUtilCompileFlags

Enum values to control the behavior of ags_regex_util_compile() and related by enable/disable as flags.

Members

AGS_REGEX_UTIL_POSIX_EXTENDED_SYNTAX

   

AGS_REGEX_UTIL_CASE_INSENSITIVE

   

AGS_REGEX_UTIL_NO_POSITION_REPORT_OF_MATCHES

   

AGS_REGEX_UTIL_NO_NEWLINE_MATCH

   

enum AgsRegexUtilExecuteFlags

Enum values to control the behavior of ags_regex_util_execute() and such by enable/disable as flags.

Members

AGS_REGEX_UTIL_NOT_BEGINNING_OF_LINE

   

AGS_REGEX_UTIL_NOT_END_OF_LINE

   

AGS_REGEX_UTIL_START_END

   

AGS_REGEX_UTIL_ERROR

#define AGS_REGEX_UTIL_ERROR (ags_regex_util_error_quark())

enum AgsRegexUtilError

Members

AGS_REGEX_UTIL_ERROR_BAD_BACK_REFERENCE

   

AGS_REGEX_UTIL_ERROR_BAD_PATTERN

   

AGS_REGEX_UTIL_ERROR_BAD_REPETITION

   

AGS_REGEX_UTIL_ERROR_UNMATCHED_BRACE_INTERVAL_OPERATORS

   

AGS_REGEX_UTIL_ERROR_UNMATCHED_BRACKET_LIST_OPERATORS

   

AGS_REGEX_UTIL_ERROR_INVALID_COLLATING_ELEMENT

   

AGS_REGEX_UTIL_ERROR_UNKNOWN_CHARACTER_CLASS_NAME

   

AGS_REGEX_UTIL_ERROR_NON_SPECIFIC_ERROR

   

AGS_REGEX_UTIL_ERROR_TRAILING_BACKSLASH

   

AGS_REGEX_UTIL_ERROR_UNMATCHED_PARENTHESIS_GROUP_OPERATORS

   

AGS_REGEX_UTIL_ERROR_INVALID_RANGE_OPERATOR

   

AGS_REGEX_UTIL_ERROR_PATTERN_BUFFER_LARGER_THAN_64KB

   

AGS_REGEX_UTIL_ERROR_OUT_OF_MEMORY

   

AGS_REGEX_UTIL_ERROR_INVALID_BACK_REFERENCE

   

AGS_REGEX_UTIL_ERROR_UNSPECIFIED

   

struct AgsRegexMatch

struct AgsRegexMatch {
  regoff_t start_match_offset;
  regoff_t end_match_offset;
};