blob: 182402c7b7d9b015286c9626ea2d6787ccddc37e [file] [log] [blame]
Yingdi Yu5e974202014-01-29 16:59:06 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07003 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
5 *
6 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
8 *
9 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
11 *
12 * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
Yingdi Yu5e974202014-01-29 16:59:06 -080013 */
14
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080015#ifndef NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
16#define NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP
Yingdi Yu5e974202014-01-29 16:59:06 -080017
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080018#include "../../common.hpp"
Yingdi Yu5e974202014-01-29 16:59:06 -080019#include "regex-matcher.hpp"
20
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080021namespace ndn {
22
Yingdi Yu5e974202014-01-29 16:59:06 -080023class RegexPseudoMatcher : public RegexMatcher
24{
25public:
26 RegexPseudoMatcher();
27
Alexander Afanasyevb6b21b32014-04-28 22:38:03 -070028 virtual
29 ~RegexPseudoMatcher()
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080030 {
31 }
Yingdi Yu5e974202014-01-29 16:59:06 -080032
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070033 virtual void
34 compile()
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080035 {
36 }
Yingdi Yu5e974202014-01-29 16:59:06 -080037
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070038 void
Yingdi Yu5e974202014-01-29 16:59:06 -080039 setMatchResult(const std::string& str);
40
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070041 void
Yingdi Yu5e974202014-01-29 16:59:06 -080042 resetMatchResult();
43};
44
Alexander Afanasyevb6b21b32014-04-28 22:38:03 -070045inline
46RegexPseudoMatcher::RegexPseudoMatcher()
47 : RegexMatcher("", EXPR_PSEUDO)
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080048{
49}
Yingdi Yu5e974202014-01-29 16:59:06 -080050
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070051inline void
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080052RegexPseudoMatcher::setMatchResult(const std::string& str)
53{
Alexander Afanasyevb6b21b32014-04-28 22:38:03 -070054 m_matchResult.push_back(name::Component(reinterpret_cast<const uint8_t*>(str.c_str()),
55 str.size()));
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080056}
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070057
58inline void
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080059RegexPseudoMatcher::resetMatchResult()
60{
61 m_matchResult.clear();
62}
63
64
65} // namespace ndn
66
67#endif // NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP