-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordreader.hpp
49 lines (41 loc) · 930 Bytes
/
wordreader.hpp
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
44
45
46
47
48
49
#ifndef WORDREADER_H
#define WORDREADER_H
#include <vector>
#include <string>
struct TargetWord {
int id;
std::string word;
double width;
double distance;
};
class Sentence{
public:
Sentence(int number): id(number){}
int id;
std::vector<TargetWord> words;
void add(TargetWord word){
words.push_back(word);
}
size_t size(){
return words.size();
}
TargetWord operator[](int pos) const{
return words[pos];
}
};
class WordReader {
private:
// Vector of sentence for each player
std::vector< std::vector<Sentence> > sentences;
int _playerCount;
public:
WordReader(int playerCount, std::string filename);
~WordReader();
// Returns null if no such word
TargetWord getWord(int player, int sentenceNumber, int wordNumber);
size_t maxSentence()
{ return sentences[0].size(); }
size_t sentenceLength(int sentenceId)
{ return sentences[0][sentenceId-1].size(); }
};
#endif