diff options
Diffstat (limited to 'glib/src/regex.ccg')
-rw-r--r-- | glib/src/regex.ccg | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg index e0591f64..6e9cae4e 100644 --- a/glib/src/regex.ccg +++ b/glib/src/regex.ccg @@ -20,6 +20,26 @@ namespace Glib { +#ifdef GLIBMM_EXCEPTIONS_ENABLED +Glib::RefPtr<Glib::Regex> Regex::create(const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options) +#else +Glib::RefPtr<Glib::Regex> Regex::create(const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options, std::auto_ptr<Glib::Error>& error) +#endif //GLIBMM_EXCEPTIONS_ENABLED +{ + GError* gerror = NULL; + GRegex* regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options, (GRegexMatchFlags)match_options, &gerror); + +#ifdef GLIBMM_EXCEPTIONS_ENABLED + if(gerror) + ::Glib::Error::throw_exception(gerror); +#else + if(gerror) + error = ::Glib::Error::throw_exception(gerror); +#endif //GLIBMM_EXCEPTIONS_ENABLED + + return Glib::wrap(regex); +} + bool Regex::match(const Glib::ustring& string, RegexMatchFlags match_options) { return g_regex_match(gobj(), string.c_str(), ((GRegexMatchFlags)(match_options)), NULL); |