C# Class Mlos.SettingsSystem.CodeGen.CodeWriters.CodeWriter

Base class for all code writers.
Show file Open project: microsoft/MLOS

Private Properties

Property Type Description

Public Methods

Method Description
Accept ( Type sourceType ) : bool

Does code writer support source type.

BeginVisitType ( Type sourceType ) : void

Write class beginning.

EndVisitType ( Type sourceType ) : void

Write class closing brackets.

GetGeneratedString ( ) : string

Return a generated code as a string.

VisitConstField ( CppConstField cppConstField ) : void

Write a struct const field definition.

VisitField ( CppField cppField ) : void

Write a struct field definition.

WriteBeginFile ( ) : void

Write beginning of the file.

WriteCloseTypeNamespace ( string @namespace ) : void

Write namespace closing after type definition.

WriteComments ( CodeComment codeComment ) : void

Write code comments.

WriteEndFile ( ) : void

Write end of the file.

WriteOpenTypeNamespace ( string @namespace ) : void

Write namespace opening before type definition.

Protected Methods

Method Description
WriteBlock ( ) : void

Writes an indented block of lines.

Expected to be used with block string literals like so: As such the first empty line is trimmed.

WriteLine ( ) : void

Writes a blank line.

WriteLine ( string value ) : void

Writes an indented line with the given string.

Method Details

Accept() public abstract method

Does code writer support source type.
public abstract Accept ( Type sourceType ) : bool
sourceType Type
return bool

BeginVisitType() public abstract method

Write class beginning.
public abstract BeginVisitType ( Type sourceType ) : void
sourceType Type
return void

EndVisitType() public abstract method

Write class closing brackets.
public abstract EndVisitType ( Type sourceType ) : void
sourceType Type
return void

GetGeneratedString() public method

Return a generated code as a string.
public GetGeneratedString ( ) : string
return string

VisitConstField() public abstract method

Write a struct const field definition.
public abstract VisitConstField ( CppConstField cppConstField ) : void
cppConstField CppConstField
return void

VisitField() public abstract method

Write a struct field definition.
public abstract VisitField ( CppField cppField ) : void
cppField CppField
return void

WriteBeginFile() public abstract method

Write beginning of the file.
public abstract WriteBeginFile ( ) : void
return void

WriteBlock() protected method

Writes an indented block of lines.
Expected to be used with block string literals like so: As such the first empty line is trimmed.
protected WriteBlock ( ) : void
return void

WriteCloseTypeNamespace() public abstract method

Write namespace closing after type definition.
public abstract WriteCloseTypeNamespace ( string @namespace ) : void
@namespace string
return void

WriteComments() public abstract method

Write code comments.
public abstract WriteComments ( CodeComment codeComment ) : void
codeComment CodeComment
return void

WriteEndFile() public abstract method

Write end of the file.
public abstract WriteEndFile ( ) : void
return void

WriteLine() protected method

Writes a blank line.
protected WriteLine ( ) : void
return void

WriteLine() protected method

Writes an indented line with the given string.
protected WriteLine ( string value ) : void
value string
return void

WriteOpenTypeNamespace() public abstract method

Write namespace opening before type definition.
public abstract WriteOpenTypeNamespace ( string @namespace ) : void
@namespace string
return void