TextReader.hpp
1.11 KB
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
50
51
52
/*
* File: TextReader.hpp
* Author: lennyn
*
* Created on May 28, 2014, 11:43 AM
*/
#ifndef TEXTREADER_HPP
#define TEXTREADER_HPP
#include <string>
#include "Environment.hpp"
namespace morfeusz {
class TextReader {
public:
TextReader(const char* inputStart, const char* inputEnd, const Environment& env);
void markWordStartsHere();
const char* getWordStartPtr() const;
const char* getCurrPtr() const;
const char* getNextPtr();
const char* getEndPtr() const;
int getCodepointsRead() const;
bool isAtEnd() const;
bool isAtWhitespace();
bool isInsideAWord();
uint32_t peek();
uint32_t normalizedPeek();
uint32_t next();
void skipWhitespaces();
std::string readWhitespacesChunk();
void proceedToEnd();
virtual ~TextReader();
private:
int codepointsNum;
const char* wordStartPtr;
const char* currPtr;
const char* inputEnd;
const Environment& env;
bool knowsAboutWhitespace;
bool atWhitespace;
bool peekIsRead;
uint32_t thePeek;
uint32_t theNormalizedPeek;
const char* ptrAfterThePeek;
};
}
#endif /* TEXTREADER_HPP */