Class GeneratorCodeAbstract
- Namespace
- SunamoDevCode
- Assembly
- SunamoDevCode.dll
Abstract base class for code generators providing common indentation, braces, and string building functionality.
public abstract class GeneratorCodeAbstract
- Inheritance
-
GeneratorCodeAbstract
- Derived
- Inherited Members
- Extension Methods
Constructors
GeneratorCodeAbstract()
Initializes the code generator with a space-delimited InstantSB and XmlDoc helper.
public GeneratorCodeAbstract()
Fields
Final
Use ToString() instead of public access
protected string Final
Field Value
sb
String builder used for assembling the generated code output.
protected InstantSB sb
Field Value
xmlDoc
XML documentation helper for generating doc comments in code output.
public XmlDoc xmlDoc
Field Value
Methods
AddTab(int)
Appends the specified number of tab characters to the output.
public void AddTab(int tabCount)
Parameters
tabCountintNumber of tabs to add.
AddTab(int, string)
EN: Adds tabs to each line of the text CZ: Přidá tabulátory na začátek každého řádku textu
public static string AddTab(int tabCount, string text)
Parameters
Returns
- string
Text with tabs added
AddTab2(int, string)
Adds indented text as an item to the string builder.
public void AddTab2(int tabCount, string text)
Parameters
Append(int, string, params object[])
EN: Appends formatted text with tabs (without newline) CZ: Přidá formátovaný text s tabulátory (bez nového řádku)
public void Append(int tabCount, string format, params object[] args)
Parameters
tabCountintNumber of tabs for indentation
formatstringFormat string or plain text
argsobject[]Format arguments
AppendLine()
Appends an empty line to the output.
public void AppendLine()
AppendLine(int, string, params object[])
EN: Appends a formatted line with tabs CZ: Přidá formátovaný řádek s tabulátory
public void AppendLine(int tabCount, string format, params object[] args)
Parameters
tabCountintNumber of tabs for indentation
formatstringFormat string or plain text
argsobject[]Format arguments
AssignValue(int, string, string, object, bool)
EN: Assigns a value to a property/field, converting it to string CZ: Přiřadí hodnotu vlastnosti/poli, převádí na string
public void AssignValue(int tabCount, string objectName, string variableName, object value, bool addToHyphens)
Parameters
tabCountintNumber of tabs for indentation
objectNamestringName of the object
variableNamestringName of the variable/property
valueobjectValue to assign
addToHyphensboolWhether to add quotes
EndBrace(int)
EN: Ends a brace and adds a new line. After calling this method for elements like methods, properties, or constructors, it's recommended to also call sb.AppendLine(). CZ: Ukončí složenou závorku a přidá nový řádek. Za voláním této metody pokud ukončuje nějaký celek jako jsou metody, vlastnosti nebo konstruktor je vhodné volat ještě sb.AppendLine().
public void EndBrace(int tabCount)
Parameters
tabCountintNumber of tabs for indentation
EndParenthesis()
Appends a closing parenthesis to the output.
public void EndParenthesis()
StartBrace(int)
EN: Starts a brace. This is the only method here that adds a new line at the beginning. CZ: Přidá nový řádek, složenou závorku. Je to jediná zdejší metoda která na začátku přidává nový řádek.
public void StartBrace(int tabCount)
Parameters
tabCountintNumber of tabs for indentation
StartParenthesis()
Appends an opening parenthesis to the output.
public void StartParenthesis()
ToString()
EN: Returns the generated code and resets the string builder CZ: Vrátí vygenerovaný kód a resetuje string builder
public override string ToString()
Returns
- string
Generated code