summaryrefslogtreecommitdiff
path: root/src/core/iregex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/iregex.h')
-rw-r--r--src/core/iregex.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/core/iregex.h b/src/core/iregex.h
new file mode 100644
index 00000000..e67378d7
--- /dev/null
+++ b/src/core/iregex.h
@@ -0,0 +1,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