-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTokenizer.h
43 lines (32 loc) · 828 Bytes
/
Tokenizer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Tokenizer.h
*
* Class that separates a string in tokens, given a separator character.
*
* Created on: Jul 10, 2014
* Author: Vítor E. Silva Souza ([email protected])
*/
#ifndef TOKENIZER_H_
#define TOKENIZER_H_
#include <sstream>
#include <string>
#include <vector>
namespace br_ufes_inf_nemo_cpp_util {
using namespace std;
class Tokenizer {
/* A stream with the contents of the string that is to be separated. */
stringstream stream;
/* The separator character. */
char separator;
public:
Tokenizer(const string& str, char separator);
virtual ~Tokenizer() { }
/* Indicates if there is another token to read. */
bool hasNext();
/* Returns the next token. */
const string next();
/* Returns all the remaining tokens as a vector of strings. */
vector<string> remaining();
};
}
#endif