Line 0
Link Here
|
|
|
1 |
Use regex from C++11 instead of boost/tr1's version (the latter is gone as of |
2 |
boost 1.65). |
3 |
--- cutl/re/re.cxx.orig 2017-07-14 14:59:43 UTC |
4 |
+++ cutl/re/re.cxx |
5 |
@@ -9,7 +9,7 @@ |
6 |
#ifndef LIBCUTL_EXTERNAL_BOOST |
7 |
# include <cutl/details/boost/tr1/regex.hpp> |
8 |
#else |
9 |
-# include <boost/tr1/regex.hpp> |
10 |
+# include <regex> |
11 |
#endif |
12 |
|
13 |
using namespace std; |
14 |
@@ -40,17 +40,17 @@ namespace cutl |
15 |
struct basic_regex<C>::impl |
16 |
{ |
17 |
typedef basic_string<C> string_type; |
18 |
- typedef tr1::basic_regex<C> regex_type; |
19 |
+ typedef std::basic_regex<C> regex_type; |
20 |
typedef typename regex_type::flag_type flag_type; |
21 |
|
22 |
impl () {} |
23 |
impl (regex_type const& r): r (r) {} |
24 |
impl (string_type const& s, bool icase) |
25 |
{ |
26 |
- flag_type f (tr1::regex_constants::ECMAScript); |
27 |
+ flag_type f (std::regex_constants::ECMAScript); |
28 |
|
29 |
if (icase) |
30 |
- f |= tr1::regex_constants::icase; |
31 |
+ f |= std::regex_constants::icase; |
32 |
|
33 |
r.assign (s, f); |
34 |
} |
35 |
@@ -118,15 +118,15 @@ namespace cutl |
36 |
impl_ = s == 0 ? new impl : new impl (*s, icase); |
37 |
else |
38 |
{ |
39 |
- impl::flag_type f (tr1::regex_constants::ECMAScript); |
40 |
+ impl::flag_type f (std::regex_constants::ECMAScript); |
41 |
|
42 |
if (icase) |
43 |
- f |= tr1::regex_constants::icase; |
44 |
+ f |= std::regex_constants::icase; |
45 |
|
46 |
impl_->r.assign (*s, f); |
47 |
} |
48 |
} |
49 |
- catch (tr1::regex_error const& e) |
50 |
+ catch (std::regex_error const& e) |
51 |
{ |
52 |
throw basic_format<char> (s == 0 ? "" : *s, e.what ()); |
53 |
} |
54 |
@@ -146,15 +146,15 @@ namespace cutl |
55 |
impl_ = s == 0 ? new impl : new impl (*s, icase); |
56 |
else |
57 |
{ |
58 |
- impl::flag_type f (tr1::regex_constants::ECMAScript); |
59 |
+ impl::flag_type f (std::regex_constants::ECMAScript); |
60 |
|
61 |
if (icase) |
62 |
- f |= tr1::regex_constants::icase; |
63 |
+ f |= std::regex_constants::icase; |
64 |
|
65 |
impl_->r.assign (*s, f); |
66 |
} |
67 |
} |
68 |
- catch (tr1::regex_error const& e) |
69 |
+ catch (std::regex_error const& e) |
70 |
{ |
71 |
throw basic_format<wchar_t> (s == 0 ? L"" : *s, e.what ()); |
72 |
} |
73 |
@@ -166,28 +166,28 @@ namespace cutl |
74 |
bool basic_regex<char>:: |
75 |
match (string_type const& s) const |
76 |
{ |
77 |
- return tr1::regex_match (s, impl_->r); |
78 |
+ return std::regex_match (s, impl_->r); |
79 |
} |
80 |
|
81 |
template <> |
82 |
bool basic_regex<wchar_t>:: |
83 |
match (string_type const& s) const |
84 |
{ |
85 |
- return tr1::regex_match (s, impl_->r); |
86 |
+ return std::regex_match (s, impl_->r); |
87 |
} |
88 |
|
89 |
template <> |
90 |
bool basic_regex<char>:: |
91 |
search (string_type const& s) const |
92 |
{ |
93 |
- return tr1::regex_search (s, impl_->r); |
94 |
+ return std::regex_search (s, impl_->r); |
95 |
} |
96 |
|
97 |
template <> |
98 |
bool basic_regex<wchar_t>:: |
99 |
search (string_type const& s) const |
100 |
{ |
101 |
- return tr1::regex_search (s, impl_->r); |
102 |
+ return std::regex_search (s, impl_->r); |
103 |
} |
104 |
|
105 |
template <> |
106 |
@@ -196,13 +196,13 @@ namespace cutl |
107 |
string_type const& sub, |
108 |
bool first_only) const |
109 |
{ |
110 |
- tr1::regex_constants::match_flag_type f ( |
111 |
- tr1::regex_constants::format_default); |
112 |
+ std::regex_constants::match_flag_type f ( |
113 |
+ std::regex_constants::format_default); |
114 |
|
115 |
if (first_only) |
116 |
- f |= tr1::regex_constants::format_first_only; |
117 |
+ f |= std::regex_constants::format_first_only; |
118 |
|
119 |
- return tr1::regex_replace (s, impl_->r, sub, f); |
120 |
+ return std::regex_replace (s, impl_->r, sub, f); |
121 |
} |
122 |
|
123 |
template <> |
124 |
@@ -211,13 +211,13 @@ namespace cutl |
125 |
string_type const& sub, |
126 |
bool first_only) const |
127 |
{ |
128 |
- tr1::regex_constants::match_flag_type f ( |
129 |
- tr1::regex_constants::format_default); |
130 |
+ std::regex_constants::match_flag_type f ( |
131 |
+ std::regex_constants::format_default); |
132 |
|
133 |
if (first_only) |
134 |
- f |= tr1::regex_constants::format_first_only; |
135 |
+ f |= std::regex_constants::format_first_only; |
136 |
|
137 |
- return tr1::regex_replace (s, impl_->r, sub, f); |
138 |
+ return std::regex_replace (s, impl_->r, sub, f); |
139 |
} |
140 |
} |
141 |
} |