Treats a string of characters as a stream. This allows it to be read one character at a time. Attempting to read after the end of the stream will generate a Dom.StringReader.NULL character.
Public Member Functions | |
| StringReader (byte[] str) | |
| Creates a new reader for the raw single-byte encoded string. Useful if you're talking to e.g. a webserver with a binary protocol. More... | |
| StringReader (string str) | |
| Creates a new reader for the given string. More... | |
| bool | More () |
| Checks if there is anything left to read. More... | |
| bool | Peek (string str) |
| Checks if the given string is next. More... | |
| bool | PeekLower (string str) |
| Checks if the given string is next; it checks by lowercasing the target character. More... | |
| char | Peek () |
| Takes a peek at the next character in the stream without reading it. More... | |
| char | Peek (int delta) |
| Takes a peek at the character that is a number of characters away from the next one without actually reading it. Peek(0) is the next character, Peek(1) is the one after that etc. More... | |
| void | StepBack () |
| Steps back one place in the stream. More... | |
| void | Advance () |
| Steps forward one place in the stream. More... | |
| void | Advance (int places) |
| Steps forward the given number of places in the stream. More... | |
| int | Length () |
| The length of the string. More... | |
| string | ReadString (int length) |
| Reads a substring of the given length. Note that this does not do bounds checking. More... | |
| virtual char | Read () |
| Reads a character from the stream and advances the stream one place. More... | |
| void | ReadUntil (char character) |
| Keeps reading the given character from the stream until it's no longer next. Used for e.g. stripping an unknown length block of whitespaces in the stream. More... | |
| void | ReadOff (char[] chars) |
| Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines ( or ) from this stream. More... | |
| void | ReadOff (char[] chars, out int count) |
| Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines ( or ) from this stream. More... | |
| int | NextIndexOf (char character) |
| Gets the next index of the given character. The length is returned if it wasn't found at all. More... | |
| int | NextIndexOf (char character, int limit) |
| Gets the next index of the given character, up to limit. Limit is returned if it wasn't found at all. More... | |
| virtual int | GetLineNumber () |
| Gets the line number that the pointer is currently at. More... | |
| int | GetLineNumber (out int charOnLine) |
| Gets the line number and character number that the pointer is currently at. More... | |
| string | ReadLine (int lineNumber) |
| Reads the numbered line from this stream. More... | |
Static Public Member Functions | |
| static int | NextIndexOf (int position, string input, char character, int limit) |
| Gets the next index of the given character, up to limit. Limit is returned if it wasn't found at all. More... | |
| static int | NextIndexOf (int position, string input, char character) |
| Gets the next index of the given character. The length is returned if it wasn't found at all. More... | |
Public Attributes | |
| string | Input |
| The original string. More... | |
| int | Position |
| The current position this reader is at in the string. More... | |
| int | InputLength |
| The length of the input string. More... | |
Static Public Attributes | |
| static char | NULL ='\0' |
| The null character. This is returned when operations are working beyond the end of the stream. More... | |
|
inline |
Creates a new reader for the raw single-byte encoded string. Useful if you're talking to e.g. a webserver with a binary protocol.
| str | The set of characters that is encoded as one byte per character. |
|
inline |
Creates a new reader for the given string.
| str | The string to treat as a stream of characters. |
|
inline |
Steps forward one place in the stream.
|
inline |
Steps forward the given number of places in the stream.
|
inlinevirtual |
Gets the line number that the pointer is currently at.
|
inline |
Gets the line number and character number that the pointer is currently at.
| charOnLine | The column/ character number the reader is at on this line. |
|
inline |
The length of the string.
|
inline |
Checks if there is anything left to read.
|
inline |
Gets the next index of the given character. The length is returned if it wasn't found at all.
|
inline |
Gets the next index of the given character, up to limit. Limit is returned if it wasn't found at all.
|
inlinestatic |
Gets the next index of the given character, up to limit. Limit is returned if it wasn't found at all.
|
inlinestatic |
Gets the next index of the given character. The length is returned if it wasn't found at all.
|
inline |
Checks if the given string is next.
|
inline |
Takes a peek at the next character in the stream without reading it.
|
inline |
Takes a peek at the character that is a number of characters away from the next one without actually reading it. Peek(0) is the next character, Peek(1) is the one after that etc.
|
inline |
Checks if the given string is next; it checks by lowercasing the target character.
|
inlinevirtual |
Reads a character from the stream and advances the stream one place.
Reimplemented in Nitro.CodeLexer.
|
inline |
Reads the numbered line from this stream.
| lineNumber | The number of the line to read. |
|
inline |
Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream.
| chars | The set of characters to read off. |
|
inline |
Keeps reading from the stream until no characters in the given set are next. Used for e.g. stripping an unknown number of newlines (
or ) from this stream.
| chars | The set of characters to read off. |
| count | The number of characters that were read from the stream. |
|
inline |
Reads a substring of the given length. Note that this does not do bounds checking.
|
inline |
Keeps reading the given character from the stream until it's no longer next. Used for e.g. stripping an unknown length block of whitespaces in the stream.
| character | The character to read off from this stream. |
|
inline |
Steps back one place in the stream.
| string Dom.StringReader.Input |
The original string.
| int Dom.StringReader.InputLength |
The length of the input string.
|
static |
The null character. This is returned when operations are working beyond the end of the stream.
| int Dom.StringReader.Position |
The current position this reader is at in the string.