|
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 #include "peninputsplititutconverter.h" |
|
18 |
|
19 const TUint16 KSegment = 0x0020; |
|
20 |
|
21 // ============================ MEMBER FUNCTIONS ============================= |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // TItutDataConverter::AnyToInt |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 TInt TItutDataConverter::AnyToInt(TAny* aOriginal) |
|
28 { |
|
29 return *(reinterpret_cast<TInt*>(aOriginal)); |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // TItutDataConverter::AnyToRect |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 TRect TItutDataConverter::AnyToRect(TAny* aOriginal) |
|
37 { |
|
38 return *(reinterpret_cast<TRect*>(aOriginal)); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // TItutDataConverter::AnyToFont |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CFont* TItutDataConverter::AnyToFont(TAny* aOriginal) |
|
46 { |
|
47 return reinterpret_cast<CFont*>(aOriginal); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // TItutDataConverter::AnyToPoint |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 TPoint TItutDataConverter::AnyToPoint(TAny* aOriginal) |
|
55 { |
|
56 return *(reinterpret_cast<TPoint*>(aOriginal)); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // TItutDataConverter::AnyToRgb |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 TRgb TItutDataConverter::AnyToRgb(TAny* aOriginal) |
|
64 { |
|
65 return *(reinterpret_cast<TRgb*>(aOriginal)); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // TItutDataConverter::AnyToSize |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 TSize TItutDataConverter::AnyToSize(TAny* aOriginal) |
|
73 { |
|
74 return *(reinterpret_cast<TSize*>(aOriginal)); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // TItutDataConverter::AnyToRptrArray |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 RPointerArray<HBufC>& TItutDataConverter::AnyToRptrArray(TAny* aOriginal) |
|
82 { |
|
83 return *(reinterpret_cast<RPointerArray<HBufC>*>(aOriginal)); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // TItutDataConverter::AnyToRectArray |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 RArray<TRect>& TItutDataConverter::AnyToRectArray(TAny* aOriginal) |
|
91 { |
|
92 return *(reinterpret_cast<RArray<TRect>*>(aOriginal)); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // TItutDataConverter::AnyToTextLine |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 TAknTextLineLayout TItutDataConverter::AnyToTextLine(TAny* aOriginal) |
|
100 { |
|
101 return *(reinterpret_cast<TAknTextLineLayout*>(aOriginal)); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // TItutDataConverter::ConvertChnPhraseCandidateL |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void TItutDataConverter::ConvertChnPhraseCandidateL(const TDesC& aSource, |
|
109 RPointerArray<HBufC>& aList) |
|
110 { |
|
111 TInt start = 0; |
|
112 TInt length = 0; |
|
113 |
|
114 for (TInt ii = 0; ii < aSource.Length(); ii++) |
|
115 { |
|
116 if (aSource[ii] == KSegment) |
|
117 { |
|
118 TPtrC segment(aSource.Ptr() + start, length); |
|
119 aList.AppendL(segment.AllocL()); |
|
120 start += (length + 1); |
|
121 length = 0; |
|
122 } |
|
123 else |
|
124 { |
|
125 length++; |
|
126 } |
|
127 } |
|
128 |
|
129 if (length) |
|
130 { |
|
131 TPtrC segm(aSource.Ptr() + start, length); |
|
132 aList.AppendL(segm.AllocL()); |
|
133 } |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // TItutDataConverter::ConvertNonPhraseCandidateL |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 void TItutDataConverter::ConvertNonPhraseCandidateL(const TDesC& aSource, |
|
141 RPointerArray<HBufC>& aList) |
|
142 { |
|
143 TBuf<1> str; |
|
144 for (TInt ii = 0; ii < aSource.Length(); ii++) |
|
145 { |
|
146 str.Zero(); |
|
147 str.Append(aSource[ii]); |
|
148 aList.AppendL(str.AllocL()); |
|
149 } |
|
150 } |
|
151 |
|
152 // End Of File |