C# Class ServiceClientGenerator.CodeBuilder

Wrapper around string builder to help emit properly indented code
Show file Open project: aws/aws-sdk-net Class Usage Examples

Public Methods

Method Description
Append ( string s ) : CodeBuilder

Append a string at the current location

AppendFormat ( string format ) : CodeBuilder

Append a formatted string at the current location.

AppendLine ( ) : CodeBuilder

Add a newline, and indent to the current indent

AppendLine ( string line ) : CodeBuilder

Append a string at the current location, add a newline and indent to the current indent.

AppendQuote ( string s, string open = @"""", string close = null ) : CodeBuilder

Append a string with quotes around it.

CloseBlock ( ) : CodeBuilder

Add a newline, reduce the indent by the tab width, and add a '}'

CodeBuilder ( StringBuilder sb, int startingIndent, int tabWidth = 4 ) : System

Constructor.

OpenBlock ( ) : CodeBuilder

Increase the indent and open a block, adding a '{' and a newline and indent.

The current position will be on a new line at the newly increased indent.

Method Details

Append() public method

Append a string at the current location
public Append ( string s ) : CodeBuilder
s string a string
return CodeBuilder

AppendFormat() public method

Append a formatted string at the current location.
public AppendFormat ( string format ) : CodeBuilder
format string Format string
return CodeBuilder

AppendLine() public method

Add a newline, and indent to the current indent
public AppendLine ( ) : CodeBuilder
return CodeBuilder

AppendLine() public method

Append a string at the current location, add a newline and indent to the current indent.
public AppendLine ( string line ) : CodeBuilder
line string
return CodeBuilder

AppendQuote() public method

Append a string with quotes around it.
public AppendQuote ( string s, string open = @"""", string close = null ) : CodeBuilder
s string The string
open string The opening quote character. Defaults to double quotes.
close string The closing quote character. Defaults to the open character.
return CodeBuilder

CloseBlock() public method

Add a newline, reduce the indent by the tab width, and add a '}'
public CloseBlock ( ) : CodeBuilder
return CodeBuilder

CodeBuilder() public method

Constructor.
public CodeBuilder ( StringBuilder sb, int startingIndent, int tabWidth = 4 ) : System
sb StringBuilder StringBuilder instance to wrap
startingIndent int Staring indent width (in spaces)
tabWidth int Additional indent width (in spaces)
return System

OpenBlock() public method

Increase the indent and open a block, adding a '{' and a newline and indent.
The current position will be on a new line at the newly increased indent.
public OpenBlock ( ) : CodeBuilder
return CodeBuilder