ITextBufferReader Interface
Provides the base requirements for an object that reads characters from a fixed text buffer.
public interface ITextBufferReader
Properties
HasStackEntries
Gets whether there are entries on the stack.
bool HasStackEntries { get; }
Property Value
- Boolean:
true
if there are entries on the stack; otherwise,false
.
IsAtEnd
Gets whether the current Offset is at the end of the text buffer.
bool IsAtEnd { get; }
Property Value
IsAtStart
Gets whether the current Offset is at the start of the text buffer.
bool IsAtStart { get; }
Property Value
IsWhitespaceOnlyAfterOnLine
Gets whether only whitespace characters appear at and after the Offset on the current line.
bool IsWhitespaceOnlyAfterOnLine { get; }
Property Value
IsWhitespaceOnlyBeforeOnLine
Gets whether only whitespace characters appear before the Offset on the current line.
bool IsWhitespaceOnlyBeforeOnLine { get; }
Property Value
Length
Gets the number of characters in the text buffer.
Offset
Gets or sets the current reader offset in the text buffer.
int Offset { get; set; }
Property Value
- Int32:
The current reader offset in the text buffer.
Remarks
For performance reasons there is no bounds check on the setter.
OffsetDelta
Gets the amount by which to alter the offset values that are parsed.
int OffsetDelta { get; }
Property Value
- Int32:
The amount by which to alter the offset values that are parsed.
Position
Gets the current reader TextPosition in the text buffer.
TextPosition Position { get; }
Property Value
- TextPosition:
The current reader TextPosition in the text buffer.
PositionDelta
Gets the amount by which to alter the Position values that are parsed.
TextPosition PositionDelta { get; }
Property Value
- TextPosition:
The amount by which to alter the Position values that are parsed.
Remarks
The Character
portion only affects character offset of the line after the Line
count.
Methods
AsTextReader()
Returns a TextReader wrapper for this reader.
GetSubstring(Int32, Int32)
Returns a substring from the text buffer using Newline for line ends.
string GetSubstring(int offset, int length)
Parameter | Type | Description |
---|---|---|
offset | Int32 | The offset at which to retrieve the text. |
length | Int32 | The number of characters to return. |
Returns
Peek()
Peeks at a single character from the text buffer without seeking past it.
Peek(Int32)
Peeks at a certain character from the text buffer after the current Offset without seeking past it.
char Peek(int count)
Parameter | Type | Description |
---|---|---|
count | Int32 | The number of characters away from the current Offset at which to peek. |
Returns
- Char:
The character that was read.
PeekReverse()
Reverse peeks at a single character from the text buffer without seeking past it.
Pop()
Pops the top offset from the stack and moves the Offset to that offset.
PopAll()
Pops the all offsets from the stack and moves the Offset to the offset that was on the bottom of the stack.
Push()
Pushes the Offset onto the stack for later restoration.
void Push()
Read()
Reads a single character from the text buffer and seeks forward one offset.
ReadReverse()
Reverse reads a single character from the text buffer and seeks backward one offset.
ReadReverseThrough(Char)
Reverse reads characters from the text buffer until the specified character is read through.
bool ReadReverseThrough(char ch)
Parameter | Type | Description |
---|---|---|
ch | Char | The desired character. |
Returns
- Boolean:
true
if the desired character was read; otherwise,false
if the start of the text buffer was reached.
ReadReverseThrough(Char, Int32)
Reverse reads characters from the text buffer until the specified character is read through, or the specified offset is reached.
bool ReadReverseThrough(char ch, int minOffset)
Parameter | Type | Description |
---|---|---|
ch | Char | The desired character. |
minOffset | Int32 | The minimum offset to check. |
Returns
- Boolean:
true
if the desired character was read; otherwise,false
if the specified offset was reached.
ReadThrough(Char)
Reads characters from the text buffer until the specified character is read through.
bool ReadThrough(char ch)
Parameter | Type | Description |
---|---|---|
ch | Char | The desired character. |
Returns
- Boolean:
true
if the desired character was read; otherwise,false
if the end of the text buffer was reached.
ReadThrough(Char, Int32)
Reads characters from the text buffer until the specified character is read through, or the specified offset is reached.
bool ReadThrough(char ch, int maxOffset)
Parameter | Type | Description |
---|---|---|
ch | Char | The desired character. |
maxOffset | Int32 | The maximum offset to check. |
Returns
- Boolean:
true
if the desired character was read; otherwise,false
if the specified offset was reached.