blob: 93634623be9dda816b741a07a8b5137fa48e0f5f [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef NLSR_TOKENIZER_HPP
2#define NLSR_TOKENIZER_HPP
3
4#include <iostream>
5#include <boost/tokenizer.hpp>
6#include <boost/algorithm/string.hpp>
7#include <string>
8#include <list>
9#include <ndn-cpp-dev/face.hpp>
10
11using namespace std;
12using namespace boost;
13
14class nlsrTokenizer{
15 public:
16 nlsrTokenizer(const string& inputString)
17 :firstToken(),
18 restOfTheLine()
19 {
20 seps = " ";
21 originalString = inputString;
22 makeToken();
23 }
24
25 nlsrTokenizer(const string& inputString, const string& separator)
26 :firstToken(),
27 restOfTheLine()
28 {
29 seps = separator;
30 originalString = inputString;
31 makeToken();
32 }
33
34 string getFirstToken(){
35 return firstToken;
36 }
37
38 string getRestOfLine(){
39 return restOfTheLine;
40 }
41
42 int getTokenPosition(string& token);
43 string getTokenString(int from , int to);
44 string getTokenString(int from);
45 bool doesTokenExist(string token);
46
47 private:
48
49 void makeToken();
50 void insertToken(const string& token);
51
52 string seps;
53 string originalString;
54 string firstToken;
55 string restOfTheLine;
56 std::list<string> tokenList;
57};
58
59#endif