|
Bond 0.9
C++ Bond Runtime Library API Documentation
|
An iterator over the contents of a stream of text. More...
#include <bond/compiler/charstream.h>
Public Member Functions | |
| CharStream (InputStream &stream) | |
| Constructs a CharStream object that iterates from the current position to the end of the given stream. | |
| void | Reset () |
| Resets the position of the stream back to the beginning. | |
| void | Reset (const StreamPos &pos) |
| Resets the position of the stream back to the specified position. | |
| void | Sync () |
| Ensures that the underlying InputStream is seeked to the same position as this stream. | |
| bool | HasNext () const |
| Returns whether any characters remain in the stream, including the appended space. | |
| char | Next () |
| Returns the next character in the stream and advances the stream's position. | |
| const StreamPos & | GetStreamPos () const |
| Returns the stream's current position. | |
An iterator over the contents of a stream of text.
CharStream is used internally by Lexer; it is unlikely that someone integrating Bond into their application will have to make direct use of it.
A single space is appended after the last character of the underlying stream, so that the end of the last token can be identified. The stream position tracks lines and columns as described by StreamPos.
|
inlineexplicit |
Constructs a CharStream object that iterates from the current position to the end of the given stream.
| stream | The underlying stream of characters over which this stream iterates. It is not copied, so it must outlive the CharStream. |
|
inline |
Returns the stream's current position.
| bool Bond::CharStream::HasNext | ( | ) | const |
Returns whether any characters remain in the stream, including the appended space.
| char Bond::CharStream::Next | ( | ) |
Returns the next character in the stream and advances the stream's position.
Returns a space once the end of the underlying stream is reached, without advancing past the appended space.
|
inline |
Resets the position of the stream back to the beginning.
| void Bond::CharStream::Reset | ( | const StreamPos & | pos | ) |
Resets the position of the stream back to the specified position.
| pos | A position previously returned by GetStreamPos(). |
|
inline |
Ensures that the underlying InputStream is seeked to the same position as this stream.