Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

SmartFormatter

class in Unity.SmartStrings


Implements interfaces:ISerializationCallbackReceiver

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Constructs formatted strings by invoking each registered source and formatter extension.

Properties

Property Description
Parser The Parser this formatter uses to parse format strings.
Settings The SmartSettings that control parsing and formatting for this formatter.

Constructors

Constructor Description
SmartFormatter Creates a formatter that uses the specified settings.

Public Methods

Method Description
AddExtensions Adds ISource extensions to the SmartFormatter.GetSourceExtensions list of this formatter, if the Type has not been added before. Unity.SmartStrings.Extensions.WellKnownExtensionTypes.Sources are inserted at the recommended position, all others are added at the end of the list. If the extension implements IInitializer, IInitializer.Initialize will be invoked. Extensions implementing ISourceandIFormatter will be auto-registered for both.
Format Replaces one or more format items in a specified string with the string representation of a specific object.
FormatInto Writes the formatting result into an IOutput instance.
GetFormatterExtension Searches for a Formatter Extension of the given type, and returns it. Returns null if the type cannot be found.
GetFormatterExtensions Gets the IFormatter formatter extensions registered with this formatter.
GetSourceExtension Searches for a Source Extension of the given type, and returns it. Returns null if the type cannot be found.
GetSourceExtensions Gets the ISource source extensions registered with this formatter.
InsertExtension Adds the ISource extensions at the position of the SmartFormatter.GetSourceExtensions list of this formatter, if the Type has not been added before. If the extension implements IInitializer, IInitializer.Initialize will be invoked.
RemoveFormatterExtension Removes the Formatter Extension of the given type.
RemoveSourceExtension Removes Source Extension of the given type.

Events

Event Description
OnFormattingFailure Raised when an error occurs during formatting.