blob: a8b3a2c7e13ed117e1baed8389939eb242f117cb [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 Afanasyevdfa52c42014-04-24 21:10:11 -070028 virtual ~RegexPseudoMatcher()
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080029 {
30 }
Yingdi Yu5e974202014-01-29 16:59:06 -080031
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070032 virtual void
33 compile()
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080034 {
35 }
Yingdi Yu5e974202014-01-29 16:59:06 -080036
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070037 void
Yingdi Yu5e974202014-01-29 16:59:06 -080038 setMatchResult(const std::string& str);
39
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070040 void
Yingdi Yu5e974202014-01-29 16:59:06 -080041 resetMatchResult();
42};
43
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080044inline RegexPseudoMatcher::RegexPseudoMatcher()
45 :RegexMatcher ("", EXPR_PSEUDO)
46{
47}
Yingdi Yu5e974202014-01-29 16:59:06 -080048
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070049inline void
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080050RegexPseudoMatcher::setMatchResult(const std::string& str)
51{
52 m_matchResult.push_back(Name::Component((const uint8_t *)str.c_str(), str.size()));
53}
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070054
55inline void
Alexander Afanasyev36b84cf2014-02-17 19:34:18 -080056RegexPseudoMatcher::resetMatchResult()
57{
58 m_matchResult.clear();
59}
60
61
62} // namespace ndn
63
64#endif // NDN_UTIL_REGEX_REGEX_PSEUDO_MATCHER_HPP