Class TextGenerator
A formatted text generator useful for creating text based files with some semblance of organization.
Inheritance
Namespace: GDX.Developer
Syntax
public class TextGenerator
Constructors
| Improve this Doc View SourceTextGenerator(String, String, String)
Create a new TextGenerator with the
Declaration
public TextGenerator(string indentContent = "\t", string indentOpen = null, string indentClose = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | indentContent | The characters used to indent the content when applicable. By default it will use a tab representation, however for code files you may want to use four spaces. |
System.String | indentOpen | |
System.String | indentClose |
Methods
| Improve this Doc View SourceAppend(String)
Append content to the current line being operated on.
Declaration
public void Append(string content)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content to append to the current line. |
AppendLine(String)
Apply the appropriate amount of indentation to the current line, appending content afterwards and then advancing to the next line.
Declaration
public void AppendLine(string content = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The content to append to the current line. |
AppendLineRange(IEnumerable)
Append an System.Collections.IEnumerable set of content as individual lines with proper indentation.
Declaration
public void AppendLineRange(IEnumerable content)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | content | The content to be added. |
ApplyIndent()
Apply the current level of indent to the current line being operated on.
Declaration
public void ApplyIndent()
GetIndentLevel()
Gets the current indent level of the TextGenerator.
Declaration
public int GetIndentLevel()
Returns
Type | Description |
---|---|
System.Int32 | The indent level. |
NextLine()
Move the builder to the start of the next line.
Declaration
public void NextLine()
PopIndent()
Remove a level of indentation from the builder.
Declaration
public void PopIndent()
PushIndent(Boolean)
Add a level of indentation to the builder.
Declaration
public void PushIndent(bool applyOpener = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | applyOpener | Should the opener be applied? |
ToString()
Returns the built string content for the builder.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Remarks
Will automatically reduce the indentation level to 0.