#include "util.h"
#include "string2.h"
#include "strfilter.h"
#include <errno.h>
#include "sane_ctype.h"
Go to the source code of this file.
|
static void | strfilter_node__delete (struct strfilter_node *node) |
|
void | strfilter__delete (struct strfilter *filter) |
|
static const char * | get_token (const char *s, const char **e) |
|
static struct strfilter_node * | strfilter_node__alloc (const char *op, struct strfilter_node *l, struct strfilter_node *r) |
|
static struct strfilter_node * | strfilter_node__new (const char *s, const char **ep) |
|
struct strfilter * | strfilter__new (const char *rules, const char **err) |
|
static int | strfilter__append (struct strfilter *filter, bool _or, const char *rules, const char **err) |
|
int | strfilter__or (struct strfilter *filter, const char *rules, const char **err) |
|
int | strfilter__and (struct strfilter *filter, const char *rules, const char **err) |
|
static bool | strfilter_node__compare (struct strfilter_node *node, const char *str) |
|
bool | strfilter__compare (struct strfilter *filter, const char *str) |
|
static int | strfilter_node__sprint (struct strfilter_node *node, char *buf) |
|
static int | strfilter_node__sprint_pt (struct strfilter_node *node, char *buf) |
|
char * | strfilter__string (struct strfilter *filter) |
|
|
static const char * | OP_and = "&" |
|
static const char * | OP_or = "|" |
|
static const char * | OP_not = "!" |
|
◆ is_operator
#define is_operator |
( |
|
c | ) |
((c) == '|' || (c) == '&' || (c) == '!') |
◆ is_separator
#define is_separator |
( |
|
c | ) |
(is_operator(c) || (c) == '(' || (c) == ')') |
◆ get_token()
static const char* get_token |
( |
const char * |
s, |
|
|
const char ** |
e |
|
) |
| |
|
static |
◆ strfilter__and()
int strfilter__and |
( |
struct strfilter * |
filter, |
|
|
const char * |
rules, |
|
|
const char ** |
err |
|
) |
| |
strfilter__add - Append an additional rule by logical-and : Original string filter : Filter rule to be appended at left of the root of by using logical-and. : Pointer which points an error detected on
Parse and join it to the by using logical-and. Return 0 if success, or return the error code.
Definition at line 211 of file strfilter.c.
◆ strfilter__append()
static int strfilter__append |
( |
struct strfilter * |
filter, |
|
|
bool |
_or, |
|
|
const char * |
rules, |
|
|
const char ** |
err |
|
) |
| |
|
static |
◆ strfilter__compare()
bool strfilter__compare |
( |
struct strfilter * |
filter, |
|
|
const char * |
str |
|
) |
| |
strfilter__compare - compare given string and a string filter : String filter : target string
Compare and . Return true if the str match the rule
Definition at line 238 of file strfilter.c.
◆ strfilter__delete()
void strfilter__delete |
( |
struct strfilter * |
filter | ) |
|
strfilter__delete - delete a string filter : String filter to delete
Delete .
Definition at line 28 of file strfilter.c.
◆ strfilter__new()
struct strfilter* strfilter__new |
( |
const char * |
rules, |
|
|
const char ** |
err |
|
) |
| |
strfilter__new - Create a new string filter : Filter rule, which is a combination of glob expressions. : Pointer which points an error detected on
Parse and return new strfilter. Return NULL if an error detected. In that case, * will indicate where it is detected, and * is NULL if a memory allocation is failed.
Definition at line 159 of file strfilter.c.
◆ strfilter__or()
int strfilter__or |
( |
struct strfilter * |
filter, |
|
|
const char * |
rules, |
|
|
const char ** |
err |
|
) |
| |
strfilter__or - Append an additional rule by logical-or : Original string filter : Filter rule to be appended at left of the root of by using logical-or. : Pointer which points an error detected on
Parse and join it to the by using logical-or. Return 0 if success, or return the error code.
Definition at line 206 of file strfilter.c.
◆ strfilter__string()
char* strfilter__string |
( |
struct strfilter * |
filter | ) |
|
strfilter__string - Reconstruct a rule string from filter : String filter to reconstruct
Reconstruct a rule string from . This will be good for debug messages. Note that returning string must be freed afterward.
Definition at line 297 of file strfilter.c.
◆ strfilter_node__alloc()
◆ strfilter_node__compare()
static bool strfilter_node__compare |
( |
struct strfilter_node * |
node, |
|
|
const char * |
str |
|
) |
| |
|
static |
◆ strfilter_node__delete()
◆ strfilter_node__new()
static struct strfilter_node* strfilter_node__new |
( |
const char * |
s, |
|
|
const char ** |
ep |
|
) |
| |
|
static |
◆ strfilter_node__sprint()
static int strfilter_node__sprint |
( |
struct strfilter_node * |
node, |
|
|
char * |
buf |
|
) |
| |
|
static |
◆ strfilter_node__sprint_pt()
static int strfilter_node__sprint_pt |
( |
struct strfilter_node * |
node, |
|
|
char * |
buf |
|
) |
| |
|
static |
◆ OP_and
◆ OP_not
◆ OP_or