37 for (std::list<uint32>::const_iterator it = list.begin(); it != list.end(); ++it)
69 bool chunkEnd =
false;
71 uint32 separator = 0xFFFFFFFF;
115 if (isChunkEndChar) {
127 if (isSeparatorChar) {
145 if (nullChar != token.
end())
174 bool shouldSkip = isSeparator;
190 size_t min,
size_t max,
const UString &def) {
197 size_t realTokenCount = 0;
198 while (!
isChunkEnd(stream) && (realTokenCount < max)) {
202 list.push_back(token);
207 while (list.size() < min)
210 return realTokenCount;
A class holding an UTF-8 string.
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
bool isChunkEnd(SeekableReadStream &stream)
UString getToken(SeekableReadStream &stream)
Parse a token out of the stream.
void truncate(const iterator &it)
void addChunkEnd(uint32 c)
Add a character marking the end of a chunk.
static const uint32 kEOF
Return value for end-of-file.
iterator findFirst(uint32 c) const
static bool isIn(uint32 c, const std::list< uint32 > &list)
Basic exceptions to throw.
utf8::iterator< std::string::const_iterator > iterator
bool empty() const
Is the string empty?
std::list< uint32 > _quotes
void addIgnore(uint32 c)
Add a character to ignore.
StreamTokenizer(ConsecutiveSeparatorRule conSepRule=kRuleHeed)
Basic reading stream interfaces.
std::list< uint32 > _chunkEnds
Seek from the current position of the stream.
void findFirstToken(SeekableReadStream &stream)
Find the first token character, skipping past separators.
size_t getTokens(SeekableReadStream &stream, std::vector< UString > &list, size_t min=0, size_t max=SIZE_MAX, const UString &def="")
Parse tokens out of the stream.
std::list< uint32 > _ignores
ConsecutiveSeparatorRule _conSepRule
ConsecutiveSeparatorRule
What to do when consecutive separator are found.
Parse tokens out of a stream.
void nextChunk(SeekableReadStream &stream)
Skip past end of chunk characters.
Ignore all repeated separators.
uint32 readChar()
Reads the next character from stream and returns it as an unsigned char cast to an uint32...
void skipChunk(SeekableReadStream &stream)
Skip to the end of the chunk.
void addSeparator(uint32 c)
Add a character on where to split tokens.
void skipToken(SeekableReadStream &stream, size_t n=1)
Skip a number of tokens.
std::list< uint32 > _separators
Ignore the repeated separator, but only if it's the same.
void addQuote(uint32 c)
Add a character able to enclose (quote) separators and chunk ends.
Interface for a seekable & readable data stream.