fep/frontendprocessor/test/feps/pytable.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 #ifndef __PYTABLE_H__
       
    18 #define __PYTABLE_H__
       
    19 
       
    20 
       
    21 #if !defined(__E32STD_H__)
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 
       
    25 #if !defined(__E32BASE_H__)
       
    26 #include <e32base.h>
       
    27 #endif
       
    28 
       
    29 #if !defined(__W32STD_H__)
       
    30 #include <w32std.h>
       
    31 #endif
       
    32 
       
    33 const TInt KMaxPinyinLength = 15;
       
    34 
       
    35 struct TPinyinCharacterPair
       
    36 	{
       
    37 public:
       
    38 	const TUint16 *iPinYin;
       
    39 	TInt iPinYinLength;
       
    40 	TInt iCharacterCount;
       
    41 	const TInt *iCharacterArray;
       
    42 	};
       
    43 struct TPinyinTable
       
    44 	{
       
    45 public:
       
    46 	TInt iPinyinCharacterPairCount;
       
    47 	const TPinyinCharacterPair *iPairArray;
       
    48 	};
       
    49 
       
    50 class CPinyinSelector
       
    51 	{
       
    52 public:
       
    53 	enum
       
    54 	{
       
    55 	EInvalidChar = 0xFFFFFFFF
       
    56 	};
       
    57 public:
       
    58 	CPinyinSelector();
       
    59 	TBool SetPinyin(const TDesC *aCurrentPinyin, TInt aIndexInCurrentPinyin=-1);
       
    60 
       
    61 	// by character
       
    62 	TInt NextCharacter();
       
    63 	TInt PreviousCharacter();
       
    64 	
       
    65 	// by page
       
    66 	void SetPageSize(TInt nPageSize);
       
    67 	TInt NextPage();			// return first character in next page
       
    68 	TInt PreviousPage();		// return first character in previous page
       
    69 	TInt CharacterInCurrentPage(TInt aIndex);	// return "aIndex"th character in current page. aIndex range from 0
       
    70 	void GetPageDescriptor(TBuf<200> *page) const;
       
    71 	
       
    72 	void Reset();
       
    73 	TBool IsReseted();
       
    74 
       
    75 public:
       
    76 	static TBool IsValidPinyinChar(TInt aChar);
       
    77 
       
    78 private:
       
    79 	// current
       
    80 	const TPinyinCharacterPair *iCurrentPinyin;
       
    81 	TInt iIndexInCurrentPinyin;
       
    82 	TInt iPageSize;		// character count in a page
       
    83 	TBool iReset;
       
    84 private:
       
    85 	// the table
       
    86 	const TPinyinTable *iPinyinTable;
       
    87 	};
       
    88 
       
    89 GLREF_D const TPinyinTable pinyinTable;
       
    90 
       
    91 #endif	// __PYTABLE_H__