An optimized version of Reader.peek() with index == 0.
This commit is contained in:
parent
063d9754d7
commit
a4befdd866
|
@ -137,7 +137,7 @@ final class Reader
|
||||||
///
|
///
|
||||||
// XXX removed; search for 'risky' to find why.
|
// XXX removed; search for 'risky' to find why.
|
||||||
// Throws: ReaderException if trying to read past the end of the buffer.
|
// Throws: ReaderException if trying to read past the end of the buffer.
|
||||||
dchar peek(size_t index = 0) @safe pure nothrow @nogc
|
dchar peek(const size_t index) @safe pure nothrow @nogc
|
||||||
{
|
{
|
||||||
if(characterCount_ <= charIndex_ + index)
|
if(characterCount_ <= charIndex_ + index)
|
||||||
{
|
{
|
||||||
|
@ -176,6 +176,16 @@ final class Reader
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Optimized version of peek() for the case where peek index is 0.
|
||||||
|
dchar peek() @safe pure nothrow @nogc
|
||||||
|
{
|
||||||
|
if(characterCount_ <= charIndex_) { return '\0'; }
|
||||||
|
|
||||||
|
lastDecodedCharOffset_ = 0;
|
||||||
|
lastDecodedBufferOffset_ = bufferOffset_;
|
||||||
|
return decodeNext();
|
||||||
|
}
|
||||||
|
|
||||||
/// Get specified number of characters starting at current position.
|
/// Get specified number of characters starting at current position.
|
||||||
///
|
///
|
||||||
/// Note: This gets only a "view" into the internal buffer,
|
/// Note: This gets only a "view" into the internal buffer,
|
||||||
|
|
Loading…
Reference in a new issue