summaryrefslogtreecommitdiff
path: root/src/core/iregex.h
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-02-16 22:48:13 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2017-06-04 00:52:53 +0200
commit79bbca4644cad7f2dee89c7ac6b8f9acc2c8b427 (patch)
tree86b908491ac1ab00cb079526b1f32a5d294d75a6 /src/core/iregex.h
parent31b9d115b065570020ce9be1a1d8cd49212f70a9 (diff)
downloadirssi-79bbca4644cad7f2dee89c7ac6b8f9acc2c8b427.zip
Refactor regex and implement UTF8 mode for GRegex
- with non-unicode byte to Private Use Area A mapping - move all ifdefs to iregex.h file only
Diffstat (limited to 'src/core/iregex.h')
-rw-r--r--src/core/iregex.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/iregex.h b/src/core/iregex.h
new file mode 100644
index 00000000..adeea987
--- /dev/null
+++ b/src/core/iregex.h
@@ -0,0 +1,52 @@
+#ifndef __REGEX_H
+#define __REGEX_H
+
+#include "common.h"
+
+#ifdef USE_GREGEX
+
+#include <glib.h>
+typedef GRegex Regex;
+typedef GMatchInfo MatchInfo;
+
+#define i_match_info_matches g_match_info_matches
+#define i_match_info_free g_match_info_free
+
+#else
+
+#include <regex.h>
+typedef regex_t Regex;
+typedef regmatch_t MatchInfo;
+
+gboolean
+i_match_info_matches (const MatchInfo *match_info);
+
+void
+i_match_info_free (MatchInfo *match_info);
+
+#endif
+
+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,
+ const gchar **new_string);
+
+gboolean
+i_match_info_fetch_pos (const MatchInfo *match_info,
+ gint match_num,
+ gint *start_pos,
+ gint *end_pos,
+ const gchar *new_string);
+
+#endif