Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 8 | #ifndef NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP |
| 9 | #define NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 10 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 11 | #include "../../common.hpp" |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 12 | #include "regex-matcher.hpp" |
| 13 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 14 | namespace ndn { |
| 15 | |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 16 | class RegexPseudoMatcher : public RegexMatcher |
| 17 | { |
| 18 | public: |
| 19 | RegexPseudoMatcher(); |
| 20 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 21 | virtual ~RegexPseudoMatcher() |
| 22 | { |
| 23 | } |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 24 | |
| 25 | virtual void |
| 26 | compile() |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 27 | { |
| 28 | } |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 29 | |
| 30 | void |
| 31 | setMatchResult(const std::string& str); |
| 32 | |
| 33 | void |
| 34 | resetMatchResult(); |
| 35 | }; |
| 36 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 37 | inline RegexPseudoMatcher::RegexPseudoMatcher() |
| 38 | :RegexMatcher ("", EXPR_PSEUDO) |
| 39 | { |
| 40 | } |
Yingdi Yu | 5e97420 | 2014-01-29 16:59:06 -0800 | [diff] [blame] | 41 | |
Alexander Afanasyev | 36b84cf | 2014-02-17 19:34:18 -0800 | [diff] [blame^] | 42 | inline void |
| 43 | RegexPseudoMatcher::setMatchResult(const std::string& str) |
| 44 | { |
| 45 | m_matchResult.push_back(Name::Component((const uint8_t *)str.c_str(), str.size())); |
| 46 | } |
| 47 | |
| 48 | inline void |
| 49 | RegexPseudoMatcher::resetMatchResult() |
| 50 | { |
| 51 | m_matchResult.clear(); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | } // namespace ndn |
| 56 | |
| 57 | #endif // NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP |