LiteratorFactory
public class LiteratorFactory
Use this class to get an instance of Transliterator and Anteliterator. This class is responsible for the two step initialization that is needed to generate an instance of Transliterator or Anteliterator.
Important
Handle any exception that are thrown frominit
, transliterator
and anteliterator
- these are indicative of a bad config.
-
Available schemes in the scheme directory provided by the custom implementation of
Config
that was used to initialize this factory class.Throws
EngineErrorDeclaration
Swift
public func availableSchemes() throws -> [String]
Return Value
Array of scheme names that can be passed to the
instance
function -
Available scripts in the scheme directory provided by the given implementation of
Config
that was used to initialize this factory class.Throws
EngineErrorDeclaration
Swift
public func availableScripts() throws -> [String]
Return Value
Array of script names that can be passed to the
transliterator
oranteliterator
function -
Available custom mappings in the directory provided by the given implementation of
Config
that was used to initialize this factory class.Throws
EngineErrorDeclaration
Swift
public func availableCustomMappings() throws -> [String]
Return Value
Array of customMapping names that can be passed to the
transliterator
oranteliterator
function -
Get the underlying mappings for the specified scheme and script.
- schemeName: Name of the scheme which should be one of
availableSchemes
- scriptName: Name of the script which should be one of
availableScripts
Throws
EngineErrorDeclaration
Swift
public func mappings(schemeName: String, scriptName: String) throws -> [String : MappingValue]
Return Value
A nested map of Type->Key->([Scheme], Script)
- schemeName: Name of the scheme which should be one of
-
Get an instance of Transliterator for the specified scheme and script.
Note
Typically clients retrieve the mappings using themappings
API, modify it and optionally pass it into the mappings parameterThrows
EngineErrorDeclaration
Swift
public func transliterator(schemeName: String, scriptName: String, mappings: [String : MappingValue]? = nil) throws -> Transliterator
Parameters
schemeName
Name of the scheme which should be one of
availableSchemes
scriptName
Name of the script which should be one of
availableScripts
mappings
A nested map of Type->Key->([Scheme], Script) that will override the built-in mappings
Return Value
Instance of Transliterator for the given scheme and script
-
Get an instance of Anteliterator for the specified scheme and script.
Note
Typically clients retrieve the mappings using themappings
API, modify it and optionally pass it into the mappings parameterThrows
EngineErrorDeclaration
Swift
public func anteliterator(schemeName: String, scriptName: String, mappings: [String : MappingValue]? = nil) throws -> Anteliterator
Parameters
schemeName
Name of the scheme which should be one of
availableSchemes
scriptName
Name of the script which should be one of
availableScripts
mappings
A nested map of Type->Key->([Scheme], Script) that will override the built-in mappings
Return Value
Instance of Anteliterator for the given scheme and script
-
Get an instance of Transliterator for the specified customMapping.
Throws
EngineErrorDeclaration
Swift
public func transliterator(customMapping: String) throws -> Transliterator
Parameters
customMapping
Name of the customMapping which should be one of
availableCustomMappings
Return Value
Instance of Transliterator for the given customMapping
-
Get an instance of Anteliterator for the specified customMapping.
Throws
EngineErrorDeclaration
Swift
public func anteliterator(customMapping: String) throws -> Anteliterator
Parameters
customMapping
Name of the customMapping which should be one of
availableCustomMappings
Return Value
Instance of Anteliterator for the given customMapping