All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ndn-regex-repeat-matcher.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_NDN_REGEX_REPEAT_MATCHER_HPP
24 #define NDN_NDN_REGEX_REPEAT_MATCHER_HPP
25 
26 #include "ndn-regex-matcher-base.hpp"
27 
28 namespace ndn {
29 
30 class NdnRegexRepeatMatcher : public NdnRegexMatcherBase {
31 public:
33  (const std::string& expr,
34  ptr_lib::shared_ptr<NdnRegexBackrefManager> backrefManager,
35  size_t indicator)
36  : NdnRegexMatcherBase(expr, NDN_REGEX_EXPR_REPEAT_PATTERN, backrefManager),
37  indicator_(indicator), repeatMin_(0), repeatMax_(0)
38  {
39  compile();
40  }
41 
42  virtual
44 
45  virtual bool
46  match(const Name& name, size_t offset, size_t len);
47 
48 protected:
52  virtual void
53  compile();
54 
55 private:
56  bool
57  parseRepetition();
58 
59  bool
60  recursiveMatch(size_t repeat, const Name& name, size_t offset, size_t len);
61 
62  size_t indicator_;
63  size_t repeatMin_;
64  size_t repeatMax_;
65 };
66 
67 
68 }
69 
70 #endif
Definition: ndn-regex-repeat-matcher.hpp:30
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
virtual void compile()
Compile the regular expression to generate more matchers when necessary.