C# Class SIL.CoreImpl.SpellEngine

Inheritance: ISpellEngine, IDisposable
Mostrar archivo Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
Hunspell_add int
Hunspell_add_with_affix int
Hunspell_free_list void
Hunspell_initialize System.IntPtr
Hunspell_remove int
Hunspell_spell int
Hunspell_suggest int
Hunspell_suggest_Impl int
Hunspell_suggest_Impl int
Hunspell_uninitialize void
MarshalUnmananagedStrArray2ManagedStrArray string[]
MarshallAsUtf8Bytes byte[]
SetInternalStatus void
SpellEngine System

Public Methods

Method Description
Check ( string word ) : bool
Dispose ( ) : void
SetStatus ( string word1, bool isCorrect ) : void
Suggest ( string badWord ) : ICollection

Get a list of suggestions for alternate words to use in place of the mis-spelled one.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
Hunspell_add ( IntPtr handle, byte word ) : int
Hunspell_add_with_affix ( IntPtr handle, byte word, byte example ) : int
Hunspell_free_list ( IntPtr handle, IntPtr &list, int count ) : void
Hunspell_initialize ( byte aff_file, byte dict_file ) : IntPtr
Hunspell_remove ( IntPtr handle, byte word ) : int
Hunspell_spell ( IntPtr handle, byte word ) : int
Hunspell_suggest ( IntPtr handle, byte word, IntPtr &suggestions ) : int
Hunspell_suggest_Impl ( IntPtr handle, IntPtr &suggestions, byte word ) : int
Hunspell_suggest_Impl ( IntPtr handle, byte word, IntPtr &suggestions ) : int
Hunspell_uninitialize ( IntPtr handle ) : void
MarshalUnmananagedStrArray2ManagedStrArray ( IntPtr pUnmanagedStringArray, int StringCount ) : string[]
MarshallAsUtf8Bytes ( string word ) : byte[]

We can't declare these arguments (char * in C++) as [MarshalAs(UnmanagedType.LPStr)] string, because that unconditionally coverts the string to bytes using the current system code page, which is never what we want. So we declare them as byte[] and marshal like this. The C++ code requires null termination so add a null before converting. (This doesn't seem to be necessary, but better safe than sorry.)

SetInternalStatus ( string word, bool isCorrect ) : void
SpellEngine ( string affixPath, string dictPath, string exceptionPath ) : System

Method Details

Check() public method

public Check ( string word ) : bool
word string
return bool

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

SetStatus() public method

public SetStatus ( string word1, bool isCorrect ) : void
word1 string
isCorrect bool
return void

Suggest() public method

Get a list of suggestions for alternate words to use in place of the mis-spelled one.
public Suggest ( string badWord ) : ICollection
badWord string
return ICollection