SourceCodeWriter
Description
- Derived from
-
Disposable abstract
IFlushable
ICharacterEscape
A text writer with additional functionality related to emitting common source code structures, such as pairs of braces and indented blocks.
Public / Methods
Angle
Begins a nested pair of angle brackets: < >
- IOException
-
If an I/O error has occurred.
- See also
AutoBreakPush
2 overloads
Saves the current auto-break settings onto an internal stack.
- See also
Saves the current auto-break settings onto an internal stack and updates the settings.
- See also
Brackets
Begins a nested pair of square brackets: [ ]
- IOException
-
If an I/O error has occurred.
- See also
Close
Closes the current nested tag by writing the end tag that has been specified by the corresponding call to Open2.
- IOException
-
If an I/O error has occurred.
IndentLeft
Decreases the indentation level.
The new indentation level will be taken into account immediately for fresh lines or after the next line break has been emitted.
IndentRight
Increases the indentation level.
The new indentation level will be taken into account immediately for fresh lines or after the next line break has been emitted.
LinePrefix
Specifies the line prefix to use for subsequent text.
- IOException
-
If an I/O error has occurred.
Newline
2 overloads
Appends a line break and begins a fresh line.
- IOException
-
If an I/O error has occurred.
Writes the given token, followed by a line break.
- IOException
-
If an I/O error has occurred.
NewlineIfNotFresh
Ensures that the current write cursor is located at the beginning of a fresh source code line.
This method emits a line break when characters have been written to the current code line.
- IOException
-
If an I/O error has occurred.
Open
2 overloads
Begins a nested tag by writing the opening tag now and the end tag when the corresponding call to Close is made.
- IOException
-
If an I/O error has occurred.
Begins a nested tag by writing the opening tag now and the end tag when the corresponding call to Close is made.
- IOException
-
If an I/O error has occurred.
- See also
Text
Writes the given text.
The text will be split at the whitespaces and the resulting tokens will be emitted in order.
- IOException
-
If an I/O error has occurred.
Token
2 overloads
Writes a token on the current source code line.
A token is considered to be atomic, i.e. it will never be split because of automatic line breaks.
- IOException
-
If an I/O error has occurred.
Writes a token on the current source code line.
A token is considered to be atomic, i.e. it will never be split because of automatic line breaks.
- IOException
-
If an I/O error has occurred.
Public / Attributes
AutoBreakColumns
The maximum number of columns (inclusive indentation) to write per source code line before emitting an automatic line break.
Escape
Specifies an optional application-level escaping predicate.
The SourceCodeWriter class itself does not perform any escaping. Instead, it provides the final escape predicate via its implementation of ICharacterEscape.EscapeCharacter, which is based on the escape rule of the underlying ITextStream and this rule. Defaults to null
.