upgraded to C++17 compatibility
This commit is contained in:
+4
-4
@@ -25,25 +25,25 @@
|
||||
namespace mrw {
|
||||
|
||||
RegExp::RegExp(const std::string& pattern, bool hassub, int flags)
|
||||
throw(std::exception):
|
||||
:
|
||||
_hassub(hassub) {
|
||||
if (flags&nosub) throw mrw::invalid_argument("nosub");
|
||||
if (regcomp(&_regex, pattern.c_str(), (_hassub?flags:(flags|nosub))))
|
||||
throw mrw::invalid_argument(pattern);
|
||||
}
|
||||
|
||||
RegExp::~RegExp() throw() {
|
||||
RegExp::~RegExp() noexcept {
|
||||
regfree(&_regex);
|
||||
}
|
||||
|
||||
bool RegExp::operator()(const std::string& text) throw(std::bad_exception) {
|
||||
bool RegExp::operator()(const std::string& text) {
|
||||
if (_hassub)
|
||||
return !regexec(&_regex, (_text=text).c_str(), MAX_SUB, _sub, 0);
|
||||
else
|
||||
return !regexec(&_regex, text.c_str(), 0, 0, 0);
|
||||
}
|
||||
|
||||
std::string RegExp::operator[](unsigned int n) const throw(std::exception) {
|
||||
std::string RegExp::operator[](unsigned int n) const {
|
||||
if (!_hassub)
|
||||
throw mrw::invalid_argument("initialized with no sub expressions");
|
||||
if (n>=MAX_SUB || _sub[n].rm_so<0 || _sub[n].rm_eo<0)
|
||||
|
||||
Reference in New Issue
Block a user