Home ยท API Reference
Public Member Functions

DummyDriver Class Reference

DummyDriver inherits from MImEngineWordsInterface(Abstract driver class) and QObject, it implements a dummy input method engine. More...

#include <dummydriver.h>

Inheritance diagram for DummyDriver:
Inheritance graph
[legend]
Collaboration diagram for DummyDriver:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DummyDriver ()
 ~DummyDriver ()
virtual bool init ()
virtual bool addDictionaryWord (const QString &word, MImEngine::DictionaryType)
virtual bool removeDictionaryWord (const QString &word, MImEngine::DictionaryType)
virtual bool disableDictionary (MImEngine::DictionaryType)
virtual bool enableDictionary (MImEngine::DictionaryType)
virtual bool removeDictionary (MImEngine::DictionaryType)
virtual void appendString (const QString &s)
virtual void appendCharacter (const QChar &c)
virtual void tapKeyboard (const QPoint &position, bool shift, QChar symbol)
virtual void reselectString (const QString &s)
virtual void setContext (const QString &s, int cursor)
virtual void disablePrediction ()
virtual void enablePrediction ()
virtual bool predictionEnabled ()
virtual void disableCorrection ()
virtual void enableCorrection ()
virtual bool correctionEnabled ()
virtual void disableCompletion ()
virtual void enableCompletion ()
virtual bool completionEnabled ()
virtual QStringList candidates (unsigned int uStartIndex=0, unsigned int uNum=0)
virtual int totalCandidates ()
virtual int matchedLength ()
virtual QStringList matchedSyllables ()
virtual int suggestedCandidateIndex ()
virtual void setExactWordPositionInList (MImEngine::ExactInListType)
virtual MImEngine::DictionaryType candidateSource (int)
virtual void clearEngineBuffer ()
virtual QString language ()
virtual bool setLanguage (const QString &language, MImEngine::LanguagePriority)
virtual bool setKeyboardLayoutKeys (const QList< MImEngine::KeyboardLayoutKey > &keys)
virtual QList
< MImEngine::KeyboardLayoutKey > 
keyboardLayoutKeys ()
virtual bool exportAsNokiaDictionary (const QString &)
virtual bool importNokiaUserDictionary (const QString &)
virtual void setMaximumErrors (int)
virtual int maximumErrors ()
virtual void setMaximumCandidates (int maxCandidates)
virtual int maximumCandidates ()
virtual QString driver ()
virtual QString error ()
virtual bool setScript (const QString &s)
virtual QString script ()
virtual QString transliterate (const QString &targetScript, unsigned int index)
virtual void insertCharacters (const QString &text, int index=-1)
virtual void removeCharacters (int count=1, int index=-1)
virtual void commitWord (int index=-1, bool ignoreNewWord=true)

Detailed Description

DummyDriver inherits from MImEngineWordsInterface(Abstract driver class) and QObject, it implements a dummy input method engine.


Constructor & Destructor Documentation

DummyDriver::DummyDriver (  ) 

DummyDriver construtor

DummyDriver::~DummyDriver (  ) 

DummyDriver destructor


Member Function Documentation

bool DummyDriver::addDictionaryWord ( const QString &  word,
MImEngine::DictionaryType   
) [virtual]

Adds a new word to dictionary

Parameters:
word,reference of const QString
MImEngine::DictionaryType to which type of dictionary the word should be added
Returns:
bool true if the word is successfully added

Implements MImEngineWordsInterface.

void DummyDriver::appendCharacter ( const QChar &  c  )  [virtual]

Appends one character to engine buffer

Parameters:
c,reference of const QChar

Implements MImEngineWordsInterface.

void DummyDriver::appendString ( const QString &  s  )  [virtual]

Appends string to engine buffer

Parameters:
s,reference of const QString

Implements MImEngineWordsInterface.

QStringList DummyDriver::candidates ( unsigned int  uStartIndex = 0,
unsigned int  uNum = 0 
) [virtual]

Gets the candidates given by the engine.
Notes:

  1. By default, this method returns a candidate list which contains all candidates as much as the number which is specified by "setMaximumCandidates()".
  2. If you want to specify the start index and the number of the candidates that you want, please pass your arguments to this method.
  3. The index of whole candidates starts from "0". And if your specified index or number exceeds the actual range of candidates, an empty candidate list will be returned.
Parameters:
uStartIndex,the start index of the whole candidate set. And the index starts from "0".
uNum,the number of required candidates. If its value is "0", the default "Maximum" of candidates will be returned.
Returns:
QStringList, the list of words given by the engine

Implements MImEngineWordsInterface.

MImEngine::DictionaryType DummyDriver::candidateSource ( int  index  )  [virtual]

Returns the source dictionary where the candidate comes from.

Parameters:
index indicates the index of candidate in the candidates() list.
See also:
candidates().

Implements MImEngineWordsInterface.

void DummyDriver::clearEngineBuffer (  )  [virtual]

Clears engine input buffer. Note: clearEngineBuffer will not save the input word and its frequency.

See also:
appendString(), appendCharacter()

Implements MImEngineWordsInterface.

void DummyDriver::commitWord ( int  index = -1,
bool  ignoreNewWord = true 
) [virtual]

Notifies the engine that a word from the candidates list or from the engine buffer was commited. The engine bumps the commited word's frequency and adds it to the list of words where user can return later with reselectString(). A new word that is not in any dictionary is automatically first added to the personal dictionary. Setting parameter ignoreNewWord to true prevents new words from being processed and added to the personal dictionary.

Parameters:
index,the commited word's index at the candidates list. Default value -1 commits the word in the engine buffer as it is.
ignoreNewWord,if true a word that is not in any dictionary is ignored
See also:
reselectString()

Implements MImEngineWordsInterface.

bool DummyDriver::completionEnabled (  )  [virtual]

Gets the current status of word completion

Returns:
bool, true if word completion is enabled

Implements MImEngineWordsInterface.

bool DummyDriver::correctionEnabled (  )  [virtual]

Gets the current status of auto correction Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".

Returns:
bool, true if auto correction is enabled

Implements MImEngineWordsInterface.

void DummyDriver::disableCompletion (  )  [virtual]

Disables word completion feature

Implements MImEngineWordsInterface.

void DummyDriver::disableCorrection (  )  [virtual]

Disables auto correction feature Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".

Implements MImEngineWordsInterface.

bool DummyDriver::disableDictionary ( MImEngine::DictionaryType   )  [virtual]

Disables dictionary

Parameters:
MImEngine::DictionaryType dictionary type which shall be disabled
Returns:
bool true if the dictionary is successfully disabled

Implements MImEngineWordsInterface.

void DummyDriver::disablePrediction (  )  [virtual]

Disables word prediction feature

Implements MImEngineWordsInterface.

QString DummyDriver::driver (  )  [virtual]

Gets name for current driver

Parameters:
N/A 
Returns:
QString, current driver name

Implements MImEngineWordsInterface.

void DummyDriver::enableCompletion (  )  [virtual]

Enables word completion feature.

Implements MImEngineWordsInterface.

void DummyDriver::enableCorrection (  )  [virtual]

Enables auto correction feature Notes: For Chinese input methods, this feature may stand for "Fuzzy matching".

Implements MImEngineWordsInterface.

bool DummyDriver::enableDictionary ( MImEngine::DictionaryType   )  [virtual]

Enables dictionary

Parameters:
MImEngine::DictionaryType dictionary type which shall be enabled
Returns:
bool true if the dictionary is successfully enabled

Implements MImEngineWordsInterface.

void DummyDriver::enablePrediction (  )  [virtual]

Enables word prediction feature

Parameters:
N/A 
Returns:
N/A

Implements MImEngineWordsInterface.

QString DummyDriver::error (  )  [virtual]

Gets error

Parameters:
N/A 
Returns:
QString, error

Implements MImEngineWordsInterface.

bool DummyDriver::exportAsNokiaDictionary ( const QString &  fileName  )  [virtual]

Exports the user dictionary into an xml file

Returns:
bool status

Implements MImEngineWordsInterface.

bool DummyDriver::importNokiaUserDictionary ( const QString &  fileName  )  [virtual]

Imports user dictionary from an xml file

Returns:
bool status

Implements MImEngineWordsInterface.

bool DummyDriver::init ( void   )  [virtual]

REIMPLEMENTATION

Implements MImEngineWordsInterface.

void DummyDriver::insertCharacters ( const QString &  text,
int  index = -1 
) [virtual]

Inserts characters to the engine buffer.

Parameters:
text,the inserted characters
index,the position in the engine buffer where characters should be inserted. Default value -1 appends characters to end of the buffer.

Implements MImEngineWordsInterface.

QList< MImEngine::KeyboardLayoutKey > DummyDriver::keyboardLayoutKeys (  )  [virtual]

Gets current keyboard layout keys

Parameters:
N/A 
Returns:
QList<MImEngine::KeyboardLayoutKey>, current keyboard layout keys

Implements MImEngineWordsInterface.

QString DummyDriver::language (  )  [virtual]

Gets current language

Parameters:
N/A 
Returns:
QString, current language

Implements MImEngineWordsInterface.

int DummyDriver::matchedLength (  )  [virtual]

Gets matched length of the chosen candidate for current input sequence.
Notes: According to the input character sequence, "candidates()" can return a list and the user can choose one candidate from it and notify the result to the engine by invoking "setSuggestedCandidateIndex()" or "setContext()" method. The chosen candidate might not match the whole input sequence and might match only part of the input sequence. So this method will tell the matched length of the chosen candidate for current input sequence.

Returns:
int, the matched length of the chosen candidate for current input sequence.

Implements MImEngineWordsInterface.

QStringList DummyDriver::matchedSyllables (  )  [virtual]

Gets recognized syllables from current input string. Notes: In some input methods, the input string can be divided into several syllables according to the most possible candidates. So in this case the input method engine shall list the recognized syllables in order to give the user some prompts.

Returns:
QStringList, the list of recognized syllables.

Implements MImEngineWordsInterface.

int DummyDriver::maximumCandidates (  )  [virtual]

Sets the maximum number for candidates, including prediction and error correction

Parameters:
N/A 
Returns:
int, the allowed maximum candidates' count

Implements MImEngineWordsInterface.

int DummyDriver::maximumErrors (  )  [virtual]

Gets the maximum number of errors that could happen in a word.

Parameters:
N/A 
Returns:
int, the maximum allowed errors in a word. If the errors in a word is larger than this, then engine maybe can not do proper correction.

Implements MImEngineWordsInterface.

bool DummyDriver::predictionEnabled (  )  [virtual]

Gets the current status of word prediction

Parameters:
N/A 
Returns:
bool, true if word prediction is enabled

Implements MImEngineWordsInterface.

void DummyDriver::removeCharacters ( int  count = 1,
int  index = -1 
) [virtual]

Removes characters from the engine buffer. With default values for count and index the last character in the engine buffer will be removed.

Parameters:
count,the number of characters to be removed
index,the position in the engine buffer from where the removing should start. Default value -1 means that characters are removed from the end of the buffer.

Implements MImEngineWordsInterface.

bool DummyDriver::removeDictionary ( MImEngine::DictionaryType   )  [virtual]

Removes dictionary from disk

Parameters:
MImEngine::DictionaryType dictionary type which shall be removed
Returns:
bool true if dictionary is successfully removed

Implements MImEngineWordsInterface.

bool DummyDriver::removeDictionaryWord ( const QString &  word,
MImEngine::DictionaryType   
) [virtual]

Removes a word from dictionary

Parameters:
word,reference of const QString
MImEngine::DictionaryType from which type of dictionary the word should be removed
Returns:
bool true if the word is successfully removed

Implements MImEngineWordsInterface.

void DummyDriver::reselectString ( const QString &  s  )  [virtual]

Reselects a previously selected candidate word. This should be called when user highlights a previously selected word to recreate the candidate list with the original input sequence and key values. If the original data is not found then then the engine buffer is cleared and the reselected word appended to the buffer.

Parameters:
s,word to reselect
See also:
commitWord()

Implements MImEngineWordsInterface.

QString DummyDriver::script (  )  [virtual]

Gets four-letter script code of current input method engine.

Returns:
QString, the four-letter script code of current input method engine.

Implements MImEngineWordsInterface.

void DummyDriver::setContext ( const QString &  s,
int  cursor 
) [virtual]

Sets context information to the engine.
Context information is needed for better completion or for next word completion. The context information is usually a part of committed texts which should be passed to the engine before getting the completed/predicted word/character sequence from the engine.

Parameters:
s,the text block used as context information.
cursor,the cursor position in the text block.

Implements MImEngineWordsInterface.

void DummyDriver::setExactWordPositionInList ( MImEngine::ExactInListType  setting  )  [virtual]

Sets exact word position in candidate list. Call this to tell engine to position the exact word candidate in the list. The exact word can appear in first or last position of the candidate list and can also can be deleted from the candidate list.

Parameters:
setting,indicates whether the exact word in the cadidate list.
See also:
MImEngine::ExactInListType.

Implements MImEngineWordsInterface.

bool DummyDriver::setKeyboardLayoutKeys ( const QList< MImEngine::KeyboardLayoutKey > &  keys  )  [virtual]

Loads new keyboard layout keys for the engine.

Parameters:
keys,list of keys in the keyboard layout
Returns:
bool, status

Implements MImEngineWordsInterface.

bool DummyDriver::setLanguage ( const QString &  lang,
MImEngine::LanguagePriority   
) [virtual]

Sets language with the indicated priority

Parameters:
lang,reference of const QString. the language to be set
MImEngine::LanguagePriority. the priority for the language
Returns:
N/A

Implements MImEngineWordsInterface.

void DummyDriver::setMaximumCandidates ( int  maxCandidates  )  [virtual]

Sets the maximum number of candidates, including prediction and error correction The maximum number can not be bigger than 10.

Parameters:
int,the maximum number to be set
Returns:
N/A

Implements MImEngineWordsInterface.

void DummyDriver::setMaximumErrors ( int  maxErrors  )  [virtual]

Sets the maximum number of errors could happen in a word.

Parameters:
int,the maximum number to be set
Returns:
N/A
See also:
setMaximumCandidates()

Implements MImEngineWordsInterface.

bool DummyDriver::setScript ( const QString &  s  )  [virtual]

Sets current input method engine's script by four-letter script code.
Notes: The ISO definition of four-letter script code is at "http://www.unicode.org/iso15924/iso15924-codes.html". The above definition should be followed here.

Parameters:
s,the text string of four-letter script code.
Returns:
bool, true for success, otherwise false.

Implements MImEngineWordsInterface.

int DummyDriver::suggestedCandidateIndex (  )  [virtual]

Returns the index in the candidate list suggested by the engine as the most appropriate candidate. Call this after calling candidates(). Useful when doing error correction.

Returns:
the index of suggested candidate
See also:
candidates()

Implements MImEngineWordsInterface.

void DummyDriver::tapKeyboard ( const QPoint &  position,
bool  shift,
QChar  symbol 
) [virtual]

Tap to keyboard

Parameters:
position,position of the tap in the keyboard layout
shift,indicates whether the shift is on or not
symbol,the preferred symbol

Implements MImEngineWordsInterface.

int DummyDriver::totalCandidates (  )  [virtual]

Gets the number of all available candidates currently.

Returns:
int, the number of all available candidates or -1 if failure occurs.

Implements MImEngineWordsInterface.

QString DummyDriver::transliterate ( const QString &  targetScript,
unsigned int  index 
) [virtual]

Transliterates the candidate specified by the index into the target script's text. Notes:

  1. In some case, the contents of the specified candidate needs to be transliterated into a special script's text. For example, some "Simplified" Chinese text is transliterated into "Traditional" Chinese text, etc.
  2. Script code definition is at "http://www.unicode.org/iso15924/iso15924-codes.html".
Parameters:
targetScript,the target ISO-15924 script code.
index,the candidate's index obtained from "candidates()" function.
Returns:
QString, the transliterated text string when transliteration succeeds; Otherwise an empty string will be returned.

Implements MImEngineWordsInterface.


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation
MeeGo Touch