30 shared_ptr<RegexBackrefManager> backrefManager,
33 , m_isExactMatch(isExactMatch)
41 m_componentRegex.assign(
m_expr);
43 m_pseudoMatchers.clear();
44 m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
46 for (
size_t i = 1; i <= m_componentRegex.mark_count(); i++) {
47 m_pseudoMatchers.push_back(make_shared<RegexPseudoMatcher>());
63 NDN_THROW(
Error(
"Non-exact component search is not supported yet"));
65 std::smatch subResult;
66 std::string targetStr = name.
get(offset).
toUri();
67 if (std::regex_match(targetStr, subResult, m_componentRegex)) {
68 for (
size_t i = 1; i <= m_componentRegex.mark_count(); i++) {
69 m_pseudoMatchers[i]->resetMatchResult();
70 m_pseudoMatchers[i]->setMatchResult(subResult[i]);
const Component & get(ssize_t i) const
Returns an immutable reference to the component at the specified index.
bool match(const Name &name, size_t offset, size_t len=1) override
RegexComponentMatcher(const std::string &expr, shared_ptr< RegexBackrefManager > backrefManager, bool isExactMatch=true)
Create a RegexComponent matcher from expr.
shared_ptr< RegexBackrefManager > m_backrefManager
std::vector< name::Component > m_matchResult
Represents an absolute name.
void toUri(std::ostream &os, UriFormat format=UriFormat::DEFAULT) const
Write *this to the output stream, escaping characters according to the NDN URI format.
void compile() override
Compile the regular expression to generate the more matchers when necessary.