net+util: remove dependency on Boost.Regex
Use std::regex instead.
Change-Id: I6c53edf177b7861d47a1f256aa975e4100e00d45
diff --git a/src/util/regex/regex-component-matcher.cpp b/src/util/regex/regex-component-matcher.cpp
index aca35c1..2c6da84 100644
--- a/src/util/regex/regex-component-matcher.cpp
+++ b/src/util/regex/regex-component-matcher.cpp
@@ -38,7 +38,7 @@
void
RegexComponentMatcher::compile()
{
- m_componentRegex = boost::regex(m_expr);
+ m_componentRegex.assign(m_expr);
m_pseudoMatchers.clear();
m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
@@ -62,9 +62,9 @@
if (!m_isExactMatch)
BOOST_THROW_EXCEPTION(Error("Non-exact component search is not supported yet"));
- boost::smatch subResult;
+ std::smatch subResult;
std::string targetStr = name.get(offset).toUri();
- if (boost::regex_match(targetStr, subResult, m_componentRegex)) {
+ if (std::regex_match(targetStr, subResult, m_componentRegex)) {
for (size_t i = 1; i <= m_componentRegex.mark_count(); i++) {
m_pseudoMatchers[i]->resetMatchResult();
m_pseudoMatchers[i]->setMatchResult(subResult[i]);
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index 4c5ecf0..f00b183 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,7 +26,7 @@
#include "regex-matcher.hpp"
-#include <boost/regex.hpp>
+#include <regex>
namespace ndn {
@@ -54,7 +54,7 @@
private:
bool m_isExactMatch;
- boost::regex m_componentRegex;
+ std::regex m_componentRegex;
std::vector<shared_ptr<RegexPseudoMatcher>> m_pseudoMatchers;
};
diff --git a/src/util/regex/regex-repeat-matcher.cpp b/src/util/regex/regex-repeat-matcher.cpp
index 17986bf..0fdc543 100644
--- a/src/util/regex/regex-repeat-matcher.cpp
+++ b/src/util/regex/regex-repeat-matcher.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,8 +25,8 @@
#include "regex-backref-matcher.hpp"
#include "regex-component-set-matcher.hpp"
-#include <boost/regex.hpp>
#include <cstdlib>
+#include <regex>
namespace ndn {
@@ -91,32 +91,30 @@
size_t min = 0;
size_t max = 0;
- if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,[0-9]+\\}"))) {
+ if (std::regex_match(repeatStruct, std::regex("\\{[0-9]+,[0-9]+\\}"))) {
size_t separator = repeatStruct.find_first_of(',', 0);
min = std::atoi(repeatStruct.substr(1, separator - 1).data());
max = std::atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).data());
}
- else if (boost::regex_match(repeatStruct, boost::regex("\\{,[0-9]+\\}"))) {
+ else if (std::regex_match(repeatStruct, std::regex("\\{,[0-9]+\\}"))) {
size_t separator = repeatStruct.find_first_of(',', 0);
min = 0;
max = std::atoi(repeatStruct.substr(separator + 1, rsSize - separator - 2).data());
}
- else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+,\\}"))) {
+ else if (std::regex_match(repeatStruct, std::regex("\\{[0-9]+,\\}"))) {
size_t separator = repeatStruct.find_first_of(',', 0);
min = std::atoi(repeatStruct.substr(1, separator).data());
max = MAX_REPETITIONS;
}
- else if (boost::regex_match(repeatStruct, boost::regex("\\{[0-9]+\\}"))) {
+ else if (std::regex_match(repeatStruct, std::regex("\\{[0-9]+\\}"))) {
min = std::atoi(repeatStruct.substr(1, rsSize - 1).data());
max = min;
}
else
- BOOST_THROW_EXCEPTION(Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
- + " Unrecognized format " + m_expr));
+ BOOST_THROW_EXCEPTION(Error("RegexRepeatMatcher::parseRepetition(): Unrecognized format " + m_expr));
if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max)
- BOOST_THROW_EXCEPTION(Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
- + " Wrong number " + m_expr));
+ BOOST_THROW_EXCEPTION(Error("RegexRepeatMatcher::parseRepetition(): Wrong number " + m_expr));
m_repeatMin = min;
m_repeatMax = max;