ndn-regex-matcher.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
24 #ifndef NDN_NDN_REGEX_MATCHER_HPP
25 #define NDN_NDN_REGEX_MATCHER_HPP
26 
27 // Depending if ndn-cpp-config.h defines NDN_CPP_HAVE_BOOST_REGEX or sets
28 // NDN_CPP_HAVE_STD_REGEX = 1, define the regex_lib namespace alias.
29 // Set NDN_CPP_HAVE_REGEX_LIB = 1 if regex_lib is defined.
30 
31 #include <ndn-cpp/ndn-cpp-config.h>
32 #if NDN_CPP_HAVE_STD_REGEX
33  #include <regex>
34  namespace ndn { namespace regex_lib = std; }
35  #define NDN_CPP_HAVE_REGEX_LIB 1
36 #elif defined(NDN_CPP_HAVE_BOOST_REGEX)
37  #include <boost/regex.hpp>
38  namespace ndn { namespace regex_lib = boost; }
39  #define NDN_CPP_HAVE_REGEX_LIB 1
40 #else
41  #define NDN_CPP_HAVE_REGEX_LIB 0
42 #endif
43 
44 // Only compile if we set NDN_CPP_HAVE_REGEX_LIB above.
45 #if NDN_CPP_HAVE_REGEX_LIB
46 
47 #include <string>
48 #include <ndn-cpp/name.hpp>
49 
50 namespace ndn {
51 
60 class NdnRegexMatcher {
61 public:
69  NdnRegexMatcher(const std::string& pattern, const Name& name);
70 
71  regex_lib::sregex_iterator iterator;
72 
73 private:
74  static std::string
75  sanitizeSets(const std::string& pattern);
76 
77  // This keeps the source string that for the pointers in iterator.
78  ptr_lib::shared_ptr<std::string> source_;
79 };
80 
81 }
82 
83 #endif // NDN_CPP_HAVE_REGEX_LIB
84 
85 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
Copyright (C) 2015-2016 Regents of the University of California.
Definition: threadsafe-face.hpp:27
Copyright (C) 2015-2016 Regents of the University of California.