From: Giovanni Mascellani Date: Tue, 9 Oct 2018 23:02:01 +0200 Subject: Use actual boost::regex. --- cutl/re/re.cxx | 44 ++++++++++++++++++++++---------------------- m4/libboost.m4 | 6 +++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/cutl/re/re.cxx b/cutl/re/re.cxx index 3b132ab..654903f 100644 --- a/cutl/re/re.cxx +++ b/cutl/re/re.cxx @@ -9,7 +9,7 @@ #ifndef LIBCUTL_EXTERNAL_BOOST # include #else -# include +# include #endif using namespace std; @@ -40,17 +40,17 @@ namespace cutl struct basic_regex::impl { typedef basic_string string_type; - typedef tr1::basic_regex regex_type; + typedef boost::basic_regex regex_type; typedef typename regex_type::flag_type flag_type; impl () {} impl (regex_type const& r): r (r) {} impl (string_type const& s, bool icase) { - flag_type f (tr1::regex_constants::ECMAScript); + flag_type f (boost::regex_constants::ECMAScript); if (icase) - f |= tr1::regex_constants::icase; + f |= boost::regex_constants::icase; r.assign (s, f); } @@ -118,15 +118,15 @@ namespace cutl impl_ = s == 0 ? new impl : new impl (*s, icase); else { - impl::flag_type f (tr1::regex_constants::ECMAScript); + impl::flag_type f (boost::regex_constants::ECMAScript); if (icase) - f |= tr1::regex_constants::icase; + f |= boost::regex_constants::icase; impl_->r.assign (*s, f); } } - catch (tr1::regex_error const& e) + catch (boost::regex_error const& e) { throw basic_format (s == 0 ? "" : *s, e.what ()); } @@ -146,15 +146,15 @@ namespace cutl impl_ = s == 0 ? new impl : new impl (*s, icase); else { - impl::flag_type f (tr1::regex_constants::ECMAScript); + impl::flag_type f (boost::regex_constants::ECMAScript); if (icase) - f |= tr1::regex_constants::icase; + f |= boost::regex_constants::icase; impl_->r.assign (*s, f); } } - catch (tr1::regex_error const& e) + catch (boost::regex_error const& e) { throw basic_format (s == 0 ? L"" : *s, e.what ()); } @@ -166,28 +166,28 @@ namespace cutl bool basic_regex:: match (string_type const& s) const { - return tr1::regex_match (s, impl_->r); + return boost::regex_match (s, impl_->r); } template <> bool basic_regex:: match (string_type const& s) const { - return tr1::regex_match (s, impl_->r); + return boost::regex_match (s, impl_->r); } template <> bool basic_regex:: search (string_type const& s) const { - return tr1::regex_search (s, impl_->r); + return boost::regex_search (s, impl_->r); } template <> bool basic_regex:: search (string_type const& s) const { - return tr1::regex_search (s, impl_->r); + return boost::regex_search (s, impl_->r); } template <> @@ -196,13 +196,13 @@ namespace cutl string_type const& sub, bool first_only) const { - tr1::regex_constants::match_flag_type f ( - tr1::regex_constants::format_default); + boost::regex_constants::match_flag_type f ( + boost::regex_constants::format_default); if (first_only) - f |= tr1::regex_constants::format_first_only; + f |= boost::regex_constants::format_first_only; - return tr1::regex_replace (s, impl_->r, sub, f); + return boost::regex_replace (s, impl_->r, sub, f); } template <> @@ -211,13 +211,13 @@ namespace cutl string_type const& sub, bool first_only) const { - tr1::regex_constants::match_flag_type f ( - tr1::regex_constants::format_default); + boost::regex_constants::match_flag_type f ( + boost::regex_constants::format_default); if (first_only) - f |= tr1::regex_constants::format_first_only; + f |= boost::regex_constants::format_first_only; - return tr1::regex_replace (s, impl_->r, sub, f); + return boost::regex_replace (s, impl_->r, sub, f); } } } diff --git a/m4/libboost.m4 b/m4/libboost.m4 index a0b5a06..effb38e 100644 --- a/m4/libboost.m4 +++ b/m4/libboost.m4 @@ -129,13 +129,13 @@ dnl AC_DEFUN([LIBBOOST_REGEX], [ LIBBOOST_LIB([regex],[ AC_LANG_SOURCE([ -#include +#include int main () { - std::tr1::regex r ("te.t", std::tr1::regex_constants::ECMAScript); - return std::tr1::regex_match ("test", r) ? 0 : 1; + boost::regex r ("te.t", boost::regex_constants::ECMAScript); + return boost::regex_match ("test", r) ? 0 : 1; } ])], [$1],