|
1
|
/*
|
|
2
|
* File: TextReader.hpp
|
|
3
4
5
6
7
8
9
10
|
* Author: lennyn
*
* Created on May 28, 2014, 11:43 AM
*/
#ifndef TEXTREADER_HPP
#define TEXTREADER_HPP
|
|
11
|
#include <string>
|
|
12
|
#include "Environment.hpp"
|
|
13
|
|
|
14
15
|
namespace morfeusz {
|
|
16
17
18
19
20
21
22
23
24
25
26
|
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();
|
|
27
|
bool isInsideAWord();
|
|
28
29
30
31
|
uint32_t peek();
uint32_t normalizedPeek();
uint32_t next();
void skipWhitespaces();
|
|
32
|
std::string readWhitespacesChunk();
|
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
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;
};
|
|
49
50
|
}
|
|
51
52
|
#endif /* TEXTREADER_HPP */
|