[glibmm] Regex: Move enums inside class.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Regex: Move enums inside class.
- Date: Tue, 18 Apr 2017 20:04:49 +0000 (UTC)
commit 3dce5e5d70d6fcb36543494d9efe698a1d9b1a3d
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Apr 18 18:10:03 2017 +0200
Regex: Move enums inside class.
glib/src/regex.ccg | 35 ++++++++++++++++-------------
glib/src/regex.hg | 55 +++++++++++++++++++++++----------------------
tools/m4/convert_glib.m4 | 4 +-
3 files changed, 49 insertions(+), 45 deletions(-)
---
diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg
index 7d2f355..7707efa 100644
--- a/glib/src/regex.ccg
+++ b/glib/src/regex.ccg
@@ -17,12 +17,15 @@
#include <glibmm/utility.h>
+using CompileFlags = Glib::Regex::CompileFlags;
+using MatchFlags = Glib::Regex::MatchFlags;
+
namespace Glib
{
Glib::RefPtr<Glib::Regex>
Regex::create(
- const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options)
+ const Glib::ustring& pattern, CompileFlags compile_options, MatchFlags match_options)
{
GError* gerror = nullptr;
auto regex = g_regex_new(
@@ -44,7 +47,7 @@ Regex::escape_string(const Glib::ustring& string)
bool
Regex::match(
- const Glib::ustring& string, Glib::MatchInfo& match_info, RegexMatchFlags match_options)
+ const Glib::ustring& string, Glib::MatchInfo& match_info, MatchFlags match_options)
{
GMatchInfo* ginfo = nullptr;
bool const result = static_cast<bool>(
@@ -54,14 +57,14 @@ Regex::match(
}
bool
-Regex::match(const Glib::ustring& string, RegexMatchFlags match_options)
+Regex::match(const Glib::ustring& string, MatchFlags match_options)
{
return g_regex_match(gobj(), string.c_str(), (GRegexMatchFlags)(match_options), nullptr);
}
bool
Regex::match(const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info,
- RegexMatchFlags match_options)
+ MatchFlags match_options)
{
GError* gerror = nullptr;
GMatchInfo* ginfo = nullptr;
@@ -78,7 +81,7 @@ Regex::match(const Glib::ustring& string, int start_position, Glib::MatchInfo& m
bool
Regex::match(const Glib::ustring& string, gssize string_len, int start_position,
- Glib::MatchInfo& match_info, RegexMatchFlags match_options)
+ Glib::MatchInfo& match_info, MatchFlags match_options)
{
GError* gerror = nullptr;
GMatchInfo* ginfo = nullptr;
@@ -94,7 +97,7 @@ Regex::match(const Glib::ustring& string, gssize string_len, int start_position,
}
bool
-Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options)
+Regex::match(const Glib::ustring& string, int start_position, MatchFlags match_options)
{
GError* gerror = nullptr;
bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position,
@@ -107,7 +110,7 @@ Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags ma
bool
Regex::match(
- const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options)
+ const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options)
{
GError* gerror = nullptr;
bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position,
@@ -120,7 +123,7 @@ Regex::match(
bool
Regex::match_all(
- const Glib::ustring& string, Glib::MatchInfo& match_info, RegexMatchFlags match_options)
+ const Glib::ustring& string, Glib::MatchInfo& match_info, MatchFlags match_options)
{
GMatchInfo* ginfo = nullptr;
bool const result = static_cast<bool>(g_regex_match_all(
@@ -130,14 +133,14 @@ Regex::match_all(
}
bool
-Regex::match_all(const Glib::ustring& string, RegexMatchFlags match_options)
+Regex::match_all(const Glib::ustring& string, MatchFlags match_options)
{
return g_regex_match_all(gobj(), string.c_str(), ((GRegexMatchFlags)(match_options)), nullptr);
}
bool
Regex::match_all(const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info,
- RegexMatchFlags match_options)
+ MatchFlags match_options)
{
GError* gerror = nullptr;
GMatchInfo* ginfo = nullptr;
@@ -154,7 +157,7 @@ Regex::match_all(const Glib::ustring& string, int start_position, Glib::MatchInf
bool
Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position,
- Glib::MatchInfo& match_info, RegexMatchFlags match_options)
+ Glib::MatchInfo& match_info, MatchFlags match_options)
{
GError* gerror = nullptr;
GMatchInfo* ginfo = nullptr;
@@ -170,7 +173,7 @@ Regex::match_all(const Glib::ustring& string, gssize string_len, int start_posit
}
bool
-Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options)
+Regex::match_all(const Glib::ustring& string, int start_position, MatchFlags match_options)
{
GError* gerror = nullptr;
bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position,
@@ -183,7 +186,7 @@ Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlag
bool
Regex::match_all(
- const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options)
+ const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options)
{
GError* gerror = nullptr;
bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position,
@@ -196,7 +199,7 @@ Regex::match_all(
Glib::ustring
Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement,
- RegexMatchFlags match_options)
+ MatchFlags match_options)
{
GError* gerror = nullptr;
auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(),
@@ -209,7 +212,7 @@ Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustr
Glib::ustring
Regex::replace_literal(const Glib::ustring& string, int start_position,
- const Glib::ustring& replacement, RegexMatchFlags match_options)
+ const Glib::ustring& replacement, MatchFlags match_options)
{
GError* gerror = nullptr;
auto retvalue =
@@ -222,7 +225,7 @@ Regex::replace_literal(const Glib::ustring& string, int start_position,
}
std::vector<Glib::ustring>
-Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options,
+Regex::split(const Glib::ustring& string, int start_position, MatchFlags match_options,
int max_tokens) const
{
GError* gerror = nullptr;
diff --git a/glib/src/regex.hg b/glib/src/regex.hg
index 89928c6..71e2200 100644
--- a/glib/src/regex.hg
+++ b/glib/src/regex.hg
@@ -31,8 +31,6 @@ typedef struct _GRegex GRegex;
namespace Glib
{
-_WRAP_ENUM(RegexCompileFlags, GRegexCompileFlags, NO_GTYPE)
-_WRAP_ENUM(RegexMatchFlags, GRegexMatchFlags, NO_GTYPE)
/** Exception class for Regex
*/
@@ -99,7 +97,10 @@ class Regex final
_IGNORE(g_regex_ref, g_regex_unref)
public:
- static Glib::RefPtr<Glib::Regex> create(const Glib::ustring& pattern, RegexCompileFlags compile_options =
static_cast<RegexCompileFlags>(0), RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0));
+ _WRAP_ENUM(CompileFlags, GRegexCompileFlags, NO_GTYPE)
+ _WRAP_ENUM(MatchFlags, GRegexMatchFlags, NO_GTYPE)
+
+ static Glib::RefPtr<Glib::Regex> create(const Glib::ustring& pattern, CompileFlags compile_options =
static_cast<CompileFlags>(0), MatchFlags match_options = static_cast<MatchFlags>(0));
_WRAP_METHOD(Glib::ustring get_pattern() const, g_regex_get_pattern)
_WRAP_METHOD(int get_max_backref() const, g_regex_get_max_backref)
@@ -107,29 +108,29 @@ public:
_WRAP_METHOD(bool get_has_cr_or_lf() const, g_regex_get_has_cr_or_lf)
_WRAP_METHOD(int get_max_lookbehind() const, g_regex_get_max_lookbehind)
_WRAP_METHOD(int get_string_number(const Glib::ustring& name) const, g_regex_get_string_number)
- _WRAP_METHOD(RegexCompileFlags get_compile_flags() const, g_regex_get_compile_flags)
- _WRAP_METHOD(RegexMatchFlags get_match_flags() const, g_regex_get_match_flags)
+ _WRAP_METHOD(CompileFlags get_compile_flags() const, g_regex_get_compile_flags)
+ _WRAP_METHOD(MatchFlags get_match_flags() const, g_regex_get_match_flags)
static Glib::ustring escape_string(const Glib::ustring& string);
- _WRAP_METHOD(static bool match_simple(const Glib::ustring& pattern, const Glib::ustring& string,
RegexCompileFlags compile_options = static_cast<RegexCompileFlags>(0), RegexMatchFlags match_options =
static_cast<RegexMatchFlags>(0)), g_regex_match_simple)
+ _WRAP_METHOD(static bool match_simple(const Glib::ustring& pattern, const Glib::ustring& string,
CompileFlags compile_options = static_cast<CompileFlags>(0), MatchFlags match_options =
static_cast<MatchFlags>(0)), g_regex_match_simple)
_WRAP_METHOD_DOCS_ONLY(g_regex_match)
bool match(
const Glib::ustring& string,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
/// A match() method not requiring a Glib::MatchInfo.
- bool match(const Glib::ustring& string, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0));
+ bool match(const Glib::ustring& string, MatchFlags match_options = static_cast<MatchFlags>(0));
/// A match() method with a start position and a Glib::MatchInfo.
bool match(
const Glib::ustring& string,
int start_position,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
_WRAP_METHOD_DOCS_ONLY(g_regex_match_full)
@@ -138,33 +139,33 @@ public:
gssize string_len,
int start_position,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
/// A match() method with a start position not requiring a Glib::MatchInfo.
- bool match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options);
+ bool match(const Glib::ustring& string, int start_position, MatchFlags match_options);
/** A match() method with a string length and start position not requiring a
* Glib::MatchInfo.
*/
- bool match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags
match_options);
+ bool match(const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options);
_WRAP_METHOD_DOCS_ONLY(g_regex_match_all)
bool match_all(
const Glib::ustring& string,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
/// A match_all() method not requiring a Glib::MatchInfo.
- bool match_all(const Glib::ustring& string, RegexMatchFlags match_options =
static_cast<RegexMatchFlags>(0));
+ bool match_all(const Glib::ustring& string, MatchFlags match_options = static_cast<MatchFlags>(0));
/// A match_all() method with a start positon and a Glib::MatchInfo.
bool match_all(
const Glib::ustring& string,
int start_position,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
_WRAP_METHOD_DOCS_ONLY(g_regex_match_all_full, errthrow)
@@ -174,34 +175,34 @@ public:
gssize string_len,
int start_position,
Glib::MatchInfo& match_info,
- RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)
+ MatchFlags match_options = static_cast<MatchFlags>(0)
);
/** A match_all() method with a start position not requiring a
* Glib::MatchInfo.
*/
- bool match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options);
+ bool match_all(const Glib::ustring& string, int start_position, MatchFlags match_options);
/** A match_all() method with a start position and a string length not
* requiring a Glib::MatchInfo.
*/
- bool match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags
match_options);
+ bool match_all(const Glib::ustring& string, gssize string_len, int start_position, MatchFlags
match_options);
#m4
_CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(static std::vector<Glib::ustring> split_simple(const Glib::ustring& pattern, const
Glib::ustring& string, RegexCompileFlags compile_options = static_cast<RegexCompileFlags>(0), RegexMatchFlags
match_options = static_cast<RegexMatchFlags>(0)), g_regex_split_simple)
- _WRAP_METHOD(std::vector<Glib::ustring> split(const Glib::ustring& string, RegexMatchFlags match_options =
static_cast<RegexMatchFlags>(0)), g_regex_split)
+ _WRAP_METHOD(static std::vector<Glib::ustring> split_simple(const Glib::ustring& pattern, const
Glib::ustring& string, CompileFlags compile_options = static_cast<CompileFlags>(0), MatchFlags match_options
= static_cast<MatchFlags>(0)), g_regex_split_simple)
+ _WRAP_METHOD(std::vector<Glib::ustring> split(const Glib::ustring& string, MatchFlags match_options =
static_cast<MatchFlags>(0)), g_regex_split)
- _WRAP_METHOD(std::vector<Glib::ustring> split(const gchar* string, gssize string_len, int start_position,
RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0), int max_tokens = 0) const,
g_regex_split_full, errthrow)
+ _WRAP_METHOD(std::vector<Glib::ustring> split(const gchar* string, gssize string_len, int start_position,
MatchFlags match_options = static_cast<MatchFlags>(0), int max_tokens = 0) const, g_regex_split_full,
errthrow)
- std::vector<Glib::ustring> split(const Glib::ustring& string, int start_position, RegexMatchFlags
match_options, int max_tokens) const;
+ std::vector<Glib::ustring> split(const Glib::ustring& string, int start_position, MatchFlags
match_options, int max_tokens) const;
- _WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const
Glib::ustring& replacement, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)),
g_regex_replace, errthrow)
- Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement,
RegexMatchFlags match_options);
+ _WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const
Glib::ustring& replacement, MatchFlags match_options = static_cast<MatchFlags>(0)), g_regex_replace, errthrow)
+ Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement,
MatchFlags match_options);
- _WRAP_METHOD(Glib::ustring replace_literal(const gchar *string, gssize string_len, int start_position,
const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)),
g_regex_replace_literal, errthrow)
- Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring&
replacement, RegexMatchFlags match_options);
+ _WRAP_METHOD(Glib::ustring replace_literal(const gchar *string, gssize string_len, int start_position,
const Glib::ustring& replacement, MatchFlags match_options = static_cast<MatchFlags>(0)),
g_regex_replace_literal, errthrow)
+ Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring&
replacement, MatchFlags match_options);
- _WRAP_METHOD(Glib::ustring replace_eval(const Glib::ustring& string, gssize string_len, int
start_position, RegexMatchFlags match_options, GRegexEvalCallback eval, gpointer user_data),
g_regex_replace_eval, errthrow)
+ _WRAP_METHOD(Glib::ustring replace_eval(const Glib::ustring& string, gssize string_len, int
start_position, MatchFlags match_options, GRegexEvalCallback eval, gpointer user_data),
g_regex_replace_eval, errthrow)
_WRAP_METHOD(static bool check_replacement(const Glib::ustring& replacement, gboolean* has_references),
g_regex_check_replacement, errthrow)
};
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index 79a76dc..0d779fa 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -71,8 +71,8 @@ _CONV_GLIB_ENUM(IOFlags)
_CONV_GLIB_ENUM(IOStatus)
_CONV_GLIB_ENUM(KeyFileFlags)
_CONV_GLIB_ENUM(OptionArg)
-_CONV_GLIB_ENUM(RegexCompileFlags)
-_CONV_GLIB_ENUM(RegexMatchFlags)
+_CONV_GLIB_INCLASS_ENUM(Regex,CompileFlags)
+_CONV_GLIB_INCLASS_ENUM(Regex,MatchFlags)
_CONV_GLIB_ENUM(SeekType)
_CONV_GLIB_ENUM(TimeType)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]