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\e32des8.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef __E32DES8_H__
|
|
19 |
#define __E32DES8_H__
|
|
20 |
|
|
21 |
/**
|
|
22 |
@internalComponent
|
|
23 |
*/
|
|
24 |
const TUint KMaskDesLength8=0xfffffff;
|
|
25 |
|
|
26 |
class TBufCBase8;
|
|
27 |
class TDes8;
|
|
28 |
class TPtrC8;
|
|
29 |
class TPtr8;
|
|
30 |
class TPtr16;
|
|
31 |
#ifndef __KERNEL_MODE__
|
|
32 |
class HBufC8;
|
|
33 |
#endif
|
|
34 |
class TDesC8
|
|
35 |
/**
|
|
36 |
@publishedAll
|
|
37 |
@released
|
|
38 |
|
|
39 |
Abstract base class for 8-bit non-modifiable descriptors.
|
|
40 |
|
|
41 |
The class encapsulates the data member containing the length of data
|
|
42 |
represented by an 8-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 8-bit (i.e.
|
|
46 |
single 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 TPtrC8
|
|
55 |
*/
|
|
56 |
{
|
|
57 |
public:
|
|
58 |
inline TBool operator<(const TDesC8 &aDes) const;
|
|
59 |
inline TBool operator<=(const TDesC8 &aDes) const;
|
|
60 |
inline TBool operator>(const TDesC8 &aDes) const;
|
|
61 |
inline TBool operator>=(const TDesC8 &aDes) const;
|
|
62 |
inline TBool operator==(const TDesC8 &aDes) const;
|
|
63 |
inline TBool operator!=(const TDesC8 &aDes) const;
|
|
64 |
inline const TUint8 &operator[](TInt anIndex) const;
|
|
65 |
inline TInt Length() const;
|
|
66 |
inline TInt Size() const;
|
|
67 |
IMPORT_C const TUint8 *Ptr() const;
|
|
68 |
IMPORT_C TInt Compare(const TDesC8 &aDes) const;
|
|
69 |
IMPORT_C TInt Match(const TDesC8 &aDes) const;
|
|
70 |
IMPORT_C TInt MatchF(const TDesC8 &aDes) const;
|
|
71 |
IMPORT_C TInt MatchC(const TDesC8 &aDes) const;
|
|
72 |
IMPORT_C TInt Locate(TChar aChar) const;
|
|
73 |
IMPORT_C TInt LocateReverse(TChar aChar) const;
|
|
74 |
IMPORT_C TInt Find(const TDesC8 &aDes) const;
|
|
75 |
IMPORT_C TInt Find(const TUint8 *pS,TInt aLenS) const;
|
|
76 |
IMPORT_C TPtrC8 Left(TInt aLength) const;
|
|
77 |
IMPORT_C TPtrC8 Right(TInt aLength) const;
|
|
78 |
IMPORT_C TPtrC8 Mid(TInt aPos) const;
|
|
79 |
IMPORT_C TPtrC8 Mid(TInt aPos,TInt aLength) const;
|
|
80 |
IMPORT_C TInt CompareF(const TDesC8 &aDes) const;
|
|
81 |
#ifndef __KERNEL_MODE__
|
|
82 |
IMPORT_C TInt CompareC(const TDesC8 &aDes) const;
|
|
83 |
IMPORT_C TInt LocateF(TChar aChar) const;
|
|
84 |
IMPORT_C TInt LocateReverseF(TChar aChar) const;
|
|
85 |
IMPORT_C TInt FindF(const TDesC8 &aDes) const;
|
|
86 |
IMPORT_C TInt FindF(const TUint8 *pS,TInt aLenS) const;
|
|
87 |
IMPORT_C TInt FindC(const TDesC8 &aDes) const;
|
|
88 |
IMPORT_C TInt FindC(const TUint8 *pS,TInt aLenS) const;
|
|
89 |
IMPORT_C HBufC8 *Alloc() const;
|
|
90 |
IMPORT_C HBufC8 *AllocL() const;
|
|
91 |
IMPORT_C HBufC8 *AllocLC() const;
|
|
92 |
#endif
|
|
93 |
protected:
|
|
94 |
inline TDesC8(TInt aType,TInt aLength);
|
|
95 |
inline TDesC8() {}
|
|
96 |
// delay this for a while
|
|
97 |
#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS
|
|
98 |
inline TDesC8( const TDesC8& aOther) : iLength(aOther.iLength) {}
|
|
99 |
#endif
|
|
100 |
// inline ~TDesC8() {} Commented out for the moment since it breaks code
|
|
101 |
inline TInt Type() const;
|
|
102 |
inline void DoSetLength(TInt aLength);
|
|
103 |
IMPORT_C const TUint8 &AtC(TInt anIndex) const;
|
|
104 |
private:
|
|
105 |
TUint iLength;
|
|
106 |
__DECLARE_TEST;
|
|
107 |
};
|
|
108 |
//
|
|
109 |
class TPtrC8 : public TDesC8
|
|
110 |
/**
|
|
111 |
@publishedAll
|
|
112 |
@released
|
|
113 |
|
|
114 |
8-bit non-modifiable pointer descriptor.
|
|
115 |
|
|
116 |
This is a descriptor class intended for instantiation and encapsulates a
|
|
117 |
pointer to the 8-bit data that it represents. The data can live in ROM or RAM
|
|
118 |
and this location is separate from the descriptor object itself.
|
|
119 |
|
|
120 |
The data is intended to be accessed, but not changed, through this descriptor.
|
|
121 |
The base class provides the functions through which data is accessed.
|
|
122 |
|
|
123 |
@see TPtr8
|
|
124 |
@see TDesC8
|
|
125 |
@see TDes8
|
|
126 |
@see TBufC8
|
|
127 |
@see TBuf8
|
|
128 |
@see HBufC8
|
|
129 |
*/
|
|
130 |
{
|
|
131 |
public:
|
|
132 |
IMPORT_C TPtrC8();
|
|
133 |
IMPORT_C TPtrC8(const TDesC8 &aDes);
|
|
134 |
IMPORT_C TPtrC8(const TUint8 *aString);
|
|
135 |
IMPORT_C TPtrC8(const TUint8 *aBuf,TInt aLength);
|
|
136 |
inline void Set(const TUint8 *aBuf,TInt aLength);
|
|
137 |
inline void Set(const TDesC8 &aDes);
|
|
138 |
inline void Set(const TPtrC8& aPtr);
|
|
139 |
private:
|
|
140 |
TPtrC8& operator=(const TPtrC8 &aDes);
|
|
141 |
protected:
|
|
142 |
const TUint8 *iPtr;
|
|
143 |
private:
|
|
144 |
__DECLARE_TEST;
|
|
145 |
};
|
|
146 |
//
|
|
147 |
class TDes8Overflow
|
|
148 |
/**
|
|
149 |
@publishedAll
|
|
150 |
@released
|
|
151 |
|
|
152 |
An interface that defines an overflow handler for an 8-bit descriptor.
|
|
153 |
|
|
154 |
The interface encapsulates a function that is called when an attempt to append
|
|
155 |
formatted text fails because the descriptor is already at its maximum length.
|
|
156 |
|
|
157 |
A derived class must provide an implementation for the Overflow() member
|
|
158 |
function.
|
|
159 |
|
|
160 |
@see TDes8::AppendFormat
|
|
161 |
*/
|
|
162 |
{
|
|
163 |
public:
|
|
164 |
/**
|
|
165 |
Handles the overflow.
|
|
166 |
|
|
167 |
This function is called when the TDes8::AppendFormat() variant that takes
|
|
168 |
an overflow handler argument, fails.
|
|
169 |
|
|
170 |
@param aDes The 8-bit modifiable descriptor whose overflow results in the
|
|
171 |
call to this overflow handler.
|
|
172 |
*/
|
|
173 |
virtual void Overflow(TDes8 &aDes)=0;
|
|
174 |
};
|
|
175 |
//
|
|
176 |
class TDes8IgnoreOverflow : public TDes8Overflow
|
|
177 |
/**
|
|
178 |
@publishedAll
|
|
179 |
@released
|
|
180 |
|
|
181 |
A derived class which provides an implementation for the Overflow() member function
|
|
182 |
where truncation is required.
|
|
183 |
|
|
184 |
@see TDes16::AppendFormat
|
|
185 |
*/
|
|
186 |
{
|
|
187 |
public:
|
|
188 |
/**
|
|
189 |
Handles the overflow.
|
|
190 |
|
|
191 |
This function is called when the TDes8::AppendFormat()
|
|
192 |
variant that takes an overflow handler argument, fails.
|
|
193 |
|
|
194 |
@param aDes The 8-bit modifiable descriptor whose overflow results in the
|
|
195 |
call to this overflow handler.
|
|
196 |
*/
|
|
197 |
IMPORT_C virtual void Overflow(TDes8 &aDes);
|
|
198 |
};
|
|
199 |
//
|
|
200 |
class TDesC16;
|
|
201 |
class TRealFormat;
|
|
202 |
class TDes8 : public TDesC8
|
|
203 |
/**
|
|
204 |
@publishedAll
|
|
205 |
@released
|
|
206 |
|
|
207 |
Abstract base class for 8-bit modifiable descriptors.
|
|
208 |
|
|
209 |
The class encapsulates the data member containing the maximum length of data
|
|
210 |
represented by an 8-bit descriptor. It also provides member functions through
|
|
211 |
which the data can be modified.
|
|
212 |
|
|
213 |
The class adds to the behaviour provided by TDesC8.
|
|
214 |
|
|
215 |
This class cannot be instantiated as it is intended to form part of a class
|
|
216 |
hierarchy; it provides a well defined part of descriptor behaviour. It can,
|
|
217 |
however, be passed as an argument type for functions which need to both modify
|
|
218 |
and access descriptor data.
|
|
219 |
|
|
220 |
@see TDes
|
|
221 |
@see TDesC8
|
|
222 |
@see TDesC16
|
|
223 |
*/
|
|
224 |
{
|
|
225 |
public:
|
|
226 |
inline TDes8& operator=(const TUint8 *aString);
|
|
227 |
inline TDes8& operator=(const TDesC8 &aDes);
|
|
228 |
inline TDes8& operator=(const TDes8 &aDes);
|
|
229 |
inline TInt MaxLength() const;
|
|
230 |
inline TInt MaxSize() const;
|
|
231 |
inline const TUint8 &operator[](TInt anIndex) const;
|
|
232 |
inline TUint8 &operator[](TInt anIndex);
|
|
233 |
inline TDes8 &operator+=(const TDesC8 &aDes);
|
|
234 |
IMPORT_C void Zero();
|
|
235 |
IMPORT_C void SetLength(TInt aLength);
|
|
236 |
IMPORT_C void SetMax();
|
|
237 |
IMPORT_C void Copy(const TDesC8 &aDes);
|
|
238 |
IMPORT_C void Copy(const TUint8 *aBuf,TInt aLength);
|
|
239 |
IMPORT_C void Copy(const TUint8 *aString);
|
|
240 |
IMPORT_C void Copy(const TDesC16 &aDes);
|
|
241 |
IMPORT_C void Append(TChar aChar);
|
|
242 |
IMPORT_C void Append(const TDesC8 &aDes);
|
|
243 |
IMPORT_C void Append(const TDesC16 &aDes);
|
|
244 |
IMPORT_C void Append(const TUint8 *aBuf,TInt aLength);
|
|
245 |
IMPORT_C void Fill(TChar aChar);
|
|
246 |
IMPORT_C void Fill(TChar aChar,TInt aLength);
|
|
247 |
IMPORT_C void FillZ();
|
|
248 |
IMPORT_C void FillZ(TInt aLength);
|
|
249 |
IMPORT_C void Num(TInt64 aVal);
|
|
250 |
IMPORT_C void Num(TUint64 aVal, TRadix aRadix);
|
|
251 |
IMPORT_C void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
|
252 |
IMPORT_C void AppendNum(TInt64 aVal);
|
|
253 |
IMPORT_C void AppendNum(TUint64 aVal, TRadix aRadix);
|
|
254 |
IMPORT_C void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
|
255 |
#ifndef __KERNEL_MODE__
|
|
256 |
IMPORT_C TPtr8 LeftTPtr(TInt aLength) const;
|
|
257 |
IMPORT_C TPtr8 RightTPtr(TInt aLength) const;
|
|
258 |
IMPORT_C TPtr8 MidTPtr(TInt aPos) const;
|
|
259 |
IMPORT_C TPtr8 MidTPtr(TInt aPos,TInt aLength) const;
|
|
260 |
IMPORT_C const TUint8 *PtrZ();
|
|
261 |
IMPORT_C void CopyF(const TDesC8 &aDes);
|
|
262 |
IMPORT_C void CopyC(const TDesC8 &aDes);
|
|
263 |
IMPORT_C void CopyLC(const TDesC8 &aDes);
|
|
264 |
IMPORT_C void CopyUC(const TDesC8 &aDes);
|
|
265 |
IMPORT_C void CopyCP(const TDesC8 &aDes);
|
|
266 |
IMPORT_C void Swap(TDes8 &aDes);
|
|
267 |
IMPORT_C void AppendFill(TChar aChar,TInt aLength);
|
|
268 |
IMPORT_C void ZeroTerminate();
|
|
269 |
IMPORT_C void Fold();
|
|
270 |
IMPORT_C void Collate();
|
|
271 |
IMPORT_C void LowerCase();
|
|
272 |
IMPORT_C void UpperCase();
|
|
273 |
IMPORT_C void Capitalize();
|
|
274 |
IMPORT_C void Repeat(const TUint8 *aBuf,TInt aLength);
|
|
275 |
IMPORT_C void Repeat(const TDesC8 &aDes);
|
|
276 |
IMPORT_C void Trim();
|
|
277 |
IMPORT_C void TrimAll();
|
|
278 |
IMPORT_C void TrimLeft();
|
|
279 |
IMPORT_C void TrimRight();
|
|
280 |
IMPORT_C void Insert(TInt aPos,const TDesC8 &aDes);
|
|
281 |
IMPORT_C void Delete(TInt aPos,TInt aLength);
|
|
282 |
IMPORT_C void Replace(TInt aPos,TInt aLength,const TDesC8 &aDes);
|
|
283 |
IMPORT_C void Justify(const TDesC8 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
|
|
284 |
IMPORT_C void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
|
285 |
IMPORT_C void NumUC(TUint64 aVal, TRadix aRadix=EDecimal);
|
|
286 |
IMPORT_C TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
|
287 |
IMPORT_C void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
|
288 |
IMPORT_C TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
|
289 |
IMPORT_C void AppendNumUC(TUint64 aVal,TRadix aRadix=EDecimal);
|
|
290 |
IMPORT_C void Format(TRefByValue<const TDesC8> aFmt,...);
|
|
291 |
IMPORT_C void FormatList(const TDesC8 &aFmt,VA_LIST aList);
|
|
292 |
IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
|
|
293 |
IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
|
294 |
IMPORT_C void AppendJustify(const TUint8 *aString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
|
295 |
IMPORT_C void AppendJustify(const TUint8 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
|
296 |
IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,TDes8Overflow *aOverflowHandler,...);
|
|
297 |
IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,...);
|
|
298 |
IMPORT_C void AppendFormatList(const TDesC8 &aFmt,VA_LIST aList,TDes8Overflow *aOverflowHandler=NULL);
|
|
299 |
IMPORT_C TPtr16 Expand();
|
|
300 |
IMPORT_C void Collapse();
|
|
301 |
#endif //__KERNEL_MODE__
|
|
302 |
protected:
|
|
303 |
inline TDes8(TInt aType,TInt aLength,TInt aMaxLength);
|
|
304 |
inline TUint8 *WPtr() const;
|
|
305 |
inline TDes8() {}
|
|
306 |
// delay this for a while
|
|
307 |
#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS
|
|
308 |
inline TDes8(const TDes8& aOther) : TDesC8(aOther), iMaxLength(aOther.iMaxLength) {}
|
|
309 |
#endif
|
|
310 |
void DoAppendNum(TUint64 aVal, TRadix aRadix, TUint aA, TInt aW);
|
|
311 |
void DoPadAppendNum(TInt aLength, TInt aW, const TUint8* aBuf);
|
|
312 |
protected:
|
|
313 |
TInt iMaxLength;
|
|
314 |
__DECLARE_TEST;
|
|
315 |
};
|
|
316 |
//
|
|
317 |
class TPtr8 : public TDes8
|
|
318 |
/**
|
|
319 |
@publishedAll
|
|
320 |
@released
|
|
321 |
|
|
322 |
8-bit modifiable pointer descriptor.
|
|
323 |
|
|
324 |
This is a descriptor class intended for instantiation and encapsulates a
|
|
325 |
pointer to the 8-bit data that it represents. The data can live in ROM or
|
|
326 |
RAM and this location is separate from the descriptor object itself.
|
|
327 |
|
|
328 |
The data is intended to be accessed and modified through this descriptor.
|
|
329 |
The base classes provide the functions through which the data can be
|
|
330 |
manipulated.
|
|
331 |
|
|
332 |
@see TPtr
|
|
333 |
@see TPtrC8
|
|
334 |
@see TDesC8
|
|
335 |
@see TDes8
|
|
336 |
@see TBufC8
|
|
337 |
@see TBuf8
|
|
338 |
@see HBufC8
|
|
339 |
*/
|
|
340 |
{
|
|
341 |
public:
|
|
342 |
IMPORT_C TPtr8(TUint8 *aBuf,TInt aMaxLength);
|
|
343 |
IMPORT_C TPtr8(TUint8 *aBuf,TInt aLength,TInt aMaxLength);
|
|
344 |
inline TPtr8& operator=(const TUint8 *aString);
|
|
345 |
inline TPtr8& operator=(const TDesC8& aDes);
|
|
346 |
inline TPtr8& operator=(const TPtr8& aPtr);
|
|
347 |
inline void Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength);
|
|
348 |
inline void Set(const TPtr8 &aPtr);
|
|
349 |
private:
|
|
350 |
IMPORT_C TPtr8(TBufCBase8 &aLcb,TInt aMaxLength);
|
|
351 |
protected:
|
|
352 |
TUint8 *iPtr;
|
|
353 |
private:
|
|
354 |
friend class TBufCBase8;
|
|
355 |
__DECLARE_TEST;
|
|
356 |
};
|
|
357 |
//
|
|
358 |
class TBufCBase8 : public TDesC8
|
|
359 |
/**
|
|
360 |
@internalAll
|
|
361 |
*/
|
|
362 |
{
|
|
363 |
protected:
|
|
364 |
IMPORT_C TBufCBase8();
|
|
365 |
inline TBufCBase8(TInt aLength);
|
|
366 |
IMPORT_C TBufCBase8(const TUint8 *aString,TInt aMaxLength);
|
|
367 |
IMPORT_C TBufCBase8(const TDesC8 &aDes,TInt aMaxLength);
|
|
368 |
IMPORT_C void Copy(const TUint8 *aString,TInt aMaxLength);
|
|
369 |
IMPORT_C void Copy(const TDesC8 &aDes,TInt aMaxLength);
|
|
370 |
inline TPtr8 DoDes(TInt aMaxLength);
|
|
371 |
inline TUint8 *WPtr() const;
|
|
372 |
};
|
|
373 |
//
|
|
374 |
#ifndef __KERNEL_MODE__
|
|
375 |
class RReadStream;
|
|
376 |
class HBufC8 : public TBufCBase8
|
|
377 |
/**
|
|
378 |
@publishedAll
|
|
379 |
@released
|
|
380 |
|
|
381 |
8-bit heap descriptor.
|
|
382 |
|
|
383 |
This is a descriptor class which provides a buffer of fixed length, allocated
|
|
384 |
on the heap, for containing and accessing data.
|
|
385 |
|
|
386 |
The class is intended for instantiation.
|
|
387 |
|
|
388 |
Heap descriptors have the important property that they can be made larger
|
|
389 |
or smaller, changing the size of the descriptor buffer. This is achieved by
|
|
390 |
reallocating the descriptor. Unlike the behaviour of dynamic buffers,
|
|
391 |
reallocation is not done automatically.
|
|
392 |
|
|
393 |
Data is intended to be accessed, but not modified; however, it can be
|
|
394 |
completely replaced using the assignment operators of this class. The base
|
|
395 |
class (TDesC8) provides the functions through which the data is accessed.
|
|
396 |
|
|
397 |
The descriptor is hosted by a heap cell, and the 8-bit data that the
|
|
398 |
descriptor represents is part of the descriptor object itself. The size of the
|
|
399 |
cell depends on the requested maximum length of the descriptor buffer when the
|
|
400 |
descriptor is created or re-allocated.
|
|
401 |
|
|
402 |
It is important to note that the size of the allocated cell, and, therefore,
|
|
403 |
the resulting maximum length of the descriptor, may be larger than requested
|
|
404 |
due to the way memory is allocated in Symbian OS. The amount by which this
|
|
405 |
may be rounded up depends on the platform and build type.
|
|
406 |
|
|
407 |
@see HBufC
|
|
408 |
@see TPtr8
|
|
409 |
@see TDesC8
|
|
410 |
*/
|
|
411 |
{
|
|
412 |
public:
|
|
413 |
IMPORT_C static HBufC8 *New(TInt aMaxLength);
|
|
414 |
IMPORT_C static HBufC8 *NewL(TInt aMaxLength);
|
|
415 |
IMPORT_C static HBufC8 *NewLC(TInt aMaxLength);
|
|
416 |
IMPORT_C static HBufC8 *NewMax(TInt aMaxLength);
|
|
417 |
IMPORT_C static HBufC8 *NewMaxL(TInt aMaxLength);
|
|
418 |
IMPORT_C static HBufC8 *NewMaxLC(TInt aMaxLength);
|
|
419 |
IMPORT_C static HBufC8 *NewL(RReadStream &aStream,TInt aMaxLength);
|
|
420 |
IMPORT_C static HBufC8 *NewLC(RReadStream &aStream,TInt aMaxLength);
|
|
421 |
IMPORT_C HBufC8& operator=(const TUint8 *aString);
|
|
422 |
IMPORT_C HBufC8& operator=(const TDesC8 &aDes);
|
|
423 |
inline HBufC8& operator=(const HBufC8 &aLcb);
|
|
424 |
IMPORT_C HBufC8 *ReAlloc(TInt aMaxLength);
|
|
425 |
IMPORT_C HBufC8 *ReAllocL(TInt aMaxLength);
|
|
426 |
IMPORT_C TPtr8 Des();
|
|
427 |
private:
|
|
428 |
inline HBufC8(TInt aLength);
|
|
429 |
private:
|
|
430 |
TText8 iBuf[1];
|
|
431 |
__DECLARE_TEST;
|
|
432 |
};
|
|
433 |
#endif
|
|
434 |
//
|
|
435 |
/**
|
|
436 |
@internalComponent
|
|
437 |
*/
|
|
438 |
#define __Size8 (sizeof(TInt)/sizeof(TInt8))
|
|
439 |
/**
|
|
440 |
@internalComponent
|
|
441 |
*/
|
|
442 |
#define __Align8(s) ((((s)+__Size8-1)/__Size8)*__Size8)
|
|
443 |
//
|
|
444 |
template <TInt S>
|
|
445 |
class TBufC8 : public TBufCBase8
|
|
446 |
/**
|
|
447 |
@publishedAll
|
|
448 |
@released
|
|
449 |
|
|
450 |
8-bit non-modifiable buffer descriptor.
|
|
451 |
|
|
452 |
This is a descriptor class which provides a buffer of fixed length for
|
|
453 |
containing and accessing TUint8 data.
|
|
454 |
|
|
455 |
The class intended for instantiation. The 8-bit data that the descriptor
|
|
456 |
represents is part of the descriptor object itself.
|
|
457 |
|
|
458 |
The class is templated, based on an integer value which defines the size of
|
|
459 |
the descriptor's data area.
|
|
460 |
|
|
461 |
The data is intended to be accessed, but not modified; however, it can be
|
|
462 |
completely replaced using the assignment operators of this class. The base
|
|
463 |
class provides the functions through which the data is accessed.
|
|
464 |
|
|
465 |
@see TBufC
|
|
466 |
@see TDesC8
|
|
467 |
@see TPtr8
|
|
468 |
@see TUint8
|
|
469 |
*/
|
|
470 |
{
|
|
471 |
public:
|
|
472 |
inline TBufC8();
|
|
473 |
inline TBufC8(const TUint8 *aString);
|
|
474 |
inline TBufC8(const TDesC8 &aDes);
|
|
475 |
inline TBufC8<S> &operator=(const TUint8 *aString);
|
|
476 |
inline TBufC8<S> &operator=(const TDesC8 &aDes);
|
|
477 |
inline TPtr8 Des();
|
|
478 |
protected:
|
|
479 |
TUint8 iBuf[__Align8(S)];
|
|
480 |
};
|
|
481 |
//
|
|
482 |
class TBufBase8 : public TDes8
|
|
483 |
/**
|
|
484 |
@internalAll
|
|
485 |
*/
|
|
486 |
{
|
|
487 |
protected:
|
|
488 |
IMPORT_C TBufBase8(TInt aMaxLength);
|
|
489 |
IMPORT_C TBufBase8(TInt aLength,TInt aMaxLength);
|
|
490 |
IMPORT_C TBufBase8(const TUint8* aString,TInt aMaxLength);
|
|
491 |
IMPORT_C TBufBase8(const TDesC8& aDes,TInt aMaxLength);
|
|
492 |
};
|
|
493 |
//
|
|
494 |
template <TInt S>
|
|
495 |
class TBuf8 : public TBufBase8
|
|
496 |
/**
|
|
497 |
@publishedAll
|
|
498 |
@released
|
|
499 |
|
|
500 |
A descriptor class which provides a buffer of fixed length for
|
|
501 |
containing, accessing and manipulating TUint8 data.
|
|
502 |
|
|
503 |
The class is intended for instantiation. The 8-bit data that the descriptor
|
|
504 |
represents is part of the descriptor object itself.
|
|
505 |
|
|
506 |
The class is templated, based on an integer value which determines the size
|
|
507 |
of the data area which is created as part of the buffer descriptor object;
|
|
508 |
this is also the maximum length of the descriptor.
|
|
509 |
|
|
510 |
The data is intended to be both accessed and modified. The base classes provide
|
|
511 |
the functions through which the data is accessed.
|
|
512 |
|
|
513 |
@see TBuf
|
|
514 |
@see TDesC8
|
|
515 |
@see TDes8
|
|
516 |
@see TPtr8
|
|
517 |
*/
|
|
518 |
{
|
|
519 |
public:
|
|
520 |
inline TBuf8();
|
|
521 |
inline explicit TBuf8(TInt aLength);
|
|
522 |
inline TBuf8(const TUint8* aString);
|
|
523 |
inline TBuf8(const TDesC8& aDes);
|
|
524 |
inline TBuf8<S>& operator=(const TUint8* aString);
|
|
525 |
inline TBuf8<S>& operator=(const TDesC8& aDes);
|
|
526 |
inline TBuf8<S>& operator=(const TBuf8<S>& aBuf);
|
|
527 |
protected:
|
|
528 |
TUint8 iBuf[__Align8(S)];
|
|
529 |
};
|
|
530 |
|
|
531 |
//
|
|
532 |
template <TInt S>
|
|
533 |
class TAlignedBuf8 : public TBufBase8
|
|
534 |
/**
|
|
535 |
@internalComponent
|
|
536 |
|
|
537 |
A descriptor class functionally identical to TBuf8, the only
|
|
538 |
difference from it being that TAlignedBuf8's internal buffer
|
|
539 |
is guaranteed to be 64-bit aligned.
|
|
540 |
|
|
541 |
At present this class is not intended for general use. It exists
|
|
542 |
solely to support TPckgBuf which derives from it.
|
|
543 |
|
|
544 |
@see TBuf8
|
|
545 |
@see TPckgBuf
|
|
546 |
*/
|
|
547 |
{
|
|
548 |
public:
|
|
549 |
inline TAlignedBuf8();
|
|
550 |
inline explicit TAlignedBuf8(TInt aLength);
|
|
551 |
inline TAlignedBuf8(const TUint8* aString);
|
|
552 |
inline TAlignedBuf8(const TDesC8& aDes);
|
|
553 |
inline TAlignedBuf8<S>& operator=(const TUint8* aString);
|
|
554 |
inline TAlignedBuf8<S>& operator=(const TDesC8& aDes);
|
|
555 |
inline TAlignedBuf8<S>& operator=(const TAlignedBuf8<S>& aBuf);
|
|
556 |
protected:
|
|
557 |
union {
|
|
558 |
double only_here_to_force_8byte_alignment;
|
|
559 |
TUint8 iBuf[__Align8(S)];
|
|
560 |
};
|
|
561 |
};
|
|
562 |
|
|
563 |
#ifndef __KERNEL_MODE__
|
|
564 |
|
|
565 |
class RBuf8 : public TDes8
|
|
566 |
/**
|
|
567 |
@publishedAll
|
|
568 |
@released
|
|
569 |
|
|
570 |
8 bit resizable buffer descriptor.
|
|
571 |
|
|
572 |
The class provides a buffer that contains, accesses and manipulates
|
|
573 |
TUint8 data. The buffer itself is on the heap, and is managed by the class.
|
|
574 |
|
|
575 |
Internally, RBuf8 behaves in one of two ways:
|
|
576 |
|
|
577 |
- as a TPtr8 descriptor type, where the buffer just contains data
|
|
578 |
- as a pointer to a heap descriptor, an HBufC8* type, where the buffer
|
|
579 |
contains both descriptor information and the data.
|
|
580 |
|
|
581 |
Note that the handling of the distinction is hidden from view.
|
|
582 |
|
|
583 |
An RBuf8 object can allocate its own buffer. Alternatively, it can take
|
|
584 |
ownership of a pre-existing section of allocated memory, or it can take
|
|
585 |
ownership of a pre-existing heap descriptor. It can also reallocate the buffer
|
|
586 |
to resize it. Regardless of the way in which the buffer has been allocated,
|
|
587 |
the RBuf8 object is responsible for freeing memory when the object itself is closed.
|
|
588 |
|
|
589 |
The class is intended for instantiation.
|
|
590 |
|
|
591 |
The class is derived from TDes8, which means that data can be both accessed
|
|
592 |
and modified. The base classes provide the functions through which the data is
|
|
593 |
accessed. In addition, an RBuf8 object can be passed to any function that is
|
|
594 |
prototyped to take a TDes8 or a TDesC8 type.
|
|
595 |
|
|
596 |
@see TBuf8
|
|
597 |
@see TPtr8
|
|
598 |
@see HBufC8
|
|
599 |
@see TDesC8
|
|
600 |
@see TDes8
|
|
601 |
*/
|
|
602 |
{
|
|
603 |
public:
|
|
604 |
IMPORT_C RBuf8();
|
|
605 |
IMPORT_C explicit RBuf8(HBufC8* aHBuf);
|
|
606 |
inline RBuf8& operator=(const TUint8* aString);
|
|
607 |
inline RBuf8& operator=(const TDesC8& aDes);
|
|
608 |
inline RBuf8& operator=(const RBuf8& aDes);
|
|
609 |
IMPORT_C void Assign(const RBuf8& aRBuf);
|
|
610 |
IMPORT_C void Assign(TUint8 *aHeapCell,TInt aMaxLength);
|
|
611 |
IMPORT_C void Assign(TUint8 *aHeapCell,TInt aLength,TInt aMaxLength);
|
|
612 |
IMPORT_C void Assign(HBufC8* aHBuf);
|
|
613 |
IMPORT_C void Swap(RBuf8& aRBuf);
|
|
614 |
IMPORT_C TInt Create(TInt aMaxLength);
|
|
615 |
IMPORT_C void CreateL(TInt aMaxLength);
|
|
616 |
IMPORT_C TInt CreateMax(TInt aMaxLength);
|
|
617 |
IMPORT_C void CreateMaxL(TInt aMaxLength);
|
|
618 |
inline void CreateL(RReadStream &aStream,TInt aMaxLength);
|
|
619 |
IMPORT_C TInt Create(const TDesC8& aDes);
|
|
620 |
IMPORT_C void CreateL(const TDesC8& aDes);
|
|
621 |
IMPORT_C TInt Create(const TDesC8& aDes,TInt aMaxLength);
|
|
622 |
IMPORT_C void CreateL(const TDesC8& aDes,TInt aMaxLength);
|
|
623 |
IMPORT_C TInt ReAlloc(TInt aMaxLength);
|
|
624 |
IMPORT_C void ReAllocL(TInt aMaxLength);
|
|
625 |
IMPORT_C void Close();
|
|
626 |
IMPORT_C void CleanupClosePushL();
|
|
627 |
|
|
628 |
protected:
|
|
629 |
IMPORT_C RBuf8(TInt aType,TInt aLength,TInt aMaxLength);
|
|
630 |
RBuf8(const RBuf8&); // Outlaw copy construction
|
|
631 |
union
|
|
632 |
{
|
|
633 |
TUint8* iEPtrType; //Pointer to data used when RBuf is of EPtr type
|
|
634 |
HBufC8* iEBufCPtrType; //Pointer to data used when RBuf is of EBufCPtr type
|
|
635 |
};
|
|
636 |
__DECLARE_TEST;
|
|
637 |
};
|
|
638 |
|
|
639 |
#endif
|
|
640 |
|
|
641 |
/**
|
|
642 |
@publishedAll
|
|
643 |
@released
|
|
644 |
|
|
645 |
Value reference used in operator TLitC8::__TRefDesC8()
|
|
646 |
|
|
647 |
@see TRefByValue
|
|
648 |
*/
|
|
649 |
typedef TRefByValue<const TDesC8> __TRefDesC8;
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
|
654 |
template <TInt S>
|
|
655 |
class TLitC8
|
|
656 |
/**
|
|
657 |
@publishedAll
|
|
658 |
@released
|
|
659 |
|
|
660 |
Encapsulates literal text.
|
|
661 |
|
|
662 |
This is always constructed using an _LIT8 macro.
|
|
663 |
|
|
664 |
This class is build independent; i.e. an explicit 8-bit build variant
|
|
665 |
is generated for both a non-Unicode build and a Unicode build.
|
|
666 |
|
|
667 |
The class has no explicit constructors.
|
|
668 |
|
|
669 |
@see _LIT8
|
|
670 |
*/
|
|
671 |
{
|
|
672 |
public:
|
|
673 |
inline const TDesC8* operator&() const;
|
|
674 |
inline operator const TDesC8&() const;
|
|
675 |
inline const TDesC8& operator()() const;
|
|
676 |
inline operator const __TRefDesC8() const;
|
|
677 |
public:
|
|
678 |
/**
|
|
679 |
@internalComponent
|
|
680 |
*/
|
|
681 |
TUint iTypeLength;
|
|
682 |
|
|
683 |
/**
|
|
684 |
@internalComponent
|
|
685 |
*/
|
|
686 |
TText8 iBuf[__Align8(S)];
|
|
687 |
};
|
|
688 |
|
|
689 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
690 |
#include <e32des8_private.h>
|
|
691 |
#endif
|
|
692 |
|
|
693 |
#endif
|