NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
regex-top-matcher.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
25 #define NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
26 
27 #include "../../common.hpp"
28 
29 #include "regex-matcher.hpp"
30 
31 namespace ndn {
32 
33 class RegexPatternListMatcher;
34 class RegexBackrefManager;
35 
37 {
38 public:
39  RegexTopMatcher(const std::string& expr, const std::string& expand = "");
40 
41  virtual
43 
44  bool
45  match(const Name& name);
46 
47  virtual bool
48  match(const Name& name, size_t offset, size_t len);
49 
50  virtual Name
51  expand(const std::string& expand = "");
52 
53  static shared_ptr<RegexTopMatcher>
54  fromName(const Name& name, bool hasAnchor=false);
55 
56 protected:
57  virtual void
58  compile();
59 
60 private:
61  std::string
62  getItemFromExpand(const std::string& expand, size_t& offset);
63 
64  static std::string
65  convertSpecialChar(const std::string& str);
66 
68  const std::string m_expand;
69  shared_ptr<RegexPatternListMatcher> m_primaryMatcher;
70  shared_ptr<RegexPatternListMatcher> m_secondaryMatcher;
71  shared_ptr<RegexBackrefManager> m_primaryBackrefManager;
72  shared_ptr<RegexBackrefManager> m_secondaryBackrefManager;
73  bool m_isSecondaryUsed;
74 };
75 
76 } // namespace ndn
77 
78 #endif // NDN_UTIL_REGEX_REGEX_TOP_MATCHER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
static shared_ptr< RegexTopMatcher > fromName(const Name &name, bool hasAnchor=false)
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
virtual void compile()
Compile the regular expression to generate the more matchers when necessary.
Represents an absolute name.
Definition: name.hpp:42
virtual Name expand(const std::string &expand="")
bool match(const Name &name)
RegexTopMatcher(const std::string &expr, const std::string &expand="")