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);
64 boost::regex m_componentRegex;
65 std::vector<shared_ptr<RegexPseudoMatcher> > m_pseudoMatchers;
72 shared_ptr<RegexBackrefManager> backrefManager,
75 , m_isExactMatch(isExactMatch)
86 #if BOOST_VERSION < 105600 95 m_componentRegex = boost::regex(
m_expr);
97 m_pseudoMatchers.clear();
98 m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
103 shared_ptr<RegexPseudoMatcher> pMatcher = make_shared<RegexPseudoMatcher>();
104 m_pseudoMatchers.push_back(pMatcher);
122 boost::smatch subResult;
123 std::string targetStr = name.
get(offset).
toUri();
124 if (boost::regex_match(targetStr, subResult, m_componentRegex))
129 m_pseudoMatchers[i]->resetMatchResult();
130 m_pseudoMatchers[i]->setMatchResult(subResult[i]);
148 #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)
const Component & get(ssize_t i) const
Get the component at the given index.
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