kDB: Knowledge DataBase
Loading...
Searching...
No Matches
LexerTextStream.h
1#include <QString>
2
3class QIODevice;
4
5namespace knowCore
6{
18 {
19 public:
25 LexerTextStream(QIODevice* sstream);
31 LexerTextStream(const QString& string);
33 void setDevice(QIODevice* sstream);
34 void setString(const QString& string);
35 struct Element
36 {
37 QString content;
38 int line;
39 int column;
40 bool eof;
41 bool operator==(char c) const { return content.size() == 1 and content[0] == c; }
42 bool operator!=(char c) const { return not(*this == c); }
43#define KNOWCORE_CORE_LEXERBASE_CHAR_F(_F_) \
44 bool _F_() const { return content.size() == 1 and content[0]._F_(); }
45 KNOWCORE_CORE_LEXERBASE_CHAR_F(isSpace)
46 KNOWCORE_CORE_LEXERBASE_CHAR_F(isLetter)
47 KNOWCORE_CORE_LEXERBASE_CHAR_F(isDigit)
48 bool isLetterOrDigit() const
49 {
50 return content.size() == 1 and (content[0].isLetter() or content[0].isDigit());
51 }
52 };
64 void unget(Element c);
68 std::tuple<Element, bool> getString(const QString& terminator);
72 std::tuple<Element, bool> getDigit(Element start);
73 bool eof() const;
77 void setBufferSize(std::size_t _size);
81 std::size_t bufferSize();
93 std::size_t currentBufferSize();
94 private:
95 struct Private;
96 Private* const d;
97 };
98} // namespace knowCore
Definition LexerTextStream.h:18
std::size_t bufferSize()
Definition LexerTextStream.cpp:93
std::tuple< Element, bool > getString(const QString &terminator)
Definition LexerTextStream.cpp:204
std::size_t currentBufferSize()
Definition LexerTextStream.cpp:95
void unget(Element c)
Definition LexerTextStream.cpp:348
void setBufferSize(std::size_t _size)
Definition LexerTextStream.cpp:91
std::tuple< Element, bool > getDigit(Element start)
Definition LexerTextStream.cpp:311
Element getNextChar()
Definition LexerTextStream.cpp:134
Element getNextNonSeparatorChar()
Definition LexerTextStream.cpp:121
Definition LexerTextStream.cpp:12
Definition LexerTextStream.h:36