本文整理汇总了C++中SeekableReadStream::readChar方法的典型用法代码示例。如果您正苦于以下问题:C++ SeekableReadStream::readChar方法的具体用法?C++ SeekableReadStream::readChar怎么用?C++ SeekableReadStream::readChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeekableReadStream
的用法示例。
在下文中一共展示了SeekableReadStream::readChar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nextChunk
void StreamTokenizer::nextChunk(SeekableReadStream &stream) {
skipChunk(stream);
uint32 c = stream.readChar();
if (c == ReadStream::kEOF)
return;
if (!isIn(c, _chunkEnds))
stream.seek(-1, SeekableReadStream::kOriginCurrent);
}
示例2: isChunkEnd
bool StreamTokenizer::isChunkEnd(SeekableReadStream &stream) {
uint32 c = stream.readChar();
if (c == ReadStream::kEOF)
return true;
bool chunkEnd = isIn(c, _chunkEnds);
stream.seek(-1, SeekableReadStream::kOriginCurrent);
return chunkEnd;
}
示例3: skipChunk
void StreamTokenizer::skipChunk(SeekableReadStream &stream) {
assert(!_chunkEnds.empty());
uint32 c;
while ((c = stream.readChar()) != ReadStream::kEOF) {
if (isIn(c, _chunkEnds)) {
stream.seek(-1, SeekableReadStream::kOriginCurrent);
break;
}
}
}
示例4: getToken
UString StreamTokenizer::getToken(SeekableReadStream &stream) {
// Init
bool chunkEnd = false;
bool inQuote = false;
uint32 separator = 0xFFFFFFFF;
UString token;
// Run through the stream, character by character
uint32 c;
while ((c = stream.readChar()) != ReadStream::kEOF) {
if (isIn(c, _chunkEnds)) {
// This is a end character, seek back and break
stream.seek(-1, SeekableReadStream::kOriginCurrent);
chunkEnd = true;
break;
}
if (isIn(c, _quotes)) {
// This is a quote character, set state
inQuote = !inQuote;
continue;
}
if (!inQuote && isIn(c, _separators)) {
// We're not in a quote and this is a separator
if (!token.empty()) {
// We have a token
separator = c;
break;
}
// We don't yet have a token, let the consecutive separator rule decide what to do
if (_conSepRule == kRuleHeed) {
// We heed every separator
separator = c;
break;
}
if ((_conSepRule == kRuleIgnoreSame) && (separator != 0xFFFFFFFF) && (separator != c)) {
// We ignore only consecutive separators that are the same
separator = c;
break;
}
// We ignore all consecutive separators
separator = c;
continue;
}
if (isIn(c, _ignores))
// This is a character to be ignored, do so
continue;
// A normal character, add it to our token
token += c;
}
// Is the string actually empty?
if (!token.empty() && (*token.begin() == '\0'))
token.clear();
if (!chunkEnd && (_conSepRule != kRuleHeed)) {
// We have to look for consecutive separators
while ((c = stream.readChar()) != ReadStream::kEOF) {
// Use the rule to determine when we should abort skipping consecutive separators
if (((_conSepRule == kRuleIgnoreSame) && (c != separator)) ||
((_conSepRule == kRuleIgnoreAll ) && !isIn(c, _separators))) {
stream.seek(-1, SeekableReadStream::kOriginCurrent);
break;
}
}
}
// And return the token
return token;
}