Go to the documentation of this file.
48 #ifndef INCLUDED_LINE_SPLITTER_H
49 #define INCLUDED_LINE_SPLITTER_H
52 # pragma GCC system_header
56 #include <assimp/StreamReader.h>
82 typedef size_t line_idx;
112 std::string operator* ()
const;
116 operator bool()
const;
120 operator line_idx()
const;
122 line_idx get_index()
const;
144 bool mSwallow, mSkip_empty_lines, mTrim;
153 , mSkip_empty_lines(skip_empty_lines)
161 LineSplitter::~LineSplitter() {
173 throw std::logic_error(
"End of file, no more lines to be retrieved.");
179 if (s ==
'\n' || s ==
'\r') {
180 if (mSkip_empty_lines) {
216 for (
size_t i = 0; i < idx; ++i) {
218 for (; !IsSpace(*s); ++s) {
220 throw std::range_error(
"Token index out of range, EOL reached");
234 for (
size_t i = 0; i < N; ++i) {
236 throw std::range_error(
"Token count out of range, EOL reached");
240 for (; *s && !IsSpace(*s); ++s);
251 std::string LineSplitter::operator* ()
const {
256 LineSplitter::operator bool()
const {
257 return mStream.GetRemainingSize() > 0;
261 LineSplitter::operator line_idx()
const {
266 LineSplitter::line_idx LineSplitter::get_index()
const {
277 const size_t len = ::strlen(check);
279 return len <= mCur.length() && std::equal(check, check + len, mCur.begin());
289 #endif // INCLUDED_LINE_SPLITTER_H
int8_t GetI1()
Definition: StreamReader.h:140
void swallow_next_increment()
Definition: LineSplitter.h:283
size_t GetRemainingSize() const
Get the remaining stream size (to the end of the stream)
Definition: StreamReader.h:182
void IncPtr(intptr_t plus)
Definition: StreamReader.h:196
Definition: StreamReader.h:73
Definition: LineSplitter.h:80
const std::string * operator->() const
Definition: LineSplitter.h:246
const char * operator[](size_t idx) const
Definition: LineSplitter.h:212
StreamReaderLE & get_stream()
Definition: LineSplitter.h:271
void get_tokens(const char *(&tokens)[N]) const
bool match_start(const char *check)
Definition: LineSplitter.h:276
LineSplitter(StreamReaderLE &stream, bool skip_empty_lines=true, bool trim=true)
Definition: LineSplitter.h:148
Defines helper functions for text parsing.
Definition: ai_assert.h:50
LineSplitter & operator++()
Definition: LineSplitter.h:166