Class BaseCodeGenVisitor
- Namespace
- Ecng.ComponentModel
- Assembly
- Ecng.ComponentModel.dll
Base class for code generation visitors. Provides common implementations for indentation management and writing code lines/text.
public abstract class BaseCodeGenVisitor : ICodeGenVisitor
- Inheritance
-
BaseCodeGenVisitor
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseCodeGenVisitor()
Initializes a new instance of the BaseCodeGenVisitor class.
protected BaseCodeGenVisitor()
Methods
ChangeIndent(bool)
Changes the current indentation level.
public ICodeGenVisitor ChangeIndent(bool increase)
Parameters
increase
boolIf
true
, increases the indentation by adding a tab character; iffalse
, decreases the indentation.
Returns
- ICodeGenVisitor
The current instance of ICodeGenVisitor.
Exceptions
- InvalidOperationException
Thrown when attempting to decrease indentation below zero (mismatched closing brace).
Write(string)
Writes text without a newline.
protected abstract void Write(string text)
Parameters
text
stringThe text to write.
WriteLine(string)
Writes a line of text.
protected abstract void WriteLine(string text)
Parameters
text
stringThe text to write.