summaryrefslogtreecommitdiff
path: root/src/core/iregex.h
blob: e67378d713c6a69d7f3366df2f37f79589aef88e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __REGEX_H
#define __REGEX_H

#include "common.h"

#ifdef USE_GREGEX

#include <glib.h>
typedef	GRegex Regex;
typedef	struct _MatchInfo MatchInfo;

#else

#include <regex.h>
typedef	regex_t Regex;
typedef regmatch_t MatchInfo;

#endif

gboolean
i_match_info_matches (const MatchInfo *match_info);

void
i_match_info_free (MatchInfo *match_info);

Regex *
i_regex_new (const gchar *pattern,
             GRegexCompileFlags compile_options,
             GRegexMatchFlags match_options,
             GError **error);

void
i_regex_unref (Regex *regex);

gboolean
i_regex_match (const Regex *regex,
               const gchar *string,
               GRegexMatchFlags match_options,
               MatchInfo **match_info);

gboolean
i_match_info_fetch_pos (const MatchInfo *match_info,
                        gint match_num,
                        gint *start_pos,
                        gint *end_pos);

#endif