All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ndn-regex-component-set-matcher.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_NDN_REGEX_COMPONENT_SET_MATCHER_HPP
24 #define NDN_NDN_REGEX_COMPONENT_SET_MATCHER_HPP
25 
26 #include "ndn-regex-component-matcher.hpp"
27 #include "ndn-regex-matcher-base.hpp"
28 
29 namespace ndn {
30 
31 class NdnRegexComponentSetMatcher : public NdnRegexMatcherBase {
32 public:
39  (const std::string& expr,
40  ptr_lib::shared_ptr<NdnRegexBackrefManager> backrefManager)
41  : NdnRegexMatcherBase(expr, NDN_REGEX_EXPR_COMPONENT_SET, backrefManager),
42  isInclusion_(true)
43  {
44  compile();
45  }
46 
47  virtual
49 
50  virtual bool
51  match(const Name& name, size_t offset, size_t len);
52 
53 protected:
57  virtual void
58  compile();
59 
60 private:
61  size_t
62  extractComponent(size_t index);
63 
64  void
65  compileSingleComponent();
66 
67  void
68  compileMultipleComponents(size_t start, size_t lastIndex);
69 
70  std::vector<ptr_lib::shared_ptr<NdnRegexComponentMatcher> > components_;
71  bool isInclusion_;
72 };
73 
74 }
75 
76 #endif
Definition: ndn-regex-component-set-matcher.hpp:31
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
NdnRegexComponentSetMatcher(const std::string &expr, ptr_lib::shared_ptr< NdnRegexBackrefManager > backrefManager)
Create an NdnRegexComponentSetMatcher matcher from expr.
Definition: ndn-regex-component-set-matcher.hpp:39
virtual void compile()
Compile the regular expression to generate more matchers when necessary.