FunctionalPrinter

nscn.polaris2.protoc.codegen.FunctionalPrinter
See theFunctionalPrinter companion object
final case class FunctionalPrinter(content: Vector[String] = ..., indentLevel: Int = ...)

An immutable, indentation-aware accumulator of source lines.

Ported from ScalaPB's printer of the same name. Generated code is built by threading one of these through the generators, which keeps indentation out of every string literal and makes a generator a plain FunctionalPrinter => FunctionalPrinter.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def add(lines: String*): FunctionalPrinter

Adds lines at the current indent level.

Adds lines at the current indent level.

Embedded newlines are split, so a multi-line string literal indents as a block rather than leaving its continuation lines at column zero.

Attributes

def addGroupsWithDelimiter(delimiter: String)(groups: Seq[Seq[String]]): FunctionalPrinter

As addWithDelimiter, but the delimiter goes after each group's last line.

As addWithDelimiter, but the delimiter goes after each group's last line.

Attributes

def addIndented(lines: String*): FunctionalPrinter
def addWithDelimiter(delimiter: String)(lines: Seq[String]): FunctionalPrinter

Adds lines with delimiter after every line but the last: for argument lists.

Adds lines with delimiter after every line but the last: for argument lists.

Attributes

def indent(n: Int): FunctionalPrinter
def outdent(n: Int): FunctionalPrinter
def result(): String
def seq(lines: Seq[String]): FunctionalPrinter
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def when(cond: => Boolean)(f: Endo): FunctionalPrinter
def whenNot(cond: => Boolean)(f: Endo): FunctionalPrinter

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product