epoc32/include/mw/ptilanguagedatabase.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/ptilanguagedatabase.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/ptilanguagedatabase.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,262 @@
     1.4 -ptilanguagedatabase.h
     1.5 +/*
     1.6 +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:               Language database class declaration.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +
    1.29 +
    1.30 +
    1.31 +
    1.32 +
    1.33 +
    1.34 +
    1.35 +#ifndef _PTI_LANGUAGE_DATABASE_H
    1.36 +#define _PTI_LANGUAGE_DATABASE_H
    1.37 +
    1.38 +// INCLUDES
    1.39 +#include <badesca.h> 
    1.40 +#include "PtiDefs.h"
    1.41 +
    1.42 +// For accessing keyboard data through LangData() method. If aIndex
    1.43 +// parameter is higher than KKdbThreshold client is accessing 
    1.44 +// keyboard data instead of ldb data.
    1.45 +const TInt KKdbThreshold = 500;
    1.46 +
    1.47 +// For accessing key bindings through LangData() method. If aIndex
    1.48 +// parameter is higher than KKdbThreshold client is accessing 
    1.49 +// key bindings data instead of ldb or kdb data.
    1.50 +const TInt KKdbBindingThreshold = 2500;
    1.51 +
    1.52 +const TInt KOpaqueDataLen = 8;
    1.53 +
    1.54 +
    1.55 +//
    1.56 +// TPtiLangDatabaseMapping
    1.57 +//
    1.58 +class TPtiLangDatabaseMapping
    1.59 +	{
    1.60 +	public:
    1.61 +		TInt iUid;
    1.62 +		TInt iLangCode;
    1.63 +	};	
    1.64 +
    1.65 +//
    1.66 +// TPtiLangDatabaseMappingOpaque
    1.67 +//
    1.68 +class TPtiLangDatabaseMappingOpaque
    1.69 +	{
    1.70 +	public:
    1.71 +		TInt iUid;
    1.72 +		TInt iLangCode;
    1.73 +		TBuf8<KOpaqueDataLen> iOpaque;
    1.74 +	};
    1.75 +	
    1.76 +	
    1.77 +//
    1.78 +// TPtiLangDatabaseOpaqueBinding
    1.79 +//		
    1.80 +class TPtiLangDatabaseOpaqueBinding
    1.81 +    {
    1.82 +    public:
    1.83 +        TInt iUid;
    1.84 +       	TBuf8<KOpaqueDataLen> iOpaque;    
    1.85 +    };	
    1.86 +	
    1.87 +	
    1.88 +/**
    1.89 +* An interface class for wrapping language data. Core object may use this
    1.90 +* interface for accessing language data (but it is also ok to use any other
    1.91 +* way, since it is part of core object's internal implementation).
    1.92 +*/	
    1.93 +class MPtiLanguageDatabase
    1.94 +	{
    1.95 +	public:
    1.96 +		/**
    1.97 +		* Implementation UID for core object owning this data.
    1.98 +		*
    1.99 +		* @since S60 V3.0
   1.100 +		* @return Implementation Uid value of owning core object.
   1.101 +		*/	
   1.102 +		virtual TInt CoreUID() const = 0;
   1.103 +		
   1.104 +		/**
   1.105 +		* Number on languages implemented in this database.
   1.106 +		* 
   1.107 +		* @since S60 V3.0
   1.108 +		* return Number languages implemented in this database.
   1.109 +		*/
   1.110 +		virtual TInt NumLanguages() const = 0;
   1.111 +		
   1.112 +		/**
   1.113 +		* Symbian OS language code for language data.
   1.114 +		*
   1.115 +		* @since S60 V3.0
   1.116 +		* @param aIndex Index of language implementation (in case one database holds data
   1.117 +		*                for several languages).
   1.118 +		* @return Symbian OS language code for language data identified by aIndex. 
   1.119 +		*         0, if aIndex is greater than number of languages in this database.
   1.120 +		*/ 
   1.121 +		virtual TInt LanguageCode(TInt aIndex) const = 0;
   1.122 +		
   1.123 +		/**
   1.124 +		* Returns sub-language code. The meaning of this value depends on core object
   1.125 +		* implementation. Ususally this value is needed for enumerating several dialects
   1.126 +		* that are related to one Symbian OS language constant.
   1.127 +		*
   1.128 +		* @since S60 V3.0
   1.129 +		* @return Sub-language id. 
   1.130 +		*/ 
   1.131 +		virtual TInt SubLanguageCode(TInt aIndex) const = 0;
   1.132 +		
   1.133 +		/**
   1.134 +		* Returns pointer to raw language data. 
   1.135 +		* on the core object implementation.
   1.136 +		*
   1.137 +		* @since S60 V3.0
   1.138 +		* @param aIndex Index of language implementation.
   1.139 +		* @return Pointer to language data array.
   1.140 +		*/
   1.141 +		virtual TInt8* LangData(TInt aIndex) const = 0;
   1.142 +		
   1.143 +		/**
   1.144 +		* Returns pointer to language data. The meaning of the data in array depends
   1.145 +		* on the core object implementation.
   1.146 +		*
   1.147 +		* @since S60 V3.0
   1.148 +		* @param aIndex Index of language implementation.		
   1.149 +		* @param aNativeParams Core object related extra parameters.
   1.150 +		* @return Pointer to language data array.
   1.151 +		*/
   1.152 +		virtual TInt8* LangData(TInt aIndex, TAny* aNativeParams) const = 0;
   1.153 +				
   1.154 +		/**
   1.155 +		* Returns pointer to PinYin phrase input related data.
   1.156 +		*		
   1.157 +		* @since S60 V3.0
   1.158 +		* @return Pointer to PinYin phrase input data.
   1.159 +		*/
   1.160 +		virtual TInt8* PinyinPhraseData() const = 0;
   1.161 +		
   1.162 +		/**
   1.163 +		* Returns pointer to ZhuYin phrase input related data.
   1.164 +		*		
   1.165 +		* @since S60 V3.0
   1.166 +		* @return Pointer to ZhuYin phrase input data.
   1.167 +		*/
   1.168 +		virtual TInt8* ZhuyinPhraseData() const = 0;
   1.169 +		
   1.170 +		/**
   1.171 +		* Returns core object's internal language id value. The meaning of this
   1.172 +		* value depends on core object implementation.
   1.173 +		*
   1.174 +		* @since S60 V3.0
   1.175 +		* @return Core object internal language id.
   1.176 +		*/		
   1.177 +		virtual TInt NativeId(TInt aIndex) const = 0;
   1.178 +	};
   1.179 +
   1.180 +
   1.181 +/**
   1.182 +* Default implementation for MPtiLanguageDatabase interface.
   1.183 +*/
   1.184 +class CPtiLanguageDatabase : public CBase, public MPtiLanguageDatabase
   1.185 +	{
   1.186 +	public: 
   1.187 +		/**
   1.188 +		* Creates a language database instance for given implemenation UID.
   1.189 +		* 
   1.190 +		* @since S60 V3.0
   1.191 +		* @return Pointer to language database instance.
   1.192 +		*         NULL if not found. 
   1.193 +		*/
   1.194 +		IMPORT_C static CPtiLanguageDatabase* CreateDatabaseL(TUid aImplUid);
   1.195 +		
   1.196 +		/**
   1.197 +		* Returns a list of all the availbale language databases related to given core object.
   1.198 +		* List will be the topmost item in cleanup stack.
   1.199 +		*
   1.200 +		* @since S60 V3.0
   1.201 +		* @param aCoreUid Implementation uid for core object.
   1.202 +		* @return Pointer to a list containing implemention uids of language databases.
   1.203 +		*/
   1.204 +		IMPORT_C static CArrayFix<TInt>* ListDatabasesLC(TInt aCoreUid);
   1.205 +		
   1.206 +		/**
   1.207 +		* Returns Symbian OS language code for the first language in given language database.
   1.208 +		*
   1.209 +		* @since S60 V3.0
   1.210 +		* @param aUid An implementation uid for language database.
   1.211 +		* @return Symbian OS language constant.
   1.212 +		*         0, if not found.
   1.213 +		*/		
   1.214 +		IMPORT_C static TInt LanguageCodeForUid(TInt aUid);
   1.215 +		
   1.216 +		/**
   1.217 +		* Fills given array with TPtiLangDatabaseMapping bindings for given core object. 
   1.218 +		* Items in list bind Symbian OS language code to language database implemantion
   1.219 +		* uid.
   1.220 +		*
   1.221 +		* @since S60 V3.0
   1.222 +		* @param aCoreUid Core object implemenation uid.
   1.223 +		* @param aResult Resulting list.
   1.224 +		* @return Number of items in aResult.
   1.225 +		*/
   1.226 +		IMPORT_C static TInt CreateMappingTableL(TInt aCoreUid, RArray<TPtiLangDatabaseMapping>& aResult);
   1.227 +		IMPORT_C static TInt CreateMappingTableWithOpaqueL(TInt aCoreUid, RArray<TPtiLangDatabaseMappingOpaque>& aResult);
   1.228 +
   1.229 +	public: 
   1.230 +		IMPORT_C ~CPtiLanguageDatabase();
   1.231 +			
   1.232 +	public: // Empty default implementations.
   1.233 +		IMPORT_C TInt CoreUID() const;
   1.234 +		IMPORT_C TInt NumLanguages() const;
   1.235 +		IMPORT_C TInt LanguageCode(TInt aIndex) const;
   1.236 +		IMPORT_C TInt SubLanguageCode(TInt aIndex) const;
   1.237 +		IMPORT_C TInt8* LangData(TInt aIndex) const;
   1.238 +		IMPORT_C TInt8* LangData(TInt aIndex, TAny* aNativeParams) const;
   1.239 +		IMPORT_C TInt8* PinyinPhraseData() const;
   1.240 +		IMPORT_C TInt8* ZhuyinPhraseData() const;
   1.241 +		IMPORT_C TInt NativeId(TInt aIndex) const;
   1.242 +
   1.243 +	public:
   1.244 +		inline void SetDestructorKeyId(TInt aDtorKeyId);
   1.245 +
   1.246 +	private:
   1.247 +		TInt iDtorKeyId;
   1.248 +		TInt Reserved_1;
   1.249 +	};
   1.250 +
   1.251 +
   1.252 +// ---------------------------------------------------------------------------
   1.253 +// CPtiLanguageDatabase::SetDestructorKeyId
   1.254 +// 
   1.255 +// ---------------------------------------------------------------------------
   1.256 +// 	
   1.257 +inline void CPtiLanguageDatabase::SetDestructorKeyId(TInt aDtorKeyId)
   1.258 +	{
   1.259 +	iDtorKeyId = aDtorKeyId;
   1.260 +	}
   1.261 +
   1.262 +#endif // _PTI_LANGUAGE_DATABASE_H
   1.263 +
   1.264 +// End of file
   1.265 +
   1.266 +