S60 3rd Edition API Reference: ptidefs.h Source File

ptidefs.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name       : PtiDefs.h
00004 *  Part of    : PtiEngine
00005 *  Description: Predective text input engine definitions
00006 *  Version:
00007 *
00008 *  Copyright ?2003-2005 Nokia Corporation.
00009 *  This material, including documentation and any related
00010 *  computer programs, is protected by copyright controlled by
00011 *  Nokia Corporation. All rights are reserved. Copying,
00012 *  including reproducing, storing,  adapting or translating, any
00013 *  or all of this material requires the prior written consent of
00014 *  Nokia Corporation. This material also contains confidential
00015 *  information which may not be disclosed to others without the
00016 *  prior written consent of Nokia Corporation.
00017 * ============================================================================
00018 */
00019 #ifndef _PTI_DEFS_H
00020 #define _PTI_DEFS_H
00021 
00022 #include <e32keys.h>
00023 
00024 const TInt KMaxLanguageNameLength = 50;
00025 
00026 const TInt KErrPtiEngineBase = (-1000); //based on the value of leave in PtiEngine
00027 enum TPtiError
00028     {
00029     KErrNoActiveLanguage = KErrPtiEngineBase-1,
00030     KErrLanguageNotFound = KErrPtiEngineBase-2,
00031     KErrNoSuitableCore = KErrPtiEngineBase-3,
00032     KErrNotAllowed = KErrPtiEngineBase-4,
00033     KErrTooLongWord = KErrPtiEngineBase-5,
00034     KErrInvalidWord = KErrPtiEngineBase-6,
00035     KErrTooLongReading = KErrPtiEngineBase-7,
00036     KErrInvalidReading = KErrPtiEngineBase-8,
00037     KErrUserDic = KErrPtiEngineBase-9
00038     };
00039 
00040 
00041 enum TPtiEngineInputMode
00042     {
00043     EPtiEngineInputModeNone = 0,
00044     EPtiEngineMultitapping,             // Basic multitapping input for latin languages.
00045     EPtiEnginePredictive,               // Predictive input for latin languages.
00046     EPtiEngineWordCompletion,           // Predictive input with word completion for latin languages.
00047     EPtiEngineNumeric,                  // Latin numeric input mode.
00048     EPtiEngineQwerty,                   // Basic qwerty input mode.
00049     EPtiEnginePinyin,                   // Chinese pinyin mode.
00050     EPtiEngineStroke,                   // Chinese stroke mode.
00051     EPtiEngineZhuyin,                   // Chinese zhuyin mode.
00052     EPtiEngineHiraganaKanji,            // Hiragana/Kanji mode.
00053     EPtiEngineHiraganaKanjiPredictive,  // Predictive Hiragana/Kanji mode.
00054     EPtiEngineKatakana,                 // Half-width Katakana mode.
00055     EPtiEngineFullWidthKatakana,        // Full-width Katakana mode.
00056     EPtiEngineFullWidthNumeric,         // Full-width Alphabet mode (for Japanese input).
00057     EPtiEngineFullWidthAlphabet,        // Full-width Alphabet mode (for Japanese input).
00058     EPtiEngineHiragana,                 // Hiragana only mode.
00059     EPtiEnginePinyinByPhrase,           // Pinyin phrase input.
00060     EPtiEngineZhuyinByPhrase,           // Zhuyin phrase input.
00061     EPtiEngineZhuyinQwerty,             // Zhuyin qwerty input.
00062     EPtiEngineZhuyinPhraseQwerty,       // Zhuyin phrase qwerty input.
00063     EPtiEnginePinyinQwerty,             // Pinyin qwerty input.
00064     EPtiEnginePinyinPhraseQwerty,       // Pinyin phrase qwerty input.
00065     EPtiEngineStrokeQwerty,             // Stroke qwerty input.
00066     EPtiEngineNormalCangjieQwerty,      // Normal Cangjie qwerty input
00067     EPtiEngineEasyCangjieQwerty,        // Easy Cangjie qwerty input
00068     EPtiEngineAdvCangjieQwerty,         // Advanced Cangjie qwerty input
00069     EPtiEngineHiraganaKanjiQwerty,      // Hiragana/Kanji qwerty input mode.
00070     EPtiEngineHiraganaKanjiPredictiveQwerty,  // Predictive Hiragana/Kanji qwerty input mode.
00071     EPtiEngineKatakanaQwerty,           // Half-width Katakana qwerty input mode.
00072     EPtiEngineFullWidthKatakanaQwerty,  // Full-width Katakana qwerty input mode.
00073     EPtiEngineFullWidthNumericQwerty,   // Full-width Alphabet qwerty input mode (for Japanese input).
00074     EPtiEngineFullWidthAlphabetQwerty,  // Full-width Alphabet qwerty input mode (for Japanese input).
00075     EPtiEngineHiraganaQwerty,           // Hiragana only qwerty input mode.
00076     //EPtiEngineMaxInputModes = EPtiEngineHiraganaQwerty,
00077     EPtiEnginePinyinVkb,                   // Chinese pinyin mode.
00078     EPtiEngineStrokeVkb,                   // Chinese stroke mode.
00079     EPtiEngineZhuyinVkb,                    // Chinese zhuyin mode.
00080     EPtiEngineStrokeByPhrase,           // Stroke phrase input.
00081     EPtiEngineStrokePhraseQwerty,       // Stroke phrase qwerty input.
00082     EPtiEngineHiraganaKanjiVkb,           // Hiragana/Kanji mode for VKB.
00083     EPtiEngineHiraganaKanjiPredictiveVkb, // Predictive Hiragana/Kanji mode for VKB.
00084     EPtiEngineHiraganaKanjiHwr,           // Hiragana/Kanji mode for HWR.
00085     EPtiEngineHiraganaKanjiPredictiveHwr, // Predictive Hiragana/Kanji mode for HWR.
00086     EPtiEngineKatakanaVkb,                // Half-width Katakana mode for VKB.
00087     EPtiEngineFullWidthKatakanaVkb,       // Full-width Katakana mode for VKB.
00088     EPtiEngineHiraganaVkb,                // Hiragana only qwerty input mode for VKB.
00089     EPtiEngineNormalCangjieVkb,  
00090     EPtiEngineEasyCangjieVkb,    
00091     EPtiEngineAdvCangjieVkb,     
00092     EPtiEngineMaxInputModes = EPtiEngineAdvCangjieVkb
00093     };
00094 
00095 
00096 
00097 // Key ids for conventional phone key pad.
00098 enum TPtiKey
00099     {
00100     EPtiKeyNone = 0,
00101 
00102     EPtiKey1    = '1',
00103     EPtiKey2    = '2',
00104     EPtiKey3    = '3',
00105     EPtiKey4    = '4',
00106     EPtiKey5    = '5',
00107     EPtiKey6    = '6',
00108     EPtiKey7    = '7',
00109     EPtiKey8    = '8',
00110     EPtiKey9    = '9',
00111     EPtiKeyStar = '*',
00112     EPtiKey0    = '0',
00113     EPtiKeyHash = '#',
00114 
00115     // alternate names
00116     EPtiKeyPunct = EPtiKey1,
00117     EPtiKeyABC   = EPtiKey2,
00118     EPtiKeyDEF   = EPtiKey3,
00119     EPtiKeyGHI   = EPtiKey4,
00120     EPtiKeyJKL   = EPtiKey5,
00121     EPtiKeyMNO   = EPtiKey6,
00122     EPtiKeyPQRS  = EPtiKey7,
00123     EPtiKeyTUV   = EPtiKey8,
00124     EPtiKeyWXYZ  = EPtiKey9,
00125 
00126     // qwerty keys
00127     // values are same as incoming scan codes from key driver.
00128     EPtiKeyQwerty1     = 0x31,
00129     EPtiKeyQwerty2     = 0x32,
00130     EPtiKeyQwerty3     = 0x33,
00131     EPtiKeyQwerty4     = 0x34,
00132     EPtiKeyQwerty5     = 0x35,
00133     EPtiKeyQwerty6     = 0x36,
00134     EPtiKeyQwerty7     = 0x37,
00135     EPtiKeyQwerty8     = 0x38,
00136     EPtiKeyQwerty9     = 0x39,
00137     EPtiKeyQwerty0     = 0x30,
00138 
00139     EPtiKeyQwertyPlus  = 0x2b,
00140     EPtiKeyQwertyMinus = EStdKeyMinus,
00141     EPtiKeyQwertyComma = EStdKeyComma,
00142     EPtiKeyQwertySemicolon = EStdKeySemiColon,
00143     EPtiKeyQwertyFullstop = EStdKeyFullStop,
00144     EPtiKeyQwertyHash = EStdKeyHash,
00145     EPtiKeyQwertySlash = EStdKeyForwardSlash,
00146     EPtiKeyQwertyApostrophe = EStdKeySingleQuote,
00147     EPtiKeyQwertySpace = EStdKeySpace,
00148 
00149     EPtiKeyQwertyA = 0x41,
00150     EPtiKeyQwertyB = 0x42,
00151     EPtiKeyQwertyC = 0x43,
00152     EPtiKeyQwertyD = 0x44,
00153     EPtiKeyQwertyE = 0x45,
00154     EPtiKeyQwertyF = 0x46,
00155     EPtiKeyQwertyG = 0x47,
00156     EPtiKeyQwertyH = 0x48,
00157     EPtiKeyQwertyI = 0x49,
00158     EPtiKeyQwertyJ = 0x4a,
00159     EPtiKeyQwertyK = 0x4b,
00160     EPtiKeyQwertyL = 0x4c,
00161     EPtiKeyQwertyM = 0x4d,
00162     EPtiKeyQwertyN = 0x4e,
00163     EPtiKeyQwertyO = 0x4f,
00164     EPtiKeyQwertyP = 0x50,
00165     EPtiKeyQwertyQ = 0x51,
00166     EPtiKeyQwertyR = 0x52,
00167     EPtiKeyQwertyS = 0x53,
00168     EPtiKeyQwertyT = 0x54,
00169     EPtiKeyQwertyU = 0x55,
00170     EPtiKeyQwertyV = 0x56,
00171     EPtiKeyQwertyW = 0x57,
00172     EPtiKeyQwertyX = 0x58,
00173     EPtiKeyQwertyY = 0x59,
00174     EPtiKeyQwertyZ = 0x5a
00175     };
00176 
00177 
00178 
00179 enum TPtiEngineCapsBits
00180     {
00181     EWordCompletion          = 0x01,
00182     EReordering              = 0x02,
00183     ENextWordPrediction      = 0x04,
00184     ESupportUserDictionaries = 0x08,
00185     ESupportSCTToneMarks     = 0x10,
00186     ESupportCangjieInput     = 0x20
00187     };
00188 
00189 
00190 enum TPtiTextCase
00191     {
00192     EPtiCaseLower = 0,
00193     EPtiCaseUpper,
00194     EPtiCaseChrLower,     // Only needed with qwerty input.
00195     EPtiCaseChrUpper      // Only needed with qwerty input.
00196     };
00197 
00198 
00199 enum TPtiCharConversion
00200     {
00201     EPtiSimplifiedToComplex = 0x01,  // Chinese simplified to Chinese complex
00202     EPtiUcs2ToUtf8 = 0x02,           // Unicode to utf8
00203     EPtiUcs2ToBig5 = 0x04,           // Unicode to big5
00204     EPtiUcs2ToGB = 0x08,             // Unicode to Guo-Biao
00205     EPtiUtf8ToUcs2 = 0x10,           // Utf8 to Unicode
00206     EPtiKo2ToWc = 0x20,              // KSC5601 to Hangul Syllable
00207     EPtiWcToKo2 = 0x30,              // Hangul Syllable to KSC5601
00208     EPtiBig5ToUcs2 = 0x40,           // Big5 to Unicode
00209     EPtiComplexToSimplified = 0x80   // Chinese complex to Chinese simplified
00210     };
00211 
00212 
00213 enum TPtiSpelling
00214     {
00215     EPtiStrokes = 0x01,
00216     EPtiPinyin = 0x02,
00217     EPtiBopomofo = 0x04,
00218     EPtiZhuyin = 0x08
00219     };
00220 
00221 
00222 enum TPtiChineseVariant
00223     {
00224     EPtiChineseVariantPrc = 0,
00225     EPtiChineseVariantHk,
00226     EPtiChineseVariantTw
00227     };
00228 
00229 
00230 enum TPtiEngineCommand
00231     {
00232     EPtiCommandNone,
00233     EPtiCommandUserActionLeft,
00234     EPtiCommandUserActionRight,
00235     EPtiCommandUserActionConvert,
00236     EPtiCommandUserActionPrevious,
00237     EPtiCommandUserActionLengthen,
00238     EPtiCommandUserActionShorten,
00239     EPtiCommandUserActionCancel,
00240     EPtiCommandUserActionComplete,
00241     EPtiCommandUserActionAllComplete,
00242     EPtiCommandUserActionGetCurrentIndexOfCandidates,
00243     EPtiCommandUserActionCompleteCandidate,
00244     EPtiCommandUserActionCompleteFull0,
00245     EPtiCommandUserActionCompleteFull1,
00246     EPtiCommandUserActionCompleteFull2,
00247     EPtiCommandUserActionCompleteFull3,
00248     EPtiCommandUserActionCompleteFull4,
00249     EPtiCommandUserActionCompleteFull5,
00250     EPtiCommandUserActionCompleteFull6,
00251     EPtiCommandUserActionCompleteFull7,
00252     EPtiCommandUserActionCompleteFull8,
00253     EPtiCommandUserActionCompleteFull9,
00254     EPtiCommandUserActionCompleteHalf0,
00255     EPtiCommandUserActionCompleteHalf1,
00256     EPtiCommandUserActionCompleteHalf2,
00257     EPtiCommandUserActionCompleteHalf3,
00258     EPtiCommandUserActionCompleteHalf4,
00259     EPtiCommandUserActionCompleteHalf5,
00260     EPtiCommandUserActionCompleteHalf6,
00261     EPtiCommandUserActionCompleteHalf7,
00262     EPtiCommandUserActionCompleteHalf8,
00263     EPtiCommandUserActionCompleteHalf9,
00264     EPtiCommandEnableToneMarks,
00265     EPtiCommandDisableToneMarks,
00266     EPtiCommandResetToneMark,
00267     EPtiCommandIncrementToneMark,
00268     EPtiCommandIncrementToneMarkOverrideInvalid,
00269     EPtiCommandReloadLearningInfo,
00270     EPtiCommandUserDictionaryDelaySaving,
00271     EPtiCommandUserDictionarySaveNow,
00272     EPtiCommandUserActionSetCurrentIndexOfCandidates,
00273     EPtiCommandUseLatinDefaultKeyMap,
00274     EPtiCommandUseLatinCaseUpperOnlyKeyMap,
00275     EPtiCommandUseLatinCaseLowerOnlyKeyMap,
00276     EPtiCommandResetLearningInfo,
00277     EPtiCommandPollQwertyDeadKeyRootFlag,             // Indicates that dead key root char was added to buffer.
00278     EPtiCommandGetAndClearDeadKeyRootChar,
00279     EPtiCommandDeadKeyWaiting,
00280     EPtiCommandQueryAndClearGetAllFlag,
00281     EPtiCommandGetAndClearVowelSequence,
00282     EPtiCommandSetMultitapTimer         // Set multitap timer for japanese varint only
00283 #start_since SINCE_3_1_SDK
00284     ,EPtiCommandVowelSeqFlag,
00285     EPtiCommandClearVowelSeq,
00286     EPtiCommandSetJapaneseQwertyFlags,   // Set Japanese Qwerty flags for japanese varint only
00287     EPtiCommandGetAndClearLastVietnameseChar,
00288     EPtiCommandSetVietnameseLastChar,
00289     EPtiCommandQueryReplacePrevious,
00290     EPtiCommandSetLastKeyForVietnamese,
00291     EPtiCommandResetVietnameseVowelSeqAndToneMark,
00292     EPtiCommandGetVietnameseLastKey
00293 #end_since SINCE_3_1_SDK
00294     // More commands can be added here...
00295     };
00296 
00297 
00298 class TPtiLangName
00299     {
00300     public:
00301         TInt iLanguageCode;
00302         TBuf<KMaxLanguageNameLength> iName;
00303     };
00304 
00305 
00311 #define ELangNumeric 0x5000
00312 
00313 
00314 class MPtiCoreInfo
00315     {
00316     public:
00325         virtual TBool WordCompletion() const = 0;
00326 
00335         virtual TBool Reordering() const = 0;
00336 
00343         virtual TInt MaximumWordLength() const = 0;
00344 
00353         virtual TInt MaximumNumberOfCandidates() const = 0;
00354 
00363         virtual TBool NextWordPrediction() const = 0;
00364 
00371         virtual TPtrC VendorString() const = 0;
00372 
00380         virtual TUint32 CapsBits() const = 0;
00381 
00388         virtual TInt32 Uid() const = 0;
00389 
00397         virtual TUint32 CharConversions() const = 0;
00398 
00406         virtual TUint32 Spellings() const = 0;
00407     };
00408 
00409 
00410 
00411 class TPtiCoreInfo : public MPtiCoreInfo
00412     {
00413     public:
00414         inline TBool WordCompletion() const;
00415         inline TBool Reordering() const;
00416         inline TInt MaximumWordLength() const;
00417         inline TInt MaximumNumberOfCandidates() const;
00418         inline TBool NextWordPrediction() const;
00419         inline TPtrC VendorString() const;
00420         inline TInt32 Uid() const;
00421         inline TUint32 CharConversions() const;
00422         inline TUint32 Spellings() const;
00423 
00424         inline TUint32 CapsBits() const;
00425         inline void SetCapsBits(TUint32 aBits);
00426         inline void SetVendorString(const TDesC& aStr);
00427         inline void SetMaxWordLength(TInt aMaxLen);
00428         inline void SetUid(TInt32 aUid);
00429         inline void SetSpellings(TUint32 aSpellings);
00430         inline void SetMaxNumberOfCandidates(TInt aMax);
00431         inline void SetCharConversions(TUint32 aConvs);
00432 
00433     private:
00434         TUint32 iCapsBits;
00435         TPtrC iVendorIdStr;
00436         TInt iMaxWordLength;
00437         TInt iMaxNumberOfCandidates;
00438         TInt32 iUid;
00439         TUint32 iCharConversions;
00440         TUint32 iSpellings;
00441     };
00442 
00443 
00444 #define KPtiEngineChineseSeparator 0x0027
00445 
00446 // Tone marks for pinyin input
00447 enum
00448     {
00449     KPtiPinyinTone0 = 0x02C9,
00450     KPtiPinyinTone1 = 0x02CA,
00451     KPtiPinyinTone2 = 0x02C7,
00452     KPtiPinyinTone3 = 0x02CB,
00453     KPtiPinyinTone4 = 0x02D9
00454     };
00455 
00456 // Tone marks for zhuyin input
00457 enum
00458     {
00459     KPtiZhuyinTone0 = 0x0020,
00460     KPtiZhuyinTone1 = 0x02CA,
00461     KPtiZhuyinTone2 = 0x02C7,
00462     KPtiZhuyinTone3 = 0x02CB,
00463     KPtiZhuyinTone4 = 0x02D9
00464     };
00465 
00466 
00467 class TPtiNumericKeyBinding
00468     {
00469     public:
00470         TUint16 iChar;
00471         TPtiKey iKey;
00472         TPtiTextCase iCase;
00473     };
00474 
00475 #start_since SINCE_3_1_SDK
00476 
00481 typedef struct TRecognitionRangeTag
00482     {
00483     TLanguage iLanguage;
00484     TUint     iSubRange;
00485     } TRecognitionRange;
00486 
00490 enum TRecognitionSubRanges
00491     {
00492     EPtiRangePRCChinese,
00493     EPtiRangeHKChinese,
00494     EPtiRangeTWChinese,
00495     EPtiRangeLatin,
00496     EPtiRangeSymbol,
00497     EPtiRangeNumber
00498 #end_since SINCE_3_1_SDK
00499 #start_since SINCE_3_1_SDK
00500     };
00501 
00505 enum TLatinLetterOrder
00506     {
00507     EUpperFirst,
00508     ELowerFirst
00509     };
00510 #end_since SINCE_3_1_SDK
00511 
00512 #include "PtiDefs.inl"
00513 
00514 // _PTI_DEFS_H
00515 #endif
00516 
00517 // End od file

Copyright © Nokia Corporation 2001-2007
Back to top