author | mikek |
Fri, 02 Jul 2010 09:53:45 +0100 | |
branch | GCC_SURGE |
changeset 190 | 0d42d469e749 |
parent 90 | 947f0dc9f7a8 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\e32des16.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef __E32DES16_H__ |
|
19 |
#define __E32DES16_H__ |
|
20 |
||
21 |
/** |
|
22 |
@internalComponent |
|
23 |
*/ |
|
24 |
const TUint KMaskDesLength16=0xfffffff; |
|
25 |
||
26 |
class TBufCBase16; |
|
27 |
class TDes16; |
|
28 |
class TPtrC16; |
|
29 |
class TPtr16; |
|
30 |
struct TCollationMethod; |
|
31 |
class HBufC16; |
|
32 |
class HBufC8; |
|
33 |
||
34 |
class TDesC16 |
|
35 |
/** |
|
36 |
@publishedAll |
|
37 |
@released |
|
38 |
||
39 |
Abstract base class for 16-bit descriptors. |
|
40 |
||
41 |
The class encapsulates the data member containing the length of data |
|
42 |
represented by a 16-bit descriptor. It also provides member functions through |
|
43 |
which the data can be accessed, but not modified. |
|
44 |
||
45 |
Data represented by this class is treated as a contiguous set of 16-bit (i.e. |
|
46 |
double byte) values or data items. |
|
47 |
||
48 |
This class cannot be instantiated as it is intended to form part of a class |
|
49 |
hierarchy; it provides a well defined part of descriptor behaviour. It can, |
|
50 |
however, be passed as an argument type for functions which want access to |
|
51 |
descriptor data but do not need to modify that data. |
|
52 |
||
53 |
@see TDesC |
|
54 |
@see TPtrC16 |
|
55 |
*/ |
|
56 |
{ |
|
57 |
public: |
|
58 |
/** |
|
59 |
A value returned by a call to HasPrefixC(). |
|
60 |
||
61 |
@see TDesC16::HasPrefixC |
|
62 |
*/ |
|
63 |
enum TPrefix { |
|
64 |
/** |
|
65 |
Indicates that a supplied prefix can be extended to |
|
66 |
be equivalent to the text at the start of a descriptor. |
|
67 |
*/ |
|
68 |
EIsPrefix = 0, |
|
69 |
/** |
|
70 |
Indicates that a supplied prefix does not seem to be a |
|
71 |
prefix, but it is possible that it could be extended to |
|
72 |
become equivalent to text at the start of this descriptor. |
|
73 |
*/ |
|
74 |
EMightBePrefix = 1, |
|
75 |
/** |
|
76 |
Indicates that a supplied prefix cannot be extended to be |
|
77 |
equivalent to the text at the start of a descriptor. |
|
78 |
*/ |
|
79 |
EIsNotPrefix = 2 |
|
80 |
}; |
|
81 |
public: |
|
82 |
inline TBool operator<(const TDesC16 &aDes) const; |
|
83 |
inline TBool operator<=(const TDesC16 &aDes) const; |
|
84 |
inline TBool operator>(const TDesC16 &aDes) const; |
|
85 |
inline TBool operator>=(const TDesC16 &aDes) const; |
|
86 |
inline TBool operator==(const TDesC16 &aDes) const; |
|
87 |
inline TBool operator!=(const TDesC16 &aDes) const; |
|
88 |
inline const TUint16 &operator[](TInt anIndex) const; |
|
89 |
inline TInt Length() const; |
|
90 |
inline TInt Size() const; |
|
91 |
IMPORT_C const TUint16 *Ptr() const; |
|
92 |
IMPORT_C TInt Compare(const TDesC16 &aDes) const; |
|
93 |
IMPORT_C TInt CompareF(const TDesC16 &aDes) const; |
|
94 |
IMPORT_C TInt CompareC(const TDesC16 &aDes) const; |
|
95 |
IMPORT_C TInt CompareC(const TDesC16& aDes,TInt aMaxLevel,const TCollationMethod* aCollationMethod) const; |
|
96 |
/** |
|
97 |
@internalComponent |
|
98 |
*/ |
|
99 |
IMPORT_C HBufC16* GetNormalizedDecomposedFormL() const; |
|
100 |
/** |
|
101 |
@internalComponent |
|
102 |
*/ |
|
103 |
IMPORT_C HBufC16* GetFoldedDecomposedFormL() const; |
|
104 |
/** |
|
105 |
@internalComponent |
|
106 |
*/ |
|
107 |
IMPORT_C HBufC8* GetCollationKeysL(TInt aMaxLevel,const TCollationMethod* aCollationMethod) const; |
|
108 |
IMPORT_C TInt Match(const TDesC16 &aDes) const; |
|
109 |
IMPORT_C TInt MatchF(const TDesC16 &aDes) const; |
|
110 |
IMPORT_C TInt MatchC(const TDesC16 &aDes) const; |
|
111 |
IMPORT_C TInt MatchC(const TDesC16 &aPattern, TInt aWildChar, TInt aWildSequenceChar, |
|
112 |
TInt aEscapeChar, TInt aMaxLevel = 3, const TCollationMethod* aCollationMethod = NULL) const; |
|
113 |
IMPORT_C TInt MatchC(const TDesC16 &aPattern, const TCollationMethod* aCollationMethod, |
|
114 |
TInt aMaxLevel = 3, TInt aWildChar = '?', TInt aWildSequenceChar = '*', TInt aEscapeChar = 0) const; |
|
115 |
IMPORT_C TInt Locate(TChar aChar) const; |
|
116 |
IMPORT_C TInt LocateReverse(TChar aChar) const; |
|
117 |
IMPORT_C TInt Find(const TDesC16 &aDes) const; |
|
118 |
IMPORT_C TInt Find(const TUint16 *aBuf,TInt aLen) const; |
|
119 |
IMPORT_C TPrefix HasPrefixC(const TDesC16& aPossiblePrefix, TInt aLevel, const TCollationMethod* aCollationMethod) const; |
|
120 |
IMPORT_C TPtrC16 Left(TInt aLength) const; |
|
121 |
IMPORT_C TPtrC16 Right(TInt aLength) const; |
|
122 |
IMPORT_C TPtrC16 Mid(TInt aPos) const; |
|
123 |
IMPORT_C TPtrC16 Mid(TInt aPos,TInt aLength) const; |
|
124 |
IMPORT_C TInt LocateF(TChar aChar) const; |
|
125 |
IMPORT_C TInt LocateReverseF(TChar aChar) const; |
|
126 |
IMPORT_C TInt FindF(const TDesC16 &aDes) const; |
|
127 |
IMPORT_C TInt FindF(const TUint16 *aBuf,TInt aLen) const; |
|
128 |
IMPORT_C TInt FindC(const TDesC16 &aDes) const; |
|
129 |
IMPORT_C TInt FindC(const TUint16 *aBuf,TInt aLen) const; |
|
130 |
IMPORT_C TInt FindC(const TUint16 *aText,TInt aLength, TInt aMaxLevel) const; |
|
131 |
IMPORT_C TInt FindC(const TDesC16 &aDes,TInt &aLengthFound, const TCollationMethod &aMethod,TInt aMaxLevel) const; |
|
132 |
IMPORT_C HBufC16 *Alloc() const; |
|
133 |
IMPORT_C HBufC16 *AllocL() const; |
|
134 |
IMPORT_C HBufC16 *AllocLC() const; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
135 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
// surrogate-aware ones |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
137 |
IMPORT_C TInt FindCorruptSurrogate() const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
IMPORT_C TInt Locate2(TChar aChar) const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
IMPORT_C TInt LocateF2(TChar aChar) const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
IMPORT_C TInt LocateReverse2(TChar aChar) const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
IMPORT_C TInt LocateReverseF2(TChar aChar) const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
142 |
IMPORT_C TInt Match2(const TDesC16 &aDes) const; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
143 |
|
0 | 144 |
protected: |
145 |
inline TDesC16() {} |
|
146 |
inline TDesC16(TInt aType,TInt aLength); |
|
147 |
// delay this for a while |
|
148 |
#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS |
|
149 |
inline TDesC16( const TDesC16& aOther) : iLength(aOther.iLength) {} |
|
150 |
#endif |
|
151 |
// inline ~TDesC16() {} Commented out for the moment since it breaks code |
|
152 |
inline TInt Type() const; |
|
153 |
inline void DoSetLength(TInt aLength); |
|
154 |
IMPORT_C const TUint16 &AtC(TInt anIndex) const; |
|
155 |
private: |
|
156 |
TUint iLength; |
|
157 |
__DECLARE_TEST; |
|
158 |
}; |
|
159 |
// |
|
160 |
class TPtrC16 : public TDesC16 |
|
161 |
/** |
|
162 |
@publishedAll |
|
163 |
@released |
|
164 |
||
165 |
16-bit non-modifiable pointer descriptor. |
|
166 |
||
167 |
This is a descriptor class intended for instantiation and encapsulates a |
|
168 |
pointer to the 16-bit data that it represents. The data can live in ROM or RAM |
|
169 |
and this location is separate from the descriptor object itself. |
|
170 |
||
171 |
The data is intended to be accessed, but not changed, through this descriptor. |
|
172 |
The base class provides the functions through which data is accessed. |
|
173 |
||
174 |
@see TPtr16 |
|
175 |
@see TDesC16 |
|
176 |
@see TDes16 |
|
177 |
@see TBufC16 |
|
178 |
@see TBuf16 |
|
179 |
@see HBufC16 |
|
180 |
*/ |
|
181 |
{ |
|
182 |
public: |
|
183 |
IMPORT_C TPtrC16(); |
|
184 |
IMPORT_C TPtrC16(const TDesC16 &aDes); |
|
185 |
IMPORT_C TPtrC16(const TUint16 *aString); |
|
186 |
IMPORT_C TPtrC16(const TUint16 *aBuf,TInt aLength); |
|
187 |
inline void Set(const TUint16 *aBuf,TInt aLength); |
|
188 |
inline void Set(const TDesC16 &aDes); |
|
189 |
inline void Set(const TPtrC16 &aPtr); |
|
190 |
private: |
|
191 |
TPtrC16& operator=(const TPtrC16 &aDes); |
|
192 |
protected: |
|
193 |
const TUint16 *iPtr; |
|
194 |
private: |
|
195 |
__DECLARE_TEST; |
|
196 |
}; |
|
197 |
// |
|
198 |
class TDes16Overflow |
|
199 |
/** |
|
200 |
@publishedAll |
|
201 |
@released |
|
202 |
||
203 |
An interface that defines an overflow handler for a 16-bit descriptor. |
|
204 |
||
205 |
The interface encapsulates a function that is called when an attempt to append |
|
206 |
formatted text fails because the descriptor is already at its maximum length. |
|
207 |
||
208 |
A derived class must provide an implementation for the Overflow() member function. |
|
209 |
||
210 |
@see TDes16::AppendFormat |
|
211 |
*/ |
|
212 |
{ |
|
213 |
public: |
|
214 |
/** |
|
215 |
Handles the overflow. |
|
216 |
||
217 |
This function is called when the TDes16::AppendFormat() |
|
218 |
variant that takes an overflow handler argument, fails. |
|
219 |
||
220 |
@param aDes The 16-bit modifiable descriptor whose overflow results in the |
|
221 |
call to this overflow handler. |
|
222 |
*/ |
|
223 |
virtual void Overflow(TDes16 &aDes)=0; |
|
224 |
}; |
|
225 |
// |
|
226 |
class TDes16IgnoreOverflow : public TDes16Overflow |
|
227 |
/** |
|
228 |
@publishedAll |
|
229 |
@released |
|
230 |
||
231 |
A derived class which provides an implementation for the Overflow() member function |
|
232 |
where truncation is required. |
|
233 |
||
234 |
@see TDes16::AppendFormat |
|
235 |
*/ |
|
236 |
{ |
|
237 |
public: |
|
238 |
/** |
|
239 |
Handles the overflow. |
|
240 |
||
241 |
This function is called when the TDes16::AppendFormat() |
|
242 |
variant that takes an overflow handler argument, fails. |
|
243 |
||
244 |
@param aDes The 16-bit modifiable descriptor whose overflow results in the |
|
245 |
call to this overflow handler. |
|
246 |
*/ |
|
247 |
IMPORT_C virtual void Overflow(TDes16 &aDes); |
|
248 |
}; |
|
249 |
// |
|
250 |
class TRealFormat; |
|
251 |
class TDes16 : public TDesC16 |
|
252 |
/** |
|
253 |
@publishedAll |
|
254 |
@released |
|
255 |
||
256 |
Abstract base class for 16-bit modifiable descriptors. |
|
257 |
||
258 |
The class encapsulates the data member containing the maximum length of data |
|
259 |
represented by a 16-bit descriptor. It also provides member functions through |
|
260 |
which the data can be modified. |
|
261 |
||
262 |
The class adds to the behaviour provided by TDesC16. |
|
263 |
||
264 |
This class cannot be instantiated as it is intended to form part of a class |
|
265 |
hierarchy; it provides a well defined part of descriptor behaviour. It can, |
|
266 |
however, be passed as an argument type for functions which need to both modify |
|
267 |
and access descriptor data. |
|
268 |
||
269 |
@see TDes |
|
270 |
@see TDesC8 |
|
271 |
@see TDesC16 |
|
272 |
*/ |
|
273 |
{ |
|
274 |
public: |
|
275 |
inline TDes16& operator=(const TUint16 *aString); |
|
276 |
inline TDes16& operator=(const TDesC16 &aDes); |
|
277 |
inline TDes16& operator=(const TDes16 &aDes); |
|
278 |
inline TInt MaxLength() const; |
|
279 |
inline TInt MaxSize() const; |
|
280 |
inline const TUint16 &operator[](TInt anIndex) const; |
|
281 |
inline TUint16 &operator[](TInt anIndex); |
|
282 |
inline TDes16 &operator+=(const TDesC16 &aDes); |
|
283 |
IMPORT_C void Zero(); |
|
284 |
IMPORT_C void SetLength(TInt aLength); |
|
285 |
IMPORT_C void SetMax(); |
|
286 |
IMPORT_C void Copy(const TDesC8 &aDes); |
|
287 |
IMPORT_C void Copy(const TDesC16 &aDes); |
|
288 |
IMPORT_C void Copy(const TUint16 *aBuf,TInt aLength); |
|
289 |
IMPORT_C void Copy(const TUint16 *aString); |
|
290 |
IMPORT_C void Append(TChar aChar); |
|
291 |
IMPORT_C void Append(const TDesC16 &aDes); |
|
292 |
IMPORT_C void Append(const TUint16 *aBuf,TInt aLength); |
|
293 |
IMPORT_C void Fill(TChar aChar); |
|
294 |
IMPORT_C void Fill(TChar aChar,TInt aLength); |
|
295 |
IMPORT_C void FillZ(); |
|
296 |
IMPORT_C void FillZ(TInt aLength); |
|
297 |
IMPORT_C void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth); |
|
298 |
IMPORT_C void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth); |
|
299 |
IMPORT_C TPtr16 LeftTPtr(TInt aLength) const; |
|
300 |
IMPORT_C TPtr16 RightTPtr(TInt aLength) const; |
|
301 |
IMPORT_C TPtr16 MidTPtr(TInt aPos) const; |
|
302 |
IMPORT_C TPtr16 MidTPtr(TInt aPos,TInt aLength) const; |
|
303 |
IMPORT_C const TUint16 *PtrZ(); |
|
304 |
IMPORT_C void CopyF(const TDesC16 &aDes); |
|
305 |
IMPORT_C void CopyC(const TDesC16 &aDes); |
|
306 |
IMPORT_C void CopyLC(const TDesC16 &aDes); |
|
307 |
IMPORT_C void CopyUC(const TDesC16 &aDes); |
|
308 |
IMPORT_C void CopyCP(const TDesC16 &aDes); |
|
309 |
IMPORT_C void AppendFill(TChar aChar,TInt aLength); |
|
310 |
IMPORT_C void ZeroTerminate(); |
|
311 |
IMPORT_C void Swap(TDes16 &aDes); |
|
312 |
IMPORT_C void Fold(); |
|
313 |
IMPORT_C void Collate(); |
|
314 |
IMPORT_C void LowerCase(); |
|
315 |
IMPORT_C void UpperCase(); |
|
316 |
IMPORT_C void Capitalize(); |
|
317 |
IMPORT_C void Repeat(const TDesC16 &aDes); |
|
318 |
IMPORT_C void Repeat(const TUint16 *aBuf,TInt aLength); |
|
319 |
IMPORT_C void Trim(); |
|
320 |
IMPORT_C void TrimAll(); |
|
321 |
IMPORT_C void TrimLeft(); |
|
322 |
IMPORT_C void TrimRight(); |
|
323 |
IMPORT_C void Insert(TInt aPos,const TDesC16 &aDes); |
|
324 |
IMPORT_C void Delete(TInt aPos,TInt aLength); |
|
325 |
IMPORT_C void Replace(TInt aPos,TInt aLength,const TDesC16 &aDes); |
|
326 |
IMPORT_C void Justify(const TDesC16 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill); |
|
327 |
IMPORT_C void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth); |
|
328 |
IMPORT_C void NumUC(TUint64 aVal, TRadix aRadix=EDecimal); |
|
329 |
IMPORT_C TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP; |
|
330 |
IMPORT_C void Num(TInt64 aVal); |
|
331 |
IMPORT_C void Num(TUint64 aVal, TRadix aRadix); |
|
332 |
IMPORT_C void Format(TRefByValue<const TDesC16> aFmt,...); |
|
333 |
IMPORT_C void FormatList(const TDesC16 &aFmt,VA_LIST aList); |
|
334 |
IMPORT_C void AppendJustify(const TDesC16 &Des,TInt aWidth,TAlign anAlignment,TChar aFill); |
|
335 |
IMPORT_C void AppendJustify(const TDesC16 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill); |
|
336 |
IMPORT_C void AppendJustify(const TUint16 *aString,TInt aWidth,TAlign anAlignment,TChar aFill); |
|
337 |
IMPORT_C void AppendJustify(const TUint16 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill); |
|
338 |
IMPORT_C void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth); |
|
339 |
IMPORT_C void AppendNumUC(TUint64 aVal, TRadix aRadix=EDecimal); |
|
340 |
IMPORT_C TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP; |
|
341 |
IMPORT_C void AppendNum(TInt64 aVal); |
|
342 |
IMPORT_C void AppendNum(TUint64 aVal, TRadix aRadix); |
|
343 |
IMPORT_C void AppendFormat(TRefByValue<const TDesC16> aFmt,TDes16Overflow *aOverflowHandler,...); |
|
344 |
IMPORT_C void AppendFormat(TRefByValue<const TDesC16> aFmt,...); |
|
345 |
IMPORT_C void AppendFormatList(const TDesC16 &aFmt,VA_LIST aList,TDes16Overflow *aOverflowHandler=NULL); |
|
346 |
IMPORT_C TPtr8 Collapse(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
347 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
348 |
// surrogate-aware ones |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
349 |
IMPORT_C void Append2(TChar aChar); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
IMPORT_C void Fill2(TChar aChar); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
351 |
IMPORT_C void Fill2(TChar aChar, TInt aLength); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
352 |
IMPORT_C void AppendFill2(TChar aChar, TInt aLength); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
353 |
IMPORT_C void Justify2(const TDesC16 &aDes, TInt aWidth, TAlign anAlignment, TChar aFill); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
354 |
IMPORT_C void AppendJustify2(const TDesC16 &aDes, TInt aWidth, TAlign anAlignment, TChar aFill); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
IMPORT_C void AppendJustify2(const TDesC16 &aDes, TInt aLength, TInt aWidth, TAlign anAlignment, TChar aFill); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
356 |
IMPORT_C void AppendJustify2(const TUint16 *aString, TInt aWidth, TAlign anAlignment, TChar aFill); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
357 |
IMPORT_C void AppendJustify2(const TUint16 *aString, TInt aLength, TInt aWidth, TAlign anAlignment, TChar aFill); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
IMPORT_C void Fold2(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
359 |
IMPORT_C void Collate2(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
360 |
IMPORT_C void LowerCase2(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
IMPORT_C void UpperCase2(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
362 |
IMPORT_C void Capitalize2(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
363 |
IMPORT_C void CopyF2(const TDesC16 &aDes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
364 |
IMPORT_C void CopyC2(const TDesC16 &aDes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
IMPORT_C void CopyLC2(const TDesC16 &aDes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
366 |
IMPORT_C void CopyUC2(const TDesC16 &aDes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
367 |
IMPORT_C void CopyCP2(const TDesC16 &aDes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
|
0 | 369 |
protected: |
370 |
inline TDes16() {} |
|
371 |
inline TDes16(TInt aType,TInt aLength,TInt aMaxLength); |
|
372 |
// delay this for a while |
|
373 |
#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS |
|
374 |
inline TDes16(const TDes16& aOther) : TDesC16(aOther), iMaxLength(aOther.iMaxLength) {} |
|
375 |
#endif |
|
376 |
inline TUint16 *WPtr() const; |
|
377 |
void DoAppendNum(TUint64 aVal, TRadix aRadix, TUint aA, TInt aW); |
|
378 |
void DoPadAppendNum(TInt aLength, TInt aW, const TUint8* aBuf); |
|
379 |
protected: |
|
380 |
TInt iMaxLength; |
|
381 |
__DECLARE_TEST; |
|
382 |
}; |
|
383 |
// |
|
384 |
class TPtr16 : public TDes16 |
|
385 |
/** |
|
386 |
@publishedAll |
|
387 |
@released |
|
388 |
||
389 |
16-bit modifiable pointer descriptor |
|
390 |
||
391 |
This is a descriptor class intended for instantiation and encapsulates a |
|
392 |
pointer to the 16-bit data that it represents. The data can live in ROM or |
|
393 |
RAM and this location is separate from the descriptor object itself. |
|
394 |
||
395 |
The data is intended to be accessed and modified through this descriptor. |
|
396 |
The base classes provide the functions through which the data can be |
|
397 |
manipulated. |
|
398 |
||
399 |
@see TPtr |
|
400 |
@see TPtrC16 |
|
401 |
@see TDesC16 |
|
402 |
@see TDes16 |
|
403 |
@see TBufC16 |
|
404 |
@see TBuf16 |
|
405 |
@see HBufC16 |
|
406 |
*/ |
|
407 |
{ |
|
408 |
public: |
|
409 |
IMPORT_C TPtr16(TUint16 *aBuf,TInt aMaxLength); |
|
410 |
IMPORT_C TPtr16(TUint16 *aBuf,TInt aLength,TInt aMaxLength); |
|
411 |
inline TPtr16& operator=(const TUint16 *aString); |
|
412 |
inline TPtr16& operator=(const TDesC16& aDes); |
|
413 |
inline TPtr16& operator=(const TPtr16& aDes); |
|
414 |
inline void Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength); |
|
415 |
inline void Set(const TPtr16 &aPtr); |
|
416 |
private: |
|
417 |
IMPORT_C TPtr16(TBufCBase16 &aLcb,TInt aMaxLength); |
|
418 |
protected: |
|
419 |
TUint16 *iPtr; |
|
420 |
private: |
|
421 |
friend class TBufCBase16; |
|
422 |
__DECLARE_TEST; |
|
423 |
}; |
|
424 |
// |
|
425 |
class TBufCBase16 : public TDesC16 |
|
426 |
/** |
|
427 |
@internalAll |
|
428 |
*/ |
|
429 |
{ |
|
430 |
protected: |
|
431 |
IMPORT_C TBufCBase16(); |
|
432 |
inline TBufCBase16(TInt aLength); |
|
433 |
IMPORT_C TBufCBase16(const TUint16 *aString,TInt aMaxLength); |
|
434 |
IMPORT_C TBufCBase16(const TDesC16 &aDes,TInt aMaxLength); |
|
435 |
IMPORT_C void Copy(const TUint16 *aString,TInt aMaxLength); |
|
436 |
IMPORT_C void Copy(const TDesC16 &aDes,TInt aMaxLength); |
|
437 |
inline TPtr16 DoDes(TInt aMaxLength); |
|
438 |
inline TUint16 *WPtr() const; |
|
439 |
}; |
|
440 |
// |
|
441 |
class RReadStream; |
|
442 |
class HBufC16 : public TBufCBase16 |
|
443 |
/** |
|
444 |
@publishedAll |
|
445 |
@released |
|
446 |
||
447 |
16-bit heap descriptor. |
|
448 |
||
449 |
This is a descriptor class which provides a buffer of fixed length, allocated |
|
450 |
on the heap, for containing and accessing data. |
|
451 |
||
452 |
The class is intended for instantiation. |
|
453 |
||
454 |
Heap descriptors have the important property that they can be made larger |
|
455 |
or smaller, changing the size of the descriptor buffer. This is achieved by |
|
456 |
reallocating the descriptor. Unlike the behaviour of dynamic buffers, reallocation |
|
457 |
is not done automatically. |
|
458 |
||
459 |
Data is intended to be accessed, but not modified; however, it can be completely |
|
460 |
replaced using the assignment operators of this class. The base class (TDesC16) provides |
|
461 |
the functions through which the data is accessed. |
|
462 |
||
463 |
The descriptor is hosted by a heap cell, and the 16-bit data that the descriptor |
|
464 |
represents is part of the descriptor object itself. The size of the cell depends |
|
465 |
on the requested maximum length of the descriptor buffer when the descriptor |
|
466 |
is created or re-allocated. |
|
467 |
||
468 |
It is important to note that the size of the allocated cell, and, therefore, |
|
469 |
the resulting maximum length of the descriptor, may be larger than requested |
|
470 |
due to the way memory is allocated in Symbian OS. The amount by which this |
|
471 |
may be rounded up depends on the platform and build type. |
|
472 |
||
473 |
@see HBufC |
|
474 |
@see TPtr16 |
|
475 |
@see TDesC16 |
|
476 |
*/ |
|
477 |
{ |
|
478 |
public: |
|
479 |
IMPORT_C static HBufC16 *New(TInt aMaxLength); |
|
480 |
IMPORT_C static HBufC16 *NewL(TInt aMaxLength); |
|
481 |
IMPORT_C static HBufC16 *NewLC(TInt aMaxLength); |
|
482 |
IMPORT_C static HBufC16 *NewMax(TInt aMaxLength); |
|
483 |
IMPORT_C static HBufC16 *NewMaxL(TInt aMaxLength); |
|
484 |
IMPORT_C static HBufC16 *NewMaxLC(TInt aMaxLength); |
|
485 |
IMPORT_C static HBufC16 *NewL(RReadStream &aStream,TInt aMaxLength); |
|
486 |
IMPORT_C static HBufC16 *NewLC(RReadStream &aStream,TInt aMaxLength); |
|
487 |
IMPORT_C HBufC16& operator=(const TUint16 *aString); |
|
488 |
IMPORT_C HBufC16& operator=(const TDesC16 &aDes); |
|
489 |
inline HBufC16& operator=(const HBufC16 &aLcb); |
|
490 |
IMPORT_C HBufC16 *ReAlloc(TInt aMaxLength); |
|
491 |
IMPORT_C HBufC16 *ReAllocL(TInt aMaxLength); |
|
492 |
IMPORT_C TPtr16 Des(); |
|
493 |
private: |
|
494 |
inline HBufC16(TInt aLength); |
|
495 |
private: |
|
496 |
TText16 iBuf[1]; |
|
497 |
__DECLARE_TEST; |
|
498 |
}; |
|
499 |
// |
|
500 |
/** |
|
501 |
@internalComponent |
|
502 |
*/ |
|
503 |
#define __Size16 (sizeof(TInt)/sizeof(TInt16)) |
|
504 |
/** |
|
505 |
@internalComponent |
|
506 |
*/ |
|
507 |
#define __Align16(s) ((((s)+__Size16-1)/__Size16)*__Size16) |
|
508 |
// |
|
509 |
template <TInt S> |
|
510 |
class TBufC16 : public TBufCBase16 |
|
511 |
/** |
|
512 |
@publishedAll |
|
513 |
@released |
|
514 |
||
515 |
16-bit non-modifiable buffer descriptor. |
|
516 |
||
517 |
This is a descriptor class which provides a buffer of fixed length for |
|
518 |
containing and accessing TUint16 data. |
|
519 |
||
520 |
The class intended for instantiation. The 16-bit data that the descriptor |
|
521 |
represents is part of the descriptor object itself. |
|
522 |
||
523 |
The class is templated, based on an integer value which defines the size of |
|
524 |
the descriptor's data area. |
|
525 |
||
526 |
The data is intended to be accessed, but not modified; however, it can be |
|
527 |
completely replaced using the assignment operators of this class. The base |
|
528 |
class provides the functions through which the data is accessed. |
|
529 |
||
530 |
@see TBufC |
|
531 |
@see TDesC16 |
|
532 |
@see TPtr16 |
|
533 |
@see TUint16 |
|
534 |
*/ |
|
535 |
{ |
|
536 |
public: |
|
537 |
inline TBufC16(); |
|
538 |
inline TBufC16(const TUint16 *aString); |
|
539 |
inline TBufC16(const TDesC16 &aDes); |
|
540 |
inline TBufC16<S> &operator=(const TUint16 *aString); |
|
541 |
inline TBufC16<S> &operator=(const TDesC16 &aDes); |
|
542 |
inline TPtr16 Des(); |
|
543 |
protected: |
|
544 |
TUint16 iBuf[__Align16(S)]; |
|
545 |
}; |
|
546 |
// |
|
547 |
class TBufBase16 : public TDes16 |
|
548 |
/** |
|
549 |
@internalAll |
|
550 |
*/ |
|
551 |
{ |
|
552 |
protected: |
|
553 |
IMPORT_C TBufBase16(TInt aMaxLength); |
|
554 |
IMPORT_C TBufBase16(TInt aLength,TInt aMaxLength); |
|
555 |
IMPORT_C TBufBase16(const TUint16* aString,TInt aMaxLength); |
|
556 |
IMPORT_C TBufBase16(const TDesC16& aDes,TInt aMaxLength); |
|
557 |
}; |
|
558 |
// |
|
559 |
template <TInt S> |
|
560 |
class TBuf16 : public TBufBase16 |
|
561 |
/** |
|
562 |
@publishedAll |
|
563 |
@released |
|
564 |
||
565 |
A descriptor class which provides a buffer of fixed length for |
|
566 |
containing, accessing and manipulating TUint16 data. |
|
567 |
||
568 |
The class is intended for instantiation. The 16-bit data that the descriptor |
|
569 |
represents is part of the descriptor object itself. |
|
570 |
||
571 |
The class is templated, based on an integer value which determines the size |
|
572 |
of the data area which is created as part of the buffer descriptor object; |
|
573 |
this is also the maximum length of the descriptor. |
|
574 |
||
575 |
The data is intended to be both accessed and modified. The base classes provide |
|
576 |
the functions through which the data is accessed. |
|
577 |
||
578 |
@see TBuf |
|
579 |
@see TDesC16 |
|
580 |
@see TDes16 |
|
581 |
@see TPtr16 |
|
582 |
*/ |
|
583 |
{ |
|
584 |
public: |
|
585 |
inline TBuf16(); |
|
586 |
inline explicit TBuf16(TInt aLength); |
|
587 |
inline TBuf16(const TUint16* aString); |
|
588 |
inline TBuf16(const TDesC16& aDes); |
|
589 |
inline TBuf16<S>& operator=(const TUint16* aString); |
|
590 |
inline TBuf16<S>& operator=(const TDesC16& aDes); |
|
591 |
inline TBuf16<S>& operator=(const TBuf16<S>& aDes); |
|
592 |
protected: |
|
593 |
TUint16 iBuf[__Align16(S)]; |
|
594 |
}; |
|
595 |
||
596 |
||
597 |
#ifndef __KERNEL_MODE__ |
|
598 |
||
599 |
class RBuf16 : public TDes16 |
|
600 |
/** |
|
601 |
@publishedAll |
|
602 |
@released |
|
603 |
||
604 |
16 bit resizable buffer descriptor. |
|
605 |
||
606 |
The class provides a buffer that contains, accesses and manipulates |
|
607 |
TUint16 data. The buffer itself is on the heap, and is managed by the class. |
|
608 |
||
609 |
Internally, RBuf16 behaves in one of two ways: |
|
610 |
||
611 |
- as a TPtr16 descriptor type, where the buffer just contains data |
|
612 |
- as a pointer to a heap descriptor, an HBufC16* type, where the buffer |
|
613 |
contains both descriptor information and the data. |
|
614 |
||
615 |
Note that the handling of the distinction is hidden from view. |
|
616 |
||
617 |
An RBuf16 object can allocate its own buffer. Alternatively, it can take |
|
618 |
ownership of a pre-existing section of allocated memory, or it can take |
|
619 |
ownership of a pre-existing heap descriptor. It can also reallocate the buffer |
|
620 |
to resize it. Regardless of the way in which the buffer has been allocated, |
|
621 |
the RBuf16 object is responsible for freeing memory when the object itself is closed. |
|
622 |
||
623 |
The class is intended for instantiation. |
|
624 |
||
625 |
The class is derived from TDes16, which means that data can be both accessed |
|
626 |
and modified. The base classes provide the functions through which the data is |
|
627 |
accessed. In addition, an RBuf16 object can be passed to any function that is |
|
628 |
prototyped to take a TDes16 or a TDesC16 type. |
|
629 |
||
630 |
@see TBuf16 |
|
631 |
@see TPtr16 |
|
632 |
@see HBufC16 |
|
633 |
@see TDesC16 |
|
634 |
@see TDes16 |
|
635 |
*/ |
|
636 |
{ |
|
637 |
public: |
|
638 |
IMPORT_C RBuf16(); |
|
639 |
IMPORT_C explicit RBuf16(HBufC16* aHBuf); |
|
640 |
inline RBuf16& operator=(const TUint16* aString); |
|
641 |
inline RBuf16& operator=(const TDesC16& aDes); |
|
642 |
inline RBuf16& operator=(const RBuf16& aDes); |
|
643 |
IMPORT_C void Assign(const RBuf16& aRBuf); |
|
644 |
IMPORT_C void Assign(TUint16 *aHeapCell,TInt aMaxLength); |
|
645 |
IMPORT_C void Assign(TUint16 *aHeapCell,TInt aLength,TInt aMaxLength); |
|
646 |
IMPORT_C void Assign(HBufC16* aHBuf); |
|
647 |
IMPORT_C void Swap(RBuf16& aRBuf); |
|
648 |
IMPORT_C TInt Create(TInt aMaxLength); |
|
649 |
IMPORT_C void CreateL(TInt aMaxLength); |
|
650 |
IMPORT_C TInt CreateMax(TInt aMaxLength); |
|
651 |
IMPORT_C void CreateMaxL(TInt aMaxLength); |
|
652 |
inline void CreateL(RReadStream &aStream,TInt aMaxLength); |
|
653 |
IMPORT_C TInt Create(const TDesC16& aDes); |
|
654 |
IMPORT_C void CreateL(const TDesC16& aDes); |
|
655 |
IMPORT_C TInt Create(const TDesC16& aDes,TInt aMaxLength); |
|
656 |
IMPORT_C void CreateL(const TDesC16& aDes,TInt aMaxLength); |
|
657 |
IMPORT_C TInt ReAlloc(TInt aMaxLength); |
|
658 |
IMPORT_C void ReAllocL(TInt aMaxLength); |
|
659 |
IMPORT_C void Close(); |
|
660 |
IMPORT_C void CleanupClosePushL(); |
|
661 |
||
662 |
protected: |
|
663 |
IMPORT_C RBuf16(TInt aType,TInt aLength,TInt aMaxLength); |
|
664 |
RBuf16(const RBuf16&); // Outlaw copy construction |
|
665 |
union |
|
666 |
{ |
|
667 |
TUint16* iEPtrType; //Pointer to data used when RBuf is of EPtr type |
|
668 |
HBufC16* iEBufCPtrType; //Pointer to data used when RBuf is of EBufCPtr type |
|
669 |
}; |
|
670 |
__DECLARE_TEST; |
|
671 |
}; |
|
672 |
||
673 |
#endif //__KERNEL_MODE__ |
|
674 |
||
675 |
||
676 |
/** |
|
677 |
@publishedAll |
|
678 |
@released |
|
679 |
||
680 |
Value reference used in operator TLitC16::__TRefDesC16() |
|
681 |
||
682 |
@see TRefByValue |
|
683 |
*/ |
|
684 |
typedef TRefByValue<const TDesC16> __TRefDesC16; |
|
685 |
||
686 |
||
687 |
||
688 |
||
689 |
template <TInt S> |
|
690 |
class TLitC16 |
|
691 |
/** |
|
692 |
@publishedAll |
|
693 |
@released |
|
694 |
||
695 |
Encapsulates literal text. |
|
696 |
||
697 |
This is always constructed using an _LIT16 macro. |
|
698 |
||
699 |
This class is build independent; i.e. an explicit 16-bit build variant |
|
700 |
is generated for both a non-Unicode build and a Unicode build. |
|
701 |
||
702 |
The class has no explicit constructors. |
|
703 |
||
704 |
@see _LIT16 |
|
705 |
*/ |
|
706 |
{ |
|
707 |
public: |
|
708 |
inline const TDesC16* operator&() const; |
|
709 |
inline operator const TDesC16&() const; |
|
710 |
inline const TDesC16& operator()() const; |
|
711 |
inline operator const __TRefDesC16() const; |
|
712 |
public: |
|
713 |
#if defined(__GCC32__) |
|
714 |
/** |
|
715 |
@internalComponent |
|
716 |
*/ |
|
717 |
typedef wchar_t __TText; |
|
718 |
#elif defined(__VC32__) |
|
719 |
/** |
|
720 |
@internalComponent |
|
721 |
*/ |
|
722 |
typedef TUint16 __TText; |
|
723 |
#elif defined(__CW32__) |
|
724 |
/** |
|
725 |
@internalComponent |
|
726 |
*/ |
|
727 |
typedef TUint16 __TText; |
|
728 |
#elif !defined(__TText_defined) |
|
729 |
#error no typedef for __TText |
|
730 |
#endif |
|
731 |
public: |
|
732 |
/** |
|
733 |
@internalComponent |
|
734 |
*/ |
|
735 |
TUint iTypeLength; |
|
736 |
||
737 |
/** |
|
738 |
@internalComponent |
|
739 |
*/ |
|
740 |
__TText iBuf[__Align16(S)]; |
|
741 |
}; |
|
742 |
||
743 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
744 |
#include <e32des16_private.h> |
|
745 |
#endif |
|
746 |
||
747 |
#endif |