Represents an IText
- Inheritance:
- object object
- Implements:
-
IText
Buffer Reader
Constructors
StringTextBufferReader(string)
Initializes a new instance of the StringTextBufferReader
class.
Parameter | Type | Description |
---|---|---|
text | string | The text to store in the text buffer. |
StringTextBufferReader(string, TextPosition, int)
Initializes a new instance of the StringTextBufferReader
class.
Parameter | Type | Description |
---|---|---|
text | string | The text to store in the text buffer. |
position | Text |
The initial Text |
offset | int | The initial offset of the reader. |
Properties
HasStackEntries
Gets whether there are entries on the stack.
Property Value
- bool:
true
if there are entries on the stack; otherwise,false
.
IsAtEnd
Gets whether the current Offset is at the end of the text buffer.
IsAtStart
Gets whether the current Offset is at the start of the text buffer.
Property Value
IsWhitespaceOnlyAfterOnLine
Gets whether only whitespace characters appear at and after the Offset on the current line.
Property Value
IsWhitespaceOnlyBeforeOnLine
Gets whether only whitespace characters appear before the Offset on the current line.
Property Value
Length
Gets the number of characters in the text buffer.
Property Value
- int:
The number of characters in the text buffer.
Offset
Gets or sets the current reader offset in the text buffer.
Property Value
- int:
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.
Property Value
- int:
The amount by which to alter the offset values that are parsed.
Position
Gets the current reader Text
Property Value
- Text
Position : The current reader Text
Position in the text buffer.
PositionDelta
Gets the amount by which to alter the Position values that are parsed.
Property Value
- Text
Position : 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 Text
Returns
- Text
Reader : A Text
Reader wrapper for this reader.
GetSubstring(int, int)
Returns a substring from the text buffer using Newline for line ends.
Parameter | Type | Description |
---|---|---|
startOffset | int | The offset at which to retrieve the text. |
substringLength | int | The number of characters to return. |
Returns
Peek()
Peeks at a single character from the text buffer without seeking past it.
Returns
- char:
The character that was read.
Peek(int)
Peeks at a certain character from the text buffer after the current Offset without seeking past it.
Parameter | Type | Description |
---|---|---|
count | int | 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.
Returns
- char:
The character that was read.
Pop()
Pops the top offset from the stack and moves the Offset to that offset.
Returns
- bool:
true
if a pop occurred; otherwise,false
.
PopAll()
Pops the all offsets from the stack and moves the Offset to the offset that was on the bottom of the stack.
Returns
- bool:
true
if a pop occurred; otherwise,false
.
Push()
Pushes the Offset onto the stack for later restoration.
Read()
Reads a single character from the text buffer and seeks forward one offset.
Returns
- char:
The character that was read.
ReadReverse()
Reverse reads a single character from the text buffer and seeks backward one offset.
Returns
- char:
The character that was read.
ReadReverseThrough(char)
Reverse reads characters from the text buffer until the specified character is read through.
Parameter | Type | Description |
---|---|---|
ch | char | The desired character. |
Returns
- bool:
true
if the desired character was read; otherwise,false
if the start of the text buffer was reached.
ReadReverseThrough(char, int)
Reverse reads characters from the text buffer until the specified character is read through, or the specified offset is reached.
Parameter | Type | Description |
---|---|---|
ch | char | The desired character. |
minOffset | int | The minimum offset to check. |
Returns
- bool:
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.
Parameter | Type | Description |
---|---|---|
ch | char | The desired character. |
Returns
- bool:
true
if the desired character was read; otherwise,false
if the end of the text buffer was reached.
ReadThrough(char, int)
Reads characters from the text buffer until the specified character is read through, or the specified offset is reached.
Parameter | Type | Description |
---|---|---|
ch | char | The desired character. |
maxOffset | int | The maximum offset to check. |
Returns
- bool:
true
if the desired character was read; otherwise,false
if the specified offset was reached.
ToString()
Creates and returns a string representation of the current object.
Returns
- string:
A string representation of the current object.