Instance Methodswift-protobuf 1.28.1SwiftProtobufPluginLibrary
withIndentation(body:)
Indents, calls body
to do other work relaying along the printer, and the outdents after wards.
mutating func withIndentation(body: (_ p: inout CodePrinter) -> Void)
Parameters
- body
A closure that is invoked after the indent is increasted.
Other members in extension
Type members
init(CodePrinter
) Initialize a new printer using the existing state from another printer.
init(CodePrinter, addNewlines: Bool
) Initialize a new printer using the existing state from another printer but with support to control the behavior of
addNewlines
.init(indent: String.UnicodeScalarView
) init(indent: String.UnicodeScalarView, addNewlines: Bool
) Initialize the printer for use.
Instance members
var content: String
The string content that was printed.
var isEmpty: Bool
See if anything was printed.
func append(CodePrinter, indenting: Bool
) Appended the content of another
CodePrinter
to this one.func indent(
) Increases the printer’s indentation level.
func outdent(
) Decreases the printer’s indentation level.
func print(String...
) Writes the given strings to the printer, adding a newline after each string.
func print(String..., newlines: Bool
) Writes the given strings to the printer, optionally adding a newline after each string. If called with no strings, a blank line is added to the printer.
func printIndented(String...
) Indents, writes the given strings to the printer, and then outdents.