In This Article

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

bool:

true if there are entries on the stack; otherwise, false.

See Also

IsAtEnd

Gets whether the current Offset is at the end of the text buffer.

bool IsAtEnd { get; }

Property Value

bool:

true if the current Offset is at the end of the text buffer; otherwise, false.

See Also

IsAtStart

Gets whether the current Offset is at the start of the text buffer.

bool IsAtStart { get; }

Property Value

bool:

true if the current Offset is at the start of the text buffer; otherwise, false.

See Also

IsWhitespaceOnlyAfterOnLine

Gets whether only whitespace characters appear at and after the Offset on the current line.

bool IsWhitespaceOnlyAfterOnLine { get; }

Property Value

bool:

true if only whitespace characters appear at and after the Offset on the current line; otherwise, false.

See Also

IsWhitespaceOnlyBeforeOnLine

Gets whether only whitespace characters appear before the Offset on the current line.

bool IsWhitespaceOnlyBeforeOnLine { get; }

Property Value

bool:

true if only whitespace characters appear before the Offset on the current line; otherwise, false.

See Also

Length

Gets the number of characters in the text buffer.

int Length { get; }

Property Value

int:

The number of characters in the text buffer.

See Also

Offset

Gets or sets the current reader offset in the text buffer.

int Offset { get; set; }

Property Value

int:

The current reader offset in the text buffer.

Remarks

For performance reasons there is no bounds check on the setter.

See Also

OffsetDelta

Gets the amount by which to alter the offset values that are parsed.

int OffsetDelta { get; }

Property Value

int:

The amount by which to alter the offset values that are parsed.

See Also

Position

Gets the current reader TextPosition in the text buffer.

TextPosition Position { get; }

Property Value

TextPosition:

The current reader TextPosition in the text buffer.

See Also

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.

See Also

Methods

AsTextReader()

Returns a TextReader wrapper for this reader.

TextReader AsTextReader()

Returns

TextReader:

A TextReader wrapper for this reader.

See Also

GetSubstring(int, int)

Returns a substring from the text buffer using Newline for line ends.

string GetSubstring(int offset, int length)
Parameter Type Description
offset int

The offset at which to retrieve the text.

length int

The number of characters to return.

Returns

string:

The substring from the text buffer using Newline for line ends.

See Also

Peek()

Peeks at a single character from the text buffer without seeking past it.

char Peek()

Returns

char:

The character that was read.

See Also

Peek(int)

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 int

The number of characters away from the current Offset at which to peek.

Returns

char:

The character that was read.

See Also

PeekReverse()

Reverse peeks at a single character from the text buffer without seeking past it.

char PeekReverse()

Returns

char:

The character that was read.

See Also

Pop()

Pops the top offset from the stack and moves the Offset to that offset.

bool Pop()

Returns

bool:

true if a pop occurred; otherwise, false.

See Also

PopAll()

Pops the all offsets from the stack and moves the Offset to the offset that was on the bottom of the stack.

bool PopAll()

Returns

bool:

true if a pop occurred; otherwise, false.

See Also

Push()

Pushes the Offset onto the stack for later restoration.

void Push()

See Also

Read()

Reads a single character from the text buffer and seeks forward one offset.

char Read()

Returns

char:

The character that was read.

See Also

ReadReverse()

Reverse reads a single character from the text buffer and seeks backward one offset.

char ReadReverse()

Returns

char:

The character that was read.

See Also

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

bool:

true if the desired character was read; otherwise, false if the start of the text buffer was reached.

See Also

ReadReverseThrough(char, int)

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 int

The minimum offset to check.

Returns

bool:

true if the desired character was read; otherwise, false if the specified offset was reached.

See Also

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

bool:

true if the desired character was read; otherwise, false if the end of the text buffer was reached.

See Also

ReadThrough(char, int)

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 int

The maximum offset to check.

Returns

bool:

true if the desired character was read; otherwise, false if the specified offset was reached.

See Also

See Also