Gutenberg

Class AllmanBracketer<T>

An IBracketer<T> which uses the Allman style.

Inheritance
Implements
Inherited Members
Declaration
public class AllmanBracketer<T> : IBracketer<T>
Type Parameters
Name Description

T

The type of annotations in the document.

Remarks

"The Allman style" is the name for the bracketing style which is customary in C#. The opening bracket is placed on a new line, the contained document is indented, and the closing bracket is placed on a new line.

Examples
var bracketer = new AllmanBracketer<object>("{", "}", false);
var doc = "header" + bracketer.Bracket(
    new Doc[] { "line 1", "line 2" }
        .Separated(Doc.LineBreak)
);
Console.WriteLine(doc);
// Output:
// header
// {
//     line 1
//     line 2
// }

Constructors

AllmanBracketer(Document<T>, Document<T>, bool, int?)

Creates an IBracketer<T> which uses the Allman style.

Declaration
public AllmanBracketer(Document<T> openingBracket, Document<T> closingBracket, bool group = true, int? nestingLevel = null)
Parameters
Type Name Description

Document<T>

openingBracket

A Document<T> representing the opening bracket character.

Document<T>

closingBracket

A Document<T> representing the closing bracket character.

bool

group

Whether the resulting Document<T> should be grouped — that is, whether the document may be flattened to a single line if it fits.

int?

nestingLevel

The amount of indentation to apply to the bracketed document.

Remarks

"The Allman style" is the name for the bracketing style which is customary in C#. The opening bracket is placed on a new line, the contained document is indented, and the closing bracket is placed on a new line.

Methods

Bracket(Document<T>)

Surrounds the document with brackets.

Declaration
public Document<T> Bracket(Document<T> document)
Parameters
Type Name Description

Document<T>

document

The document.

Returns
Type Description

Document<T>

The document surrounded with brackets.

Remarks

"The Allman style" is the name for the bracketing style which is customary in C#. The opening bracket is placed on a new line, the contained document is indented, and the closing bracket is placed on a new line.

Implements

IBracketer<T>