blob: 1f09cacb7be070f7addc7189ac178c91658cc8d1 [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
akmhoqueb1710aa2014-02-19 17:13:36 -060011namespace nlsr {
12
akmhoque298385a2014-02-13 14:13:09 -060013using namespace std;
14using namespace boost;
15
16class nlsrTokenizer{
17 public:
18 nlsrTokenizer(const string& inputString)
19 :firstToken(),
20 restOfTheLine()
21 {
22 seps = " ";
23 originalString = inputString;
24 makeToken();
25 }
26
27 nlsrTokenizer(const string& inputString, const string& separator)
28 :firstToken(),
29 restOfTheLine()
30 {
31 seps = separator;
32 originalString = inputString;
33 makeToken();
34 }
35
36 string getFirstToken(){
37 return firstToken;
38 }
39
40 string getRestOfLine(){
41 return restOfTheLine;
42 }
43
44 int getTokenPosition(string& token);
45 string getTokenString(int from , int to);
46 string getTokenString(int from);
47 bool doesTokenExist(string token);
48
49 private:
50
51 void makeToken();
52 void insertToken(const string& token);
53
54 string seps;
55 string originalString;
56 string firstToken;
57 string restOfTheLine;
58 std::list<string> tokenList;
59};
60
akmhoqueb1710aa2014-02-19 17:13:36 -060061}//namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060062#endif