C# Class SIL.CoreImpl.PalasoWritingSystemManager

Inheritance: IWritingSystemManager
Mostra file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
CanSave ( IWritingSystem ws, string &path ) : bool

Return true if we expect (absent pathological changes while we're not looking) to be able to save changes to this writing system.

CheckForNewerGlobalWritingSystems ( ) : IEnumerable

Gets all newer shared writing systems.

Create ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : IWritingSystem

Creates a new writing system.

Create ( string identifier ) : IWritingSystem

Creates a new writing system.

CreateFrom ( IWritingSystem ws ) : IWritingSystem

Creates a copy of the specified writing system.

Exists ( int handle ) : bool

Determines if a writing system exists with the specified handle.

Exists ( string identifier ) : bool

Determines if a writing system exists with the specified RFC5646 identifier.

Get ( int handle ) : IWritingSystem

Gets the writing system with the specified handle.

Get ( string identifier ) : IWritingSystem

Gets the specified writing system. Throws KeyNotFoundException if it can not be found, there is a TryGet available to avoid this.

GetOrSet ( string identifier, IWritingSystem &ws ) : bool

Gets the specified writing system if it exists, otherwise it creates a writing system using the specified identifier and sets it.

GetStrFromWs ( int handle ) : string

Gets the RFC5646 identifier from the handle.

GetValidLangTagForNewLang ( string langName ) : string

Returns an ISO 639 language tag that is guaranteed to be valid and unique for both the local and the global writing system store. NOTE: This method should only be used for writing systems that are custom (i.e. not defined in the current version of the ethnologue). The returned code will *not* have the 'x-' prefix denoting a user-defined writing system, but it will check that an existing user-defined writing system does not exist with the returned language tag. This method also does not worry about regions, variants, etc. as it's use is restricted to the language tag for a custom writing system.

GetWritingSystems ( SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgws, int cws ) : void

Get the list of writing systems currrently installed in the system.

GetWsFromStr ( string identifier ) : int

Gets the HVO from the RFC5646 identifier.

PalasoWritingSystemManager ( ) : System

Initializes a new instance of the PalasoWritingSystemManager class.

PalasoWritingSystemManager ( IFwWritingSystemStore store ) : System

Initializes a new instance of the PalasoWritingSystemManager class.

PalasoWritingSystemManager ( IFwWritingSystemStore localStore, IFwWritingSystemStore globalStore ) : System

Initializes a new instance of the PalasoWritingSystemManager class.

localStore and globalStore will be disposed by the PalasoWritingSystemManager!

Replace ( IWritingSystem ws ) : void

Replaces an existing writing system with the specified writing system if they have the same identifier.

Save ( ) : void

Persists all modified writing systems.

Set ( string identifier ) : IWritingSystem

Creates a writing system using the specified identifier and sets it.

Set ( IWritingSystem ws ) : void

Sets the specified writing system.

TryGet ( string identifier, IWritingSystem &ws ) : bool

Gets the specified writing system if it exists.

TryGetOrSet ( string identifier, IWritingSystem &ws ) : bool

Gets the specified writing system if it exists, otherwise it creates a writing system using the specified identifier and sets it.

get_CharPropEngine ( int ws ) : ILgCharacterPropertyEngine

Get the char prop engine for a particular WS

get_Engine ( string bstrIdentifier ) : ILgWritingSystem

Get the actual writing system object for a given ICU Locale string. The current implementation returns any existing writing system for that ICU Locale, or creates one with default settings if one is not already known. (Use get_EngineOrNull to avoid automatic creation of a new engine.)

get_EngineOrNull ( int ws ) : ILgWritingSystem

Get the actual writing system object for a given code, or returns NULL if one does not already exist. (Use get_Engine if you prefer to have an writing system created automatically if one does not already exist.)

get_Renderer ( int ws, IVwGraphics vg ) : IRenderEngine

Get the renderer for a particular WS

get_RendererFromChrp ( IVwGraphics vg, LgCharRenderProps &chrp ) : IRenderEngine

Get the renderer for a particular Chrp

Protected Methods

Method Description
UnionSettingsKeyboardsWithLocalStore ( ) : string

Performs the Union of Settings.Default.LocalKeyboards and m_localStore.LocalKeyboardSettings and returns the result as an XML string. Protected for tests.

Private Methods

Method Description
LangTagInUse ( string identifier ) : bool

Determines whether or not the specified language tag is in use by another writing system in either the local or global writing system store.

RegisterRenderEngine ( IRenderEngine engine ) : void
Set ( string identifier, bool &foundExisting ) : IWritingSystem

Create the writing system. Typically we will create it, but we may have to modify the ID and then find that there is an existing one. Set foundExisting true if so.

Method Details

CanSave() public method

Return true if we expect (absent pathological changes while we're not looking) to be able to save changes to this writing system.
public CanSave ( IWritingSystem ws, string &path ) : bool
ws IWritingSystem
path string
return bool

CheckForNewerGlobalWritingSystems() public method

Gets all newer shared writing systems.
public CheckForNewerGlobalWritingSystems ( ) : IEnumerable
return IEnumerable

Create() public method

Creates a new writing system.
public Create ( LanguageSubtag languageSubtag, ScriptSubtag scriptSubtag, RegionSubtag regionSubtag, VariantSubtag variantSubtag ) : IWritingSystem
languageSubtag LanguageSubtag The language subtag.
scriptSubtag ScriptSubtag The script subtag.
regionSubtag RegionSubtag The region subtag.
variantSubtag VariantSubtag The variant subtag.
return IWritingSystem

Create() public method

Creates a new writing system.
public Create ( string identifier ) : IWritingSystem
identifier string
return IWritingSystem

CreateFrom() public method

Creates a copy of the specified writing system.
public CreateFrom ( IWritingSystem ws ) : IWritingSystem
ws IWritingSystem The writing system.
return IWritingSystem

Exists() public method

Determines if a writing system exists with the specified handle.
public Exists ( int handle ) : bool
handle int The handle.
return bool

Exists() public method

Determines if a writing system exists with the specified RFC5646 identifier.
public Exists ( string identifier ) : bool
identifier string The identifier.
return bool

Get() public method

Gets the writing system with the specified handle.
public Get ( int handle ) : IWritingSystem
handle int The handle.
return IWritingSystem

Get() public method

Gets the specified writing system. Throws KeyNotFoundException if it can not be found, there is a TryGet available to avoid this.
public Get ( string identifier ) : IWritingSystem
identifier string The identifier.
return IWritingSystem

GetOrSet() public method

Gets the specified writing system if it exists, otherwise it creates a writing system using the specified identifier and sets it.
public GetOrSet ( string identifier, IWritingSystem &ws ) : bool
identifier string The identifier.
ws IWritingSystem The writing system.
return bool

GetStrFromWs() public method

Gets the RFC5646 identifier from the handle.
public GetStrFromWs ( int handle ) : string
handle int The handle.
return string

GetValidLangTagForNewLang() public method

Returns an ISO 639 language tag that is guaranteed to be valid and unique for both the local and the global writing system store. NOTE: This method should only be used for writing systems that are custom (i.e. not defined in the current version of the ethnologue). The returned code will *not* have the 'x-' prefix denoting a user-defined writing system, but it will check that an existing user-defined writing system does not exist with the returned language tag. This method also does not worry about regions, variants, etc. as it's use is restricted to the language tag for a custom writing system.
public GetValidLangTagForNewLang ( string langName ) : string
langName string The full name of the language.
return string

GetWritingSystems() public method

Get the list of writing systems currrently installed in the system.
public GetWritingSystems ( SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgws, int cws ) : void
rgws SIL.FieldWorks.Common.COMInterfaces.ArrayPtr
cws int
return void

GetWsFromStr() public method

Gets the HVO from the RFC5646 identifier.
public GetWsFromStr ( string identifier ) : int
identifier string The identifier.
return int

PalasoWritingSystemManager() public method

Initializes a new instance of the PalasoWritingSystemManager class.
public PalasoWritingSystemManager ( ) : System
return System

PalasoWritingSystemManager() public method

Initializes a new instance of the PalasoWritingSystemManager class.
public PalasoWritingSystemManager ( IFwWritingSystemStore store ) : System
store IFwWritingSystemStore The store.
return System

PalasoWritingSystemManager() public method

Initializes a new instance of the PalasoWritingSystemManager class.
localStore and globalStore will be disposed by the PalasoWritingSystemManager!
public PalasoWritingSystemManager ( IFwWritingSystemStore localStore, IFwWritingSystemStore globalStore ) : System
localStore IFwWritingSystemStore The local store.
globalStore IFwWritingSystemStore The global store.
return System

Replace() public method

Replaces an existing writing system with the specified writing system if they have the same identifier.
public Replace ( IWritingSystem ws ) : void
ws IWritingSystem The writing system.
return void

Save() public method

Persists all modified writing systems.
public Save ( ) : void
return void

Set() public method

Creates a writing system using the specified identifier and sets it.
public Set ( string identifier ) : IWritingSystem
identifier string The identifier.
return IWritingSystem

Set() public method

Sets the specified writing system.
public Set ( IWritingSystem ws ) : void
ws IWritingSystem The writing system.
return void

TryGet() public method

Gets the specified writing system if it exists.
public TryGet ( string identifier, IWritingSystem &ws ) : bool
identifier string The identifier.
ws IWritingSystem The writing system.
return bool

TryGetOrSet() public method

Gets the specified writing system if it exists, otherwise it creates a writing system using the specified identifier and sets it.
public TryGetOrSet ( string identifier, IWritingSystem &ws ) : bool
identifier string The identifier.
ws IWritingSystem The writing system.
return bool

UnionSettingsKeyboardsWithLocalStore() protected method

Performs the Union of Settings.Default.LocalKeyboards and m_localStore.LocalKeyboardSettings and returns the result as an XML string. Protected for tests.
protected UnionSettingsKeyboardsWithLocalStore ( ) : string
return string

get_CharPropEngine() public method

Get the char prop engine for a particular WS
public get_CharPropEngine ( int ws ) : ILgCharacterPropertyEngine
ws int
return ILgCharacterPropertyEngine

get_Engine() public method

Get the actual writing system object for a given ICU Locale string. The current implementation returns any existing writing system for that ICU Locale, or creates one with default settings if one is not already known. (Use get_EngineOrNull to avoid automatic creation of a new engine.)
public get_Engine ( string bstrIdentifier ) : ILgWritingSystem
bstrIdentifier string The identifier.
return ILgWritingSystem

get_EngineOrNull() public method

Get the actual writing system object for a given code, or returns NULL if one does not already exist. (Use get_Engine if you prefer to have an writing system created automatically if one does not already exist.)
public get_EngineOrNull ( int ws ) : ILgWritingSystem
ws int
return ILgWritingSystem

get_Renderer() public method

Get the renderer for a particular WS
public get_Renderer ( int ws, IVwGraphics vg ) : IRenderEngine
ws int
vg IVwGraphics
return IRenderEngine

get_RendererFromChrp() public method

Get the renderer for a particular Chrp
public get_RendererFromChrp ( IVwGraphics vg, LgCharRenderProps &chrp ) : IRenderEngine
vg IVwGraphics
chrp LgCharRenderProps
return IRenderEngine