Enhanced C#
Language of your choice: library documentation
Public Member Functions | List of all members
Loyc.Syntax.ILiteralPrinter Interface Reference

This interface for converting literals to text is implemented by LiteralHandlerTable. More...


Source file:
Inheritance diagram for Loyc.Syntax.ILiteralPrinter:
Loyc.Syntax.LiteralHandlerTable Loyc.Syntax.StandardLiteralHandlers

Remarks

This interface for converting literals to text is implemented by LiteralHandlerTable.

Public Member Functions

bool CanPrint (Symbol typeMarker)
 Finds out whether there is a printer for the given type marker. Never throws. More...
 
bool CanPrint (Type type)
 Returns true if there is a printer registered for the given type. Never throws. More...
 
Either< Symbol, ILogMessageTryPrint (ILNode literal, StringBuilder sb)
 Attempts to convert the specified literal to a string. More...
 

Member Function Documentation

◆ CanPrint() [1/2]

bool Loyc.Syntax.ILiteralPrinter.CanPrint ( Symbol  typeMarker)

Finds out whether there is a printer for the given type marker. Never throws.

Returns
True if typeMarker is not null and there is a printer for that marker.

Implemented in Loyc.Syntax.LiteralHandlerTable.

◆ CanPrint() [2/2]

bool Loyc.Syntax.ILiteralPrinter.CanPrint ( Type  type)

Returns true if there is a printer registered for the given type. Never throws.

Returns
True if type is not null and if there is a printer for that type.

◆ TryPrint()

Either<Symbol, ILogMessage> Loyc.Syntax.ILiteralPrinter.TryPrint ( ILNode  literal,
StringBuilder  sb 
)

Attempts to convert the specified literal to a string.

Parameters
literalA literal that you want to convert to a string.
Returns
Either a recommended type marker for the literal, or an error message. The string form of the literal is appended to the StringBuilder provided by the caller. If an error occurs, it is possible that some kind of output was added to the StringBuilder anyway.

The string is printed without escaping. For example a newline would be printed as character (char)10, not "\n".

Implemented in Loyc.Syntax.LiteralHandlerTable.