|
1 /* |
|
2 * Copyright (c) 2002-2005 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: the data converter of peninput |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <aknfeppeninputenums.h> |
|
21 |
|
22 // User includes |
|
23 #include "peninputdataconverter.h" |
|
24 |
|
25 // Const |
|
26 const TUint KNumToBuffer = sizeof( TUint )/sizeof( TUint16); |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 // --------------------------------------------------------------------------- |
|
30 // CPeninputDataConverter::CPeninputDataConverter |
|
31 // (other items were commented in a header) |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CPeninputDataConverter::CPeninputDataConverter() |
|
35 { |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CPeninputDataConverter::~CPeninputDataConverter |
|
40 // (other items were commented in a header) |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C CPeninputDataConverter::~CPeninputDataConverter() |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CPeninputDataConverter::IntToDesc |
|
49 // (other items were commented in a header) |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C void CPeninputDataConverter::IntToDesc( TUint aNum, |
|
53 TDes16& aBuf ) |
|
54 { |
|
55 aBuf.Zero(); |
|
56 // Convert integer number to be string |
|
57 aBuf.Append( reinterpret_cast<TUint16*>( &aNum ),KNumToBuffer ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CPeninputDataConverter::CombinationToDesc |
|
62 // (other items were commented in a header) |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void CPeninputDataConverter::CombinationToDesc( |
|
66 TBool aBool, TUint aNum, TDes16& aBuf ) |
|
67 { |
|
68 aBuf.Zero(); |
|
69 // Convert integer number to be string |
|
70 aBuf.Append( reinterpret_cast<TUint16*>( &aBool ), KNumToBuffer ); |
|
71 aBuf.Append( reinterpret_cast<TUint16*>( &aNum ), KNumToBuffer ); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CPeninputDataConverter::AnyToInt |
|
76 // (other items were commented in a header) |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C TInt CPeninputDataConverter::AnyToInt( TAny* aOrginal ) |
|
80 { |
|
81 return *( reinterpret_cast<TInt*>( aOrginal ) ); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CPeninputDataConverter::ShiftCapslockByCase |
|
86 // (other items were commented in a header) |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CPeninputDataConverter::ShiftCapslockByCase( TInt aCase, |
|
90 TInt& aShiftStatus, |
|
91 TInt& aCapsStatus ) |
|
92 { |
|
93 switch ( aCase ) |
|
94 { |
|
95 case ECaseUpper: |
|
96 aShiftStatus = 0; |
|
97 aCapsStatus = 1; |
|
98 break; |
|
99 case ECaseText: |
|
100 aShiftStatus = 1; |
|
101 aCapsStatus = 0; |
|
102 break; |
|
103 case ECaseLower: |
|
104 case ECaseInverseText: |
|
105 case ECaseInvalide: |
|
106 default: |
|
107 aShiftStatus = 0; |
|
108 aCapsStatus = 0; |
|
109 break; |
|
110 } |
|
111 } |
|
112 |
|
113 EXPORT_C TInt CPeninputDataConverter::FepCaseByCaseId( TInt aCaseId ) |
|
114 { |
|
115 switch ( aCaseId ) |
|
116 { |
|
117 case 0: |
|
118 return ECaseLower; |
|
119 case 1: |
|
120 return ECaseText; |
|
121 case 2: |
|
122 return ECaseUpper; |
|
123 case 3: |
|
124 return ECaseInverseText; |
|
125 default: |
|
126 return ECaseLower; |
|
127 } |
|
128 } |