24 #ifndef NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP 25 #define NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP 27 #include <boost/regex.hpp> 44 shared_ptr<RegexBackrefManager> backrefManager,
45 bool isExactMatch =
true);
65 boost::regex m_componentRegex;
66 std::vector<shared_ptr<RegexPseudoMatcher> > m_pseudoMatchers;
73 shared_ptr<RegexBackrefManager> backrefManager,
76 , m_isExactMatch(isExactMatch)
87 #if BOOST_VERSION < 105600 96 m_componentRegex = boost::regex(
m_expr);
98 m_pseudoMatchers.clear();
99 m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
104 shared_ptr<RegexPseudoMatcher> pMatcher = make_shared<RegexPseudoMatcher>();
105 m_pseudoMatchers.push_back(pMatcher);
123 boost::smatch subResult;
124 std::string targetStr = name.
get(offset).
toUri();
125 if (boost::regex_match(targetStr, subResult, m_componentRegex))
130 m_pseudoMatchers[i]->resetMatchResult();
131 m_pseudoMatchers[i]->setMatchResult(subResult[i]);
149 #endif // NDN_UTIL_REGEX_REGEX_COMPONENT_MATCHER_HPP Copyright (c) 2011-2015 Regents of the University of California.
virtual bool match(const Name &name, size_t offset, size_t len=1)
RegexComponentMatcher(const std::string &expr, shared_ptr< RegexBackrefManager > backrefManager, bool isExactMatch=true)
Create a RegexComponent matcher from expr.
shared_ptr< RegexBackrefManager > m_backrefManager
virtual void compile()
Compile the regular expression to generate the more matchers when necessary.
void toUri(std::ostream &os) const
Write *this to the output stream, escaping characters according to the NDN URI Scheme.
virtual ~RegexComponentMatcher()
std::vector< name::Component > m_matchResult
Name abstraction to represent an absolute name.
static const size_t BOOST_REGEXP_MARK_COUNT_CORRECTION
const Component & get(ssize_t i) const
Get the component at the given index.