blob: 9cc021263d3882e106972829236ba04b55db0f7d [file] [log] [blame]
Yingdi Yu5e974202014-01-29 16:59:06 -08001/* -*- 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
8#ifndef NDN_REGEX_REPEAT_MATCHER_HPP
9#define NDN_REGEX_REPEAT_MATCHER_HPP
10
11#include "regex-matcher.hpp"
12
13namespace ndn
14{
15
16class RegexRepeatMatcher : public RegexMatcher
17{
18public:
19 RegexRepeatMatcher(const std::string expr, ptr_lib::shared_ptr<RegexBackrefManager> backRefManager, int indicator);
20
21 virtual ~RegexRepeatMatcher(){}
22
23 virtual bool
24 match(const Name & name, const int & offset, const int & len);
25
26protected:
27 /**
28 * @brief Compile the regular expression to generate the more matchers when necessary
29 * @returns true if compiling succeeds
30 */
31 virtual void
32 compile();
33
34
35private:
36 bool
37 parseRepetition();
38
39 bool
40 recursiveMatch (int repeat,
41 const Name & name,
42 const int & offset,
43 const int &len);
44
45private:
46 int m_indicator;
47 int m_repeatMin;
48 int m_repeatMax;
49};
50
51}//ndn
52
53#endif