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 from init, transliterator and anteliterator - these are indicative of a bad config.
  • Initialize with an implementation of the Config protocol.

    Throws

    EngineError

    Declaration

    Swift

    public init(config: Config) throws

    Parameters

    config

    Instance of a custom implementation of the Config protocol

  • Available schemes in the scheme directory provided by the custom implementation of Config that was used to initialize this factory class.

    Throws

    EngineError

    Declaration

    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

    EngineError

    Declaration

    Swift

    public func availableScripts() throws -> [String]

    Return Value

    Array of script names that can be passed to the transliterator or anteliterator function

  • Available custom mappings in the directory provided by the given implementation of Config that was used to initialize this factory class.

    Throws

    EngineError

    Declaration

    Swift

    public func availableCustomMappings() throws -> [String]

    Return Value

    Array of customMapping names that can be passed to the transliterator or anteliterator 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

    EngineError

    Declaration

    Swift

    public func mappings(schemeName: String, scriptName: String) throws -> [String : MappingValue]

    Return Value

    A nested map of Type->Key->([Scheme], Script)

  • Get an instance of Transliterator for the specified scheme and script.

    Note

    Typically clients retrieve the mappings using the mappings API, modify it and optionally pass it into the mappings parameter

    Throws

    EngineError

    Declaration

    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 the mappings API, modify it and optionally pass it into the mappings parameter

    Throws

    EngineError

    Declaration

    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

    EngineError

    Declaration

    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

    EngineError

    Declaration

    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