00001 /* 00002 * ============================================================================ 00003 * Name : PtiLanguageDatabase.h 00004 * Part of : PtiEngine 00005 * Description: Language database class declaration. 00006 * Version: 00007 * 00008 * Copyright © 2005-2007 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_LANGUAGE_DATABASE_H 00020 #define _PTI_LANGUAGE_DATABASE_H 00021 00022 // INCLUDES 00023 #include <badesca.h> 00024 #include "PtiDefs.h" 00025 00026 // For accessing keyboard data through LangData() method. If aIndex 00027 // parameter is higher than KKdbThreshold client is accessing 00028 // keyboard data instead of ldb data. 00029 const TInt KKdbThreshold = 500; 00030 00031 // For accessing key bindings through LangData() method. If aIndex 00032 // parameter is higher than KKdbThreshold client is accessing 00033 // key bindings data instead of ldb or kdb data. 00034 const TInt KKdbBindingThreshold = 2500; 00035 00036 const TInt KOpaqueDataLen = 8; 00037 00038 00039 // 00040 // TPtiLangDatabaseMapping 00041 // 00042 class TPtiLangDatabaseMapping 00043 { 00044 public: 00045 TInt iUid; 00046 TInt iLangCode; 00047 }; 00048 00049 // 00050 // TPtiLangDatabaseMappingOpaque 00051 // 00052 class TPtiLangDatabaseMappingOpaque 00053 { 00054 public: 00055 TInt iUid; 00056 TInt iLangCode; 00057 TBuf8<KOpaqueDataLen> iOpaque; 00058 }; 00059 00060 00061 // 00062 // TPtiLangDatabaseOpaqueBinding 00063 // 00064 class TPtiLangDatabaseOpaqueBinding 00065 { 00066 public: 00067 TInt iUid; 00068 TBuf8<KOpaqueDataLen> iOpaque; 00069 }; 00070 00071 00077 class MPtiLanguageDatabase 00078 { 00079 public: 00086 virtual TInt CoreUID() const = 0; 00087 00094 virtual TInt NumLanguages() const = 0; 00095 00105 virtual TInt LanguageCode(TInt aIndex) const = 0; 00106 00115 virtual TInt SubLanguageCode(TInt aIndex) const = 0; 00116 00125 virtual TInt8* LangData(TInt aIndex) const = 0; 00126 00136 virtual TInt8* LangData(TInt aIndex, TAny* aNativeParams) const = 0; 00137 00144 virtual TInt8* PinyinPhraseData() const = 0; 00145 00152 virtual TInt8* ZhuyinPhraseData() const = 0; 00153 00161 virtual TInt NativeId(TInt aIndex) const = 0; 00162 }; 00163 00164 00168 class CPtiLanguageDatabase : public CBase, public MPtiLanguageDatabase 00169 { 00170 public: 00178 IMPORT_C static CPtiLanguageDatabase* CreateDatabaseL(TUid aImplUid); 00179 00188 IMPORT_C static CArrayFix<TInt>* ListDatabasesLC(TInt aCoreUid); 00189 00198 IMPORT_C static TInt LanguageCodeForUid(TInt aUid); 00199 00210 IMPORT_C static TInt CreateMappingTableL(TInt aCoreUid, RArray<TPtiLangDatabaseMapping>& aResult); 00211 IMPORT_C static TInt CreateMappingTableWithOpaqueL(TInt aCoreUid, RArray<TPtiLangDatabaseMappingOpaque>& aResult); 00212 00213 public: 00214 IMPORT_C ~CPtiLanguageDatabase(); 00215 00216 public: // Empty default implementations. 00217 IMPORT_C TInt CoreUID() const; 00218 IMPORT_C TInt NumLanguages() const; 00219 IMPORT_C TInt LanguageCode(TInt aIndex) const; 00220 IMPORT_C TInt SubLanguageCode(TInt aIndex) const; 00221 IMPORT_C TInt8* LangData(TInt aIndex) const; 00222 IMPORT_C TInt8* LangData(TInt aIndex, TAny* aNativeParams) const; 00223 IMPORT_C TInt8* PinyinPhraseData() const; 00224 IMPORT_C TInt8* ZhuyinPhraseData() const; 00225 IMPORT_C TInt NativeId(TInt aIndex) const; 00226 00227 public: 00228 inline void SetDestructorKeyId(TInt aDtorKeyId); 00229 00230 private: 00231 TInt iDtorKeyId; 00232 TInt Reserved_1; 00233 }; 00234 00235 00236 // --------------------------------------------------------------------------- 00237 // CPtiLanguageDatabase::SetDestructorKeyId 00238 // 00239 // --------------------------------------------------------------------------- 00240 // 00241 inline void CPtiLanguageDatabase::SetDestructorKeyId(TInt aDtorKeyId) 00242 { 00243 iDtorKeyId = aDtorKeyId; 00244 } 00245 00246 #endif // _PTI_LANGUAGE_DATABASE_H 00247 00248 // End of file 00249 00250