TextRendererBase<T> Class

public abstract class TextRendererBase<T> : TextRendererBase where T : TextRendererBase<T>

Type parameters

T
Type of the renderer

See also

Inheritance
TextRendererBase TextRendererBase<T>

Constructors

NameDescription
TextRendererBase(TextWriter)Initializes a new instance of the TextRendererBase<T> class.

TextRendererBase(TextWriter)

TextRendererBase.cs

Initializes a new instance of the TextRendererBase<T> class.

protected TextRendererBase(TextWriter writer)

Parameters

writer TextWriter
The writer.

Methods

NameDescription
ClearIndent()Performs the clear indent operation.
EnsureLine()Ensures a newline.
PopIndent()Performs the pop indent operation.
PushHangingIndent(string)Pushes an indent that uses the specified marker on its first line and the same number of spaces on subsequent lines.
PushIndent(string)Performs the push indent operation.
PushIndent(string[])Performs the push indent operation.
Reset()Performs the reset operation.
Write(StringSlice)Writes the specified slice.
Write(StringSlice)Writes the specified slice.
Write(char)Writes the specified character.
Write(ReadOnlySpan<char>)Writes the specified content.
Write(string?)Writes the specified content.
Write(string, int, int)Writes the specified content.
WriteLeafInline(LeafBlock)Writes the inlines of a leaf inline.
WriteLine()Writes a newline.
WriteLine(NewLine)Writes a newline.
WriteLine(char)Writes a content followed by a newline.
WriteLine(string)Writes a content followed by a newline.

ClearIndent()

TextRendererBase.cs

Performs the clear indent operation.

public void ClearIndent()

Ensures a newline.

public T EnsureLine()

Returns

T This instance

Performs the pop indent operation.

public void PopIndent()

PushHangingIndent(string)

TextRendererBase.cs

Pushes an indent that uses the specified marker on its first line and the same number of spaces on subsequent lines.

public void PushHangingIndent(string marker)

Parameters

marker string
The first line of the hanging indent.

Exceptions

ArgumentNullException
marker is null.

Remarks

Call at the beginning of a line, before writing child content. This method marks indents as pending but does not insert a newline; use TextRendererBase<T>.EnsureLine first if necessary. The next write emits all active indents, including this marker. Call TextRendererBase<T>.PopIndent after writing the indented content.

PushIndent overloads

PushIndent(string)

TextRendererBase.cs

Performs the push indent operation.

public void PushIndent(string indent)
Parameters
indent string

PushIndent(string[])

TextRendererBase.cs

Performs the push indent operation.

public void PushIndent(string[] lineSpecific)
Parameters
lineSpecific string[]
The indent to use for each successive line.
Exceptions
ArgumentNullException
lineSpecific is null.

Performs the reset operation.

protected internal void Reset()

Write overloads

Write(StringSlice)

TextRendererBase.cs

Writes the specified slice.

public T Write(StringSlice slice)
Parameters
slice StringSlice
The slice.
Returns

T This instance

Write(StringSlice)

TextRendererBase.cs

Writes the specified slice.

public T Write(ref StringSlice slice)
Parameters
slice StringSlice
The slice.
Returns

T This instance

Writes the specified character.

public T Write(char content)
Parameters
content char
The content.
Returns

T This instance

Write(ReadOnlySpan<char>)

TextRendererBase.cs

Writes the specified content.

public void Write(ReadOnlySpan<char> content)
Parameters
content ReadOnlySpan<char>
The content.

Write(string?)

TextRendererBase.cs

Writes the specified content.

public T Write(string? content)
Parameters
content string?
The content.
Returns

T This instance

Write(string, int, int)

TextRendererBase.cs

Writes the specified content.

public T Write(string content, int offset, int length)
Parameters
content string
The content.
offset int
The offset.
length int
The length.
Returns

T This instance

WriteLeafInline(LeafBlock)

TextRendererBase.cs

Writes the inlines of a leaf inline.

public T WriteLeafInline(LeafBlock leafBlock)

Parameters

leafBlock LeafBlock
The leaf block.

Returns

T This instance

WriteLine overloads

Writes a newline.

public T WriteLine()
Returns

T This instance

WriteLine(NewLine)

TextRendererBase.cs

Writes a newline.

public T WriteLine(NewLine newLine)
Parameters
newLine NewLine
Returns

T This instance

WriteLine(char)

TextRendererBase.cs

Writes a content followed by a newline.

public T WriteLine(char content)
Parameters
content char
The content.
Returns

T This instance

WriteLine(string)

TextRendererBase.cs

Writes a content followed by a newline.

public T WriteLine(string content)
Parameters
content string
The content.
Returns

T This instance

Fields

NameDescription
PreviousWasLineGets or sets the previous was line.

PreviousWasLine

Gets or sets the previous was line.

protected bool PreviousWasLine