PrettyPrintable

interface PrettyPrintable

An object that has a pretty text representation.

Functions

toDocument
Link copied to clipboard
abstract fun toDocument(): Document

Returns the pretty text representation of this object.

Inheritors

Document
Link copied to clipboard
Name
Link copied to clipboard
Type
Link copied to clipboard
Value
Link copied to clipboard

Extensions

commented
Link copied to clipboard
fun PrettyPrintable.commented(): Document

Like joined but using commas as separators and enclosed in /* and */.

div
Link copied to clipboard
operator fun PrettyPrintable.div(other: PrettyPrintable): Document

Concatenates this and other with a line break in between.

operator fun PrettyPrintable.div(other: String): Document

Convenience method. See plus.

grouped
Link copied to clipboard
fun PrettyPrintable.grouped(): Document

Tries laying out this document into a single line by removing the contained Document.lineBreaks (and replacing them with spaces); if this does not fit the page, the document is laid out without any changes. This function is the key to layouts that adapt to available space nicely.

nested
Link copied to clipboard
fun PrettyPrintable.nested(indentationChange: Int = 4): Document

Returns a new document that is this with the nesting level (indentation after newlines) increased by indentationChange. Negative values for indentationChange are allowed, and decrease the nesting level accordingly.

plus
Link copied to clipboard
operator fun PrettyPrintable.plus(other: PrettyPrintable): Document

Concatenates this and other.

operator fun PrettyPrintable.plus(other: String): Document

Convenience method that automatically converts other to a Document.

styled
Link copied to clipboard
fun PrettyPrintable.styled(style: Style): Document

Returns a new document that is this with style applied.

times
Link copied to clipboard
operator fun PrettyPrintable.times(other: PrettyPrintable): Document

Concatenates this and other with a space in between.

operator fun PrettyPrintable.times(other: String): Document

Convenience method. See plus.