Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SmartFormatter

Constructs formatted strings by invoking each registered source and formatter extension.
Read time 1 minuteLast updated 6 days ago

Definition

public class SmartFormatter : ISerializationCallbackReceiver

Constructors

Constructor

Description

SmartFormatter(Unity.SmartStrings.Core.Settings.SmartSettings)Creates a formatter that uses the specified settings.

Properties

Property

Description

ParserThe Parser this formatter uses to parse format strings.
SettingsThe SmartSettings that control parsing and formatting for this formatter.

Methods

Method

Description

AddExtensionsAdds IFormatter extensions to the SmartFormatter.GetFormatterExtensions list of this formatter, if the Type has not been added before. Formatters are inserted at the recommended position, all others are added at the end of the list.
FormatReplaces one or more format items in a specified string with the string representation of a specific object.
FormatIntoWrites the formatting result into an IOutput instance.
GetFormatterExtensionSearches for a Formatter Extension of the given type, and returns it. Returns
null
if the type cannot be found.
GetFormatterExtensionsGets the IFormatter formatter extensions registered with this formatter.
GetSourceExtensionSearches for a Source Extension of the given type, and returns it. Returns
null
if the type cannot be found.
GetSourceExtensionsGets the ISource source extensions registered with this formatter.
InsertExtensionAdds the IFormatter extension at the
position
of the SmartFormatter.GetFormatterExtensions list of this formatter, if the Type has not been added before. If the extension implements IInitializer, IInitializer.Initialize will be invoked.
RemoveFormatterExtensionRemoves the Formatter Extension of the given type.
RemoveSourceExtensionRemoves Source Extension of the given type.

Events

Member

Description

OnFormattingFailureRaised when an error occurs during formatting.