SourcePrinter

open class SourcePrinter(source)

A support class for code that outputs formatted source code.

Properties

Link copied to clipboard
open val cursor: Position

Functions

Link copied to clipboard
open fun duplicateIndent()
Adds an indent to the top of the stack that is a copy of the current top indent.
Link copied to clipboard
open fun getSource(): String
Link copied to clipboard
open fun indent(): SourcePrinter
Add the default indentation to the current indentation and push it on the indentation stack.
Link copied to clipboard
Add to the current indentation until it is reaches "column" and push it on the indentation stack.
Link copied to clipboard
Changes all EOL characters in "content" to the EOL character this SourcePrinter is using.
Link copied to clipboard
open fun print(arg: String): SourcePrinter
Append the source string passed as argument to the buffer.
Link copied to clipboard
Append a newline to the buffer.
open fun println(arg: String): SourcePrinter
Append the source string passed as argument to the buffer, then append a newline.
Link copied to clipboard
Set the top-most indent to the column the cursor was before the last reindentWithAlignToCursor call.
Link copied to clipboard
Set the top-most indent to the column the cursor is currently in, can be undone with reindentToPreviousLevel.
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
Pop the last indentation of the indentation stack.