Common Pipeline Library Reference 7.3.2
|
Typedefs | |
typedef struct _cpl_regex_ | cpl_regex |
The opaque regular expression filter data type. | |
typedef enum _cpl_regex_syntax_option_ | cpl_regex_syntax_option |
Regular expression syntax options. | |
Enumerations | |
enum | _cpl_regex_syntax_option_ { CPL_REGEX_ICASE , CPL_REGEX_NOSUBS , CPL_REGEX_BASIC , CPL_REGEX_EXTENDED } |
Functions | |
int | cpl_regex_apply (const cpl_regex *self, const char *string) |
Compare a regular expression with a given character string. | |
void | cpl_regex_delete (cpl_regex *self) |
Destroys a regular expression filter object. | |
int | cpl_regex_is_negated (const cpl_regex *self) |
Test whether a regular expression filter is negated. | |
void | cpl_regex_negate (cpl_regex *self) |
Toggle the negation state of a regular expression filter. | |
cpl_regex * | cpl_regex_new (const char *expression, int negated, flag_type flags) |
Create a new regular expression filter. | |
The module implements a regular expression filter type. The type cpl_regex
is a compiled regular expression created with a given set of regular expression syntax options, and an optional negation of the result when it is applied to an input string.
typedef struct _cpl_regex_ cpl_regex |
The opaque regular expression filter data type.
typedef enum _cpl_regex_syntax_option_ cpl_regex_syntax_option |
Regular expression syntax options.
int cpl_regex_apply | ( | const cpl_regex * | self, |
const char * | string | ||
) |
Compare a regular expression with a given character string.
self | The regular expression filter object to apply. |
string | The string to be tested. |
The function compares the input string string with the regular expression of the filter object self. The function returns a non-zero value for positive matches, i.e. the regular expression matches the input string string and the filter is not negated, or the regular expression does not match the input string but the filter is negated. Otherwise the function reports a negative match, i.e. returns 0
.
void cpl_regex_delete | ( | cpl_regex * | self | ) |
Destroys a regular expression filter object.
self | The regular expression filter object. |
The function destroys the given regular expression filter object self, and deallocates the memory used. If the filter object self is NULL
, nothing is done and no error is set.
Referenced by cpl_multiframe_new().
int cpl_regex_is_negated | ( | const cpl_regex * | self | ) |
Test whether a regular expression filter is negated.
self | The regular expression filter object to test. |
0
if the filter self is not negated, and 1
otherwise.The function reports whether the filter self is negated or not.
void cpl_regex_negate | ( | cpl_regex * | self | ) |
Toggle the negation state of a regular expression filter.
self | The regular expression filter object to update. |
The function toggles the negation state of the given regular expression filter object self. If self is negated, it is not negated after this function has been called, and vice versa.
cpl_regex * cpl_regex_new | ( | const char * | expression, |
int | negated, | ||
flag_type | flags | ||
) |
Create a new regular expression filter.
expression | Regular expression. |
negated | Negate the result when applying the filter. |
flags | Regular expression syntax options. |
NULL
in case an error occurred.The function allocates a regular expression filter object and initializes it with the compiled regular expression expression. If the flag negated is set the result when applying the filter to an input string is negated. The argument flags allows to specify regular expression syntax options for the compilation of the regular expression.
The returned regular expression filter object must be destroyed using the destructor cpl_regex_delete().
Note that the syntax option CPL_REGEX_NOSUBS
is always set implicitly, since the interface does not allow to retrieve this information.
References CPL_ERROR_ILLEGAL_INPUT, CPL_REGEX_BASIC, CPL_REGEX_EXTENDED, CPL_REGEX_ICASE, and CPL_REGEX_NOSUBS.
Referenced by cpl_multiframe_new().