author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0"" |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: Language database class declaration. |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
|
williamr@2 | 20 |
|
williamr@2 | 21 |
|
williamr@2 | 22 |
|
williamr@2 | 23 |
|
williamr@2 | 24 |
|
williamr@2 | 25 |
|
williamr@2 | 26 |
|
williamr@2 | 27 |
|
williamr@2 | 28 |
|
williamr@2 | 29 |
|
williamr@2 | 30 |
|
williamr@2 | 31 |
#ifndef _PTI_LANGUAGE_DATABASE_H |
williamr@2 | 32 |
#define _PTI_LANGUAGE_DATABASE_H |
williamr@2 | 33 |
|
williamr@2 | 34 |
// INCLUDES |
williamr@2 | 35 |
#include <badesca.h> |
williamr@2 | 36 |
#include "PtiDefs.h" |
williamr@2 | 37 |
|
williamr@2 | 38 |
// For accessing keyboard data through LangData() method. If aIndex |
williamr@2 | 39 |
// parameter is higher than KKdbThreshold client is accessing |
williamr@2 | 40 |
// keyboard data instead of ldb data. |
williamr@2 | 41 |
const TInt KKdbThreshold = 500; |
williamr@2 | 42 |
|
williamr@2 | 43 |
// For accessing key bindings through LangData() method. If aIndex |
williamr@2 | 44 |
// parameter is higher than KKdbThreshold client is accessing |
williamr@2 | 45 |
// key bindings data instead of ldb or kdb data. |
williamr@2 | 46 |
const TInt KKdbBindingThreshold = 2500; |
williamr@2 | 47 |
|
williamr@2 | 48 |
const TInt KOpaqueDataLen = 8; |
williamr@2 | 49 |
|
williamr@2 | 50 |
|
williamr@2 | 51 |
// |
williamr@2 | 52 |
// TPtiLangDatabaseMapping |
williamr@2 | 53 |
// |
williamr@2 | 54 |
class TPtiLangDatabaseMapping |
williamr@2 | 55 |
{ |
williamr@2 | 56 |
public: |
williamr@2 | 57 |
TInt iUid; |
williamr@2 | 58 |
TInt iLangCode; |
williamr@2 | 59 |
}; |
williamr@2 | 60 |
|
williamr@2 | 61 |
// |
williamr@2 | 62 |
// TPtiLangDatabaseMappingOpaque |
williamr@2 | 63 |
// |
williamr@2 | 64 |
class TPtiLangDatabaseMappingOpaque |
williamr@2 | 65 |
{ |
williamr@2 | 66 |
public: |
williamr@2 | 67 |
TInt iUid; |
williamr@2 | 68 |
TInt iLangCode; |
williamr@2 | 69 |
TBuf8<KOpaqueDataLen> iOpaque; |
williamr@2 | 70 |
}; |
williamr@2 | 71 |
|
williamr@2 | 72 |
|
williamr@2 | 73 |
// |
williamr@2 | 74 |
// TPtiLangDatabaseOpaqueBinding |
williamr@2 | 75 |
// |
williamr@2 | 76 |
class TPtiLangDatabaseOpaqueBinding |
williamr@2 | 77 |
{ |
williamr@2 | 78 |
public: |
williamr@2 | 79 |
TInt iUid; |
williamr@2 | 80 |
TBuf8<KOpaqueDataLen> iOpaque; |
williamr@2 | 81 |
}; |
williamr@2 | 82 |
|
williamr@2 | 83 |
|
williamr@2 | 84 |
/** |
williamr@2 | 85 |
* An interface class for wrapping language data. Core object may use this |
williamr@2 | 86 |
* interface for accessing language data (but it is also ok to use any other |
williamr@2 | 87 |
* way, since it is part of core object's internal implementation). |
williamr@2 | 88 |
*/ |
williamr@2 | 89 |
class MPtiLanguageDatabase |
williamr@2 | 90 |
{ |
williamr@2 | 91 |
public: |
williamr@2 | 92 |
/** |
williamr@2 | 93 |
* Implementation UID for core object owning this data. |
williamr@2 | 94 |
* |
williamr@2 | 95 |
* @since S60 V3.0 |
williamr@2 | 96 |
* @return Implementation Uid value of owning core object. |
williamr@2 | 97 |
*/ |
williamr@2 | 98 |
virtual TInt CoreUID() const = 0; |
williamr@2 | 99 |
|
williamr@2 | 100 |
/** |
williamr@2 | 101 |
* Number on languages implemented in this database. |
williamr@2 | 102 |
* |
williamr@2 | 103 |
* @since S60 V3.0 |
williamr@2 | 104 |
* return Number languages implemented in this database. |
williamr@2 | 105 |
*/ |
williamr@2 | 106 |
virtual TInt NumLanguages() const = 0; |
williamr@2 | 107 |
|
williamr@2 | 108 |
/** |
williamr@2 | 109 |
* Symbian OS language code for language data. |
williamr@2 | 110 |
* |
williamr@2 | 111 |
* @since S60 V3.0 |
williamr@2 | 112 |
* @param aIndex Index of language implementation (in case one database holds data |
williamr@2 | 113 |
* for several languages). |
williamr@2 | 114 |
* @return Symbian OS language code for language data identified by aIndex. |
williamr@2 | 115 |
* 0, if aIndex is greater than number of languages in this database. |
williamr@2 | 116 |
*/ |
williamr@2 | 117 |
virtual TInt LanguageCode(TInt aIndex) const = 0; |
williamr@2 | 118 |
|
williamr@2 | 119 |
/** |
williamr@2 | 120 |
* Returns sub-language code. The meaning of this value depends on core object |
williamr@2 | 121 |
* implementation. Ususally this value is needed for enumerating several dialects |
williamr@2 | 122 |
* that are related to one Symbian OS language constant. |
williamr@2 | 123 |
* |
williamr@2 | 124 |
* @since S60 V3.0 |
williamr@2 | 125 |
* @return Sub-language id. |
williamr@2 | 126 |
*/ |
williamr@2 | 127 |
virtual TInt SubLanguageCode(TInt aIndex) const = 0; |
williamr@2 | 128 |
|
williamr@2 | 129 |
/** |
williamr@2 | 130 |
* Returns pointer to raw language data. |
williamr@2 | 131 |
* on the core object implementation. |
williamr@2 | 132 |
* |
williamr@2 | 133 |
* @since S60 V3.0 |
williamr@2 | 134 |
* @param aIndex Index of language implementation. |
williamr@2 | 135 |
* @return Pointer to language data array. |
williamr@2 | 136 |
*/ |
williamr@2 | 137 |
virtual TInt8* LangData(TInt aIndex) const = 0; |
williamr@2 | 138 |
|
williamr@2 | 139 |
/** |
williamr@2 | 140 |
* Returns pointer to language data. The meaning of the data in array depends |
williamr@2 | 141 |
* on the core object implementation. |
williamr@2 | 142 |
* |
williamr@2 | 143 |
* @since S60 V3.0 |
williamr@2 | 144 |
* @param aIndex Index of language implementation. |
williamr@2 | 145 |
* @param aNativeParams Core object related extra parameters. |
williamr@2 | 146 |
* @return Pointer to language data array. |
williamr@2 | 147 |
*/ |
williamr@2 | 148 |
virtual TInt8* LangData(TInt aIndex, TAny* aNativeParams) const = 0; |
williamr@2 | 149 |
|
williamr@2 | 150 |
/** |
williamr@2 | 151 |
* Returns pointer to PinYin phrase input related data. |
williamr@2 | 152 |
* |
williamr@2 | 153 |
* @since S60 V3.0 |
williamr@2 | 154 |
* @return Pointer to PinYin phrase input data. |
williamr@2 | 155 |
*/ |
williamr@2 | 156 |
virtual TInt8* PinyinPhraseData() const = 0; |
williamr@2 | 157 |
|
williamr@2 | 158 |
/** |
williamr@2 | 159 |
* Returns pointer to ZhuYin phrase input related data. |
williamr@2 | 160 |
* |
williamr@2 | 161 |
* @since S60 V3.0 |
williamr@2 | 162 |
* @return Pointer to ZhuYin phrase input data. |
williamr@2 | 163 |
*/ |
williamr@2 | 164 |
virtual TInt8* ZhuyinPhraseData() const = 0; |
williamr@2 | 165 |
|
williamr@2 | 166 |
/** |
williamr@2 | 167 |
* Returns core object's internal language id value. The meaning of this |
williamr@2 | 168 |
* value depends on core object implementation. |
williamr@2 | 169 |
* |
williamr@2 | 170 |
* @since S60 V3.0 |
williamr@2 | 171 |
* @return Core object internal language id. |
williamr@2 | 172 |
*/ |
williamr@2 | 173 |
virtual TInt NativeId(TInt aIndex) const = 0; |
williamr@2 | 174 |
}; |
williamr@2 | 175 |
|
williamr@2 | 176 |
|
williamr@2 | 177 |
/** |
williamr@2 | 178 |
* Default implementation for MPtiLanguageDatabase interface. |
williamr@2 | 179 |
*/ |
williamr@2 | 180 |
class CPtiLanguageDatabase : public CBase, public MPtiLanguageDatabase |
williamr@2 | 181 |
{ |
williamr@2 | 182 |
public: |
williamr@2 | 183 |
/** |
williamr@2 | 184 |
* Creates a language database instance for given implemenation UID. |
williamr@2 | 185 |
* |
williamr@2 | 186 |
* @since S60 V3.0 |
williamr@2 | 187 |
* @return Pointer to language database instance. |
williamr@2 | 188 |
* NULL if not found. |
williamr@2 | 189 |
*/ |
williamr@2 | 190 |
IMPORT_C static CPtiLanguageDatabase* CreateDatabaseL(TUid aImplUid); |
williamr@2 | 191 |
|
williamr@2 | 192 |
/** |
williamr@2 | 193 |
* Returns a list of all the availbale language databases related to given core object. |
williamr@2 | 194 |
* List will be the topmost item in cleanup stack. |
williamr@2 | 195 |
* |
williamr@2 | 196 |
* @since S60 V3.0 |
williamr@2 | 197 |
* @param aCoreUid Implementation uid for core object. |
williamr@2 | 198 |
* @return Pointer to a list containing implemention uids of language databases. |
williamr@2 | 199 |
*/ |
williamr@2 | 200 |
IMPORT_C static CArrayFix<TInt>* ListDatabasesLC(TInt aCoreUid); |
williamr@2 | 201 |
|
williamr@2 | 202 |
/** |
williamr@2 | 203 |
* Returns Symbian OS language code for the first language in given language database. |
williamr@2 | 204 |
* |
williamr@2 | 205 |
* @since S60 V3.0 |
williamr@2 | 206 |
* @param aUid An implementation uid for language database. |
williamr@2 | 207 |
* @return Symbian OS language constant. |
williamr@2 | 208 |
* 0, if not found. |
williamr@2 | 209 |
*/ |
williamr@2 | 210 |
IMPORT_C static TInt LanguageCodeForUid(TInt aUid); |
williamr@2 | 211 |
|
williamr@2 | 212 |
/** |
williamr@2 | 213 |
* Fills given array with TPtiLangDatabaseMapping bindings for given core object. |
williamr@2 | 214 |
* Items in list bind Symbian OS language code to language database implemantion |
williamr@2 | 215 |
* uid. |
williamr@2 | 216 |
* |
williamr@2 | 217 |
* @since S60 V3.0 |
williamr@2 | 218 |
* @param aCoreUid Core object implemenation uid. |
williamr@2 | 219 |
* @param aResult Resulting list. |
williamr@2 | 220 |
* @return Number of items in aResult. |
williamr@2 | 221 |
*/ |
williamr@2 | 222 |
IMPORT_C static TInt CreateMappingTableL(TInt aCoreUid, RArray<TPtiLangDatabaseMapping>& aResult); |
williamr@2 | 223 |
IMPORT_C static TInt CreateMappingTableWithOpaqueL(TInt aCoreUid, RArray<TPtiLangDatabaseMappingOpaque>& aResult); |
williamr@2 | 224 |
|
williamr@2 | 225 |
public: |
williamr@2 | 226 |
IMPORT_C ~CPtiLanguageDatabase(); |
williamr@2 | 227 |
|
williamr@2 | 228 |
public: // Empty default implementations. |
williamr@2 | 229 |
IMPORT_C TInt CoreUID() const; |
williamr@2 | 230 |
IMPORT_C TInt NumLanguages() const; |
williamr@2 | 231 |
IMPORT_C TInt LanguageCode(TInt aIndex) const; |
williamr@2 | 232 |
IMPORT_C TInt SubLanguageCode(TInt aIndex) const; |
williamr@2 | 233 |
IMPORT_C TInt8* LangData(TInt aIndex) const; |
williamr@2 | 234 |
IMPORT_C TInt8* LangData(TInt aIndex, TAny* aNativeParams) const; |
williamr@2 | 235 |
IMPORT_C TInt8* PinyinPhraseData() const; |
williamr@2 | 236 |
IMPORT_C TInt8* ZhuyinPhraseData() const; |
williamr@2 | 237 |
IMPORT_C TInt NativeId(TInt aIndex) const; |
williamr@2 | 238 |
|
williamr@2 | 239 |
public: |
williamr@2 | 240 |
inline void SetDestructorKeyId(TInt aDtorKeyId); |
williamr@2 | 241 |
|
williamr@2 | 242 |
private: |
williamr@2 | 243 |
TInt iDtorKeyId; |
williamr@2 | 244 |
TInt Reserved_1; |
williamr@2 | 245 |
}; |
williamr@2 | 246 |
|
williamr@2 | 247 |
|
williamr@2 | 248 |
// --------------------------------------------------------------------------- |
williamr@2 | 249 |
// CPtiLanguageDatabase::SetDestructorKeyId |
williamr@2 | 250 |
// |
williamr@2 | 251 |
// --------------------------------------------------------------------------- |
williamr@2 | 252 |
// |
williamr@2 | 253 |
inline void CPtiLanguageDatabase::SetDestructorKeyId(TInt aDtorKeyId) |
williamr@2 | 254 |
{ |
williamr@2 | 255 |
iDtorKeyId = aDtorKeyId; |
williamr@2 | 256 |
} |
williamr@2 | 257 |
|
williamr@2 | 258 |
#endif // _PTI_LANGUAGE_DATABASE_H |
williamr@2 | 259 |
|
williamr@2 | 260 |
// End of file |
williamr@2 | 261 |
|
williamr@2 | 262 |