inputmethods_plat/ptiengine_key_definations_api/inc/PtiKeyboardDatabase.h
changeset 0 eb1f2e154e89
child 12 5e18d8c489d6
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:               Language database class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 
       
    31 #ifndef _PTI_KEYBOARD_DATABASE_H
       
    32 #define _PTI_KEYBOARD_DATABASE_H
       
    33 
       
    34 // INCLUDES
       
    35 #include <badesca.h> 
       
    36 #include "PtiDefs.h"
       
    37 
       
    38 const TInt KKdbOpaqueDataLen = 8;
       
    39 		
       
    40 //
       
    41 // TPtiLangDatabaseMappingOpaque
       
    42 //
       
    43 class TPtiKeyboardDatabaseMappingOpaque
       
    44 	{
       
    45 	public:
       
    46 		TInt iUid;	
       
    47 		TBuf8<KKdbOpaqueDataLen> iOpaque;
       
    48 	};	
       
    49 	
       
    50 /**
       
    51 * An interface class for wrapping keyboard data. This is used for separating
       
    52 * keyboard data from language data for some predictive input implementations.
       
    53 */	
       
    54 class MPtiKeyboardDatabase
       
    55 	{
       
    56 	public:
       
    57 								
       
    58 		/**
       
    59 		* Returns pointer to language data. The meaning of the data in array depends
       
    60 		* on the core object implementation.
       
    61 		*
       
    62 		* @since S60 V5.0
       
    63 		* @param aIndex Index of language implementation.		
       
    64 		* @param aNativeParams Core object related extra parameters.
       
    65 		* @return Pointer to language data array.
       
    66 		*/
       
    67 		virtual TInt8* KdbData(TInt aNativeKdbId, TAny* aNativeParams) const = 0;
       
    68 		
       
    69 		/**
       
    70 		* Returns pointer to language data. The meaning of the data in array depends
       
    71 		* on the core object implementation.
       
    72 		*
       
    73 		* @since S60 V5.0			
       
    74 		* @return Language code for kdb data implemented in this keyboard database.
       
    75 		*/
       
    76         virtual TInt LanguageCode() const = 0;			
       
    77         
       
    78    		/**
       
    79 		* Returns pointer to scan code binding table. The array contains Symbian OS 
       
    80 		* scan code calues and the order of array items specifies bindings
       
    81 		* between S60 scan codes and kdb key entries.
       
    82 		*
       
    83 		* @since S60 V5.0
       
    84 		* @param aKeyboardType Keyboard type for binding table.			
       
    85 		* @param aNumEntries   Number of binding array entries will be stored here.
       
    86 		* @return Pointer to scan code binding table.
       
    87 		*/
       
    88         virtual TUint8* ScanBindingTable(TPtiKeyboardType aKeyboardType,
       
    89                                          TInt& aNumEntries) const = 0;	
       
    90                                          
       
    91 	    /**
       
    92 		* Returns engine specific native language id code.
       
    93 		*
       
    94 		* @since S60 V5.0			
       
    95 		* @return Engine vendor specified language id.
       
    96 		*/
       
    97         virtual TInt NativeId() const = 0;		                                         		
       
    98 
       
    99         // Reserved vtable entries.		
       
   100 		virtual void Reserved_1() = 0;
       
   101 		virtual void Reserved_2() = 0;						
       
   102 	};
       
   103 
       
   104 
       
   105 /**
       
   106 * Default implementation for MPtiLanguageDatabase interface.
       
   107 */
       
   108 class CPtiKeyboardDatabase : public CBase, public MPtiKeyboardDatabase
       
   109 	{
       
   110 	public: 				
       
   111 		// Empty implementations for MPtiKeyboardDatabase			
       
   112 		IMPORT_C TInt8* KdbData(TInt aNativeKdbId, TAny* aNativeParams) const;
       
   113 		IMPORT_C TInt LanguageCode() const;
       
   114         IMPORT_C TInt NativeId() const;			
       
   115 		
       
   116 		IMPORT_C void Reserved_1();
       
   117 		IMPORT_C void Reserved_2();
       
   118 																	
       
   119 	private:
       
   120 		TInt iDtorKeyId;
       
   121 		TInt iImplementationUid;
       
   122 		TInt Reserved;
       
   123 	};
       
   124 
       
   125 
       
   126 /**
       
   127 * Keybaord database factory class.
       
   128 */
       
   129 class CPtiKeyboardDatabaseFactory : public CBase
       
   130     {
       
   131     public:     
       
   132     	/**
       
   133 		* Fills given array with available keyboard data implemenations and their
       
   134 		* opaque data fields.
       
   135 		*
       
   136 		* @since S60 V5.0
       
   137 		* @param aInterfaceUid An interface uid for kdb plugins.
       
   138 		* @param aResult Resulting array.
       
   139 		*/
       
   140 		IMPORT_C static TInt CreateMappingTableWithOpaqueL(TInt aInterfaceUid,
       
   141                                                            RArray<TPtiKeyboardDatabaseMappingOpaque>& aResult);					
       
   142 		              
       
   143     	/**
       
   144 		* Creates a keyboard database factory instance for given implementation uid.
       
   145 		*
       
   146 		* @since S60 V5.0
       
   147 		* @param aImplUid An implemenation uid for keyboard database factory to be created.
       
   148 		* @return Pointer to key map data factory interface.
       
   149 		*         NULL if not found.
       
   150 		*/			
       
   151 		IMPORT_C static CPtiKeyboardDatabaseFactory* CreateImplementationL(const TUid aImplUid);
       
   152 		
       
   153 		/**
       
   154 		* Fills given list with implementation uids of all found key map data
       
   155 		* factory implementations.
       
   156 		*
       
   157 		* @since S60 V5.0
       
   158 		* @param aResult An array to be filled with uids.
       
   159 		*/			
       
   160 		IMPORT_C static void ListImplementationsL(TInt aCoreUid, RArray<TInt>& aResult);
       
   161         	
       
   162         /**
       
   163         * Returns keymap data object for given language.
       
   164         *
       
   165         * @since S60 V5.0
       
   166         * @param aLanguageCode Languace code for requested data.
       
   167         * @return Pointer to keymap data obejct.
       
   168         *         NULL if no data available for given language.
       
   169         */        	
       
   170         virtual MPtiKeyboardDatabase* KeyMapDataForLanguageL(TInt aLanguageCode) = 0;
       
   171         
       
   172         /**
       
   173         * Lists all languages supported by this data factory.
       
   174         * 
       
   175         * @since S60 V5.0
       
   176         * @param aResult List instance for storing results.
       
   177         */
       
   178         virtual void ListLanguagesL(RArray<TInt>& aResult) = 0;
       
   179         
       
   180         /**
       
   181         * Resturns a bit vector indicating which keyboard types are supported
       
   182         * by given language.
       
   183         *
       
   184         * @since S60 V5.0
       
   185         * @param aLanguage Requested language
       
   186         * @return A combination of flags indicating which keyboard types are supported.
       
   187         */        
       
   188         virtual TUint32 SupportedKeyboardTypes(TInt aLanguage) = 0;
       
   189         
       
   190     	IMPORT_C ~CPtiKeyboardDatabaseFactory();
       
   191 
       
   192         IMPORT_C virtual void Reserved_1();	    
       
   193 	    IMPORT_C virtual void Reserved_2();
       
   194 	    
       
   195     public:	    
       
   196 	    inline TInt ImplementationUid() const;	 
       
   197 	    
       
   198 	private:	  		
       
   199 		inline void SetDestructorKeyId(TInt aUid);
       
   200 		inline void SetImplementationUid(TInt aUid);
       
   201     
       
   202     private:
       
   203     	TInt iDTorId;
       
   204     	TInt iImplUid;			        
       
   205         TInt iReserved;	
       
   206     };
       
   207 
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 // CPtiKeybaordDatabaseFactory::SetDestructorKeyId
       
   211 // 
       
   212 // ---------------------------------------------------------------------------
       
   213 // 	
       
   214 inline void CPtiKeyboardDatabaseFactory::SetDestructorKeyId(TInt aDtorKeyId)
       
   215 	{
       
   216 	iDTorId = aDtorKeyId;
       
   217 	}
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CPtiKeybaordDatabaseFactory::SetImplementationUid
       
   221 // 
       
   222 // ---------------------------------------------------------------------------
       
   223 // 	
       
   224 inline void CPtiKeyboardDatabaseFactory::SetImplementationUid(TInt aImplUid)
       
   225     {
       
   226     iImplUid = aImplUid;
       
   227     }
       
   228     
       
   229 // ---------------------------------------------------------------------------
       
   230 // CPtiKeybaordDatabaseFactory::ImplementationUid
       
   231 // 
       
   232 // ---------------------------------------------------------------------------
       
   233 // 	
       
   234 inline TInt CPtiKeyboardDatabaseFactory::ImplementationUid() const
       
   235     {
       
   236     return iImplUid;
       
   237     }    
       
   238 
       
   239 #endif // _PTI_KEYBOARD_DATABASE_H
       
   240 
       
   241 // End of file
       
   242 
       
   243