1.1 --- a/epoc32/include/e32des8.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/e32des8.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,693 @@
1.4 -e32des8.h
1.5 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// e32\include\e32des8.h
1.19 +//
1.20 +//
1.21 +
1.22 +#ifndef __E32DES8_H__
1.23 +#define __E32DES8_H__
1.24 +
1.25 +/**
1.26 +@internalComponent
1.27 +*/
1.28 +const TUint KMaskDesLength8=0xfffffff;
1.29 +/**
1.30 +@internalComponent
1.31 +*/
1.32 +const TInt KShiftDesType8=28;
1.33 +
1.34 +class TBufCBase8;
1.35 +class TDes8;
1.36 +class TPtrC8;
1.37 +class TPtr8;
1.38 +class TPtr16;
1.39 +#ifndef __KERNEL_MODE__
1.40 +class HBufC8;
1.41 +#endif
1.42 +class TDesC8
1.43 +/**
1.44 +@publishedAll
1.45 +@released
1.46 +
1.47 +Abstract base class for 8-bit non-modifiable descriptors.
1.48 +
1.49 +The class encapsulates the data member containing the length of data
1.50 +represented by an 8-bit descriptor. It also provides member functions through
1.51 +which the data can be accessed, but not modified.
1.52 +
1.53 +Data represented by this class is treated as a contiguous set of 8-bit (i.e.
1.54 +single byte) values or data items.
1.55 +
1.56 +This class cannot be instantiated as it is intended to form part of a class
1.57 +hierarchy; it provides a well defined part of descriptor behaviour. It can,
1.58 +however, be passed as an argument type for functions which want access to
1.59 +descriptor data but do not need to modify that data.
1.60 +
1.61 +@see TDesC
1.62 +@see TPtrC8
1.63 +*/
1.64 + {
1.65 +public:
1.66 + inline TBool operator<(const TDesC8 &aDes) const;
1.67 + inline TBool operator<=(const TDesC8 &aDes) const;
1.68 + inline TBool operator>(const TDesC8 &aDes) const;
1.69 + inline TBool operator>=(const TDesC8 &aDes) const;
1.70 + inline TBool operator==(const TDesC8 &aDes) const;
1.71 + inline TBool operator!=(const TDesC8 &aDes) const;
1.72 + inline const TUint8 &operator[](TInt anIndex) const;
1.73 + inline TInt Length() const;
1.74 + inline TInt Size() const;
1.75 + IMPORT_C const TUint8 *Ptr() const;
1.76 + IMPORT_C TInt Compare(const TDesC8 &aDes) const;
1.77 + IMPORT_C TInt Match(const TDesC8 &aDes) const;
1.78 + IMPORT_C TInt MatchF(const TDesC8 &aDes) const;
1.79 + IMPORT_C TInt MatchC(const TDesC8 &aDes) const;
1.80 + IMPORT_C TInt Locate(TChar aChar) const;
1.81 + IMPORT_C TInt LocateReverse(TChar aChar) const;
1.82 + IMPORT_C TInt Find(const TDesC8 &aDes) const;
1.83 + IMPORT_C TInt Find(const TUint8 *pS,TInt aLenS) const;
1.84 + IMPORT_C TPtrC8 Left(TInt aLength) const;
1.85 + IMPORT_C TPtrC8 Right(TInt aLength) const;
1.86 + IMPORT_C TPtrC8 Mid(TInt aPos) const;
1.87 + IMPORT_C TPtrC8 Mid(TInt aPos,TInt aLength) const;
1.88 + IMPORT_C TInt CompareF(const TDesC8 &aDes) const;
1.89 +#ifndef __KERNEL_MODE__
1.90 + IMPORT_C TInt CompareC(const TDesC8 &aDes) const;
1.91 + IMPORT_C TInt LocateF(TChar aChar) const;
1.92 + IMPORT_C TInt LocateReverseF(TChar aChar) const;
1.93 + IMPORT_C TInt FindF(const TDesC8 &aDes) const;
1.94 + IMPORT_C TInt FindF(const TUint8 *pS,TInt aLenS) const;
1.95 + IMPORT_C TInt FindC(const TDesC8 &aDes) const;
1.96 + IMPORT_C TInt FindC(const TUint8 *pS,TInt aLenS) const;
1.97 + IMPORT_C HBufC8 *Alloc() const;
1.98 + IMPORT_C HBufC8 *AllocL() const;
1.99 + IMPORT_C HBufC8 *AllocLC() const;
1.100 +#endif
1.101 +protected:
1.102 + inline TDesC8(TInt aType,TInt aLength);
1.103 + inline TDesC8() {}
1.104 +// delay this for a while
1.105 +#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS
1.106 + inline TDesC8( const TDesC8& aOther) : iLength(aOther.iLength) {}
1.107 +#endif
1.108 +// inline ~TDesC8() {} Commented out for the moment since it breaks code
1.109 + inline TInt Type() const;
1.110 + inline void DoSetLength(TInt aLength);
1.111 + IMPORT_C const TUint8 &AtC(TInt anIndex) const;
1.112 +private:
1.113 + TUint iLength;
1.114 + __DECLARE_TEST;
1.115 + };
1.116 +//
1.117 +class TPtrC8 : public TDesC8
1.118 +/**
1.119 +@publishedAll
1.120 +@released
1.121 +
1.122 +8-bit non-modifiable pointer descriptor.
1.123 +
1.124 +This is a descriptor class intended for instantiation and encapsulates a
1.125 +pointer to the 8-bit data that it represents. The data can live in ROM or RAM
1.126 +and this location is separate from the descriptor object itself.
1.127 +
1.128 +The data is intended to be accessed, but not changed, through this descriptor.
1.129 +The base class provides the functions through which data is accessed.
1.130 +
1.131 +@see TPtr8
1.132 +@see TDesC8
1.133 +@see TDes8
1.134 +@see TBufC8
1.135 +@see TBuf8
1.136 +@see HBufC8
1.137 +*/
1.138 + {
1.139 +public:
1.140 + IMPORT_C TPtrC8();
1.141 + IMPORT_C TPtrC8(const TDesC8 &aDes);
1.142 + IMPORT_C TPtrC8(const TUint8 *aString);
1.143 + IMPORT_C TPtrC8(const TUint8 *aBuf,TInt aLength);
1.144 + inline void Set(const TUint8 *aBuf,TInt aLength);
1.145 + inline void Set(const TDesC8 &aDes);
1.146 + inline void Set(const TPtrC8& aPtr);
1.147 +private:
1.148 + TPtrC8& operator=(const TPtrC8 &aDes);
1.149 +protected:
1.150 + const TUint8 *iPtr;
1.151 +private:
1.152 + __DECLARE_TEST;
1.153 + };
1.154 +//
1.155 +class TDes8Overflow
1.156 +/**
1.157 +@publishedAll
1.158 +@released
1.159 +
1.160 +An interface that defines an overflow handler for an 8-bit descriptor.
1.161 +
1.162 +The interface encapsulates a function that is called when an attempt to append
1.163 +formatted text fails because the descriptor is already at its maximum length.
1.164 +
1.165 +A derived class must provide an implementation for the Overflow() member
1.166 +function.
1.167 +
1.168 +@see TDes8::AppendFormat
1.169 +*/
1.170 + {
1.171 +public:
1.172 + /**
1.173 + Handles the overflow.
1.174 +
1.175 + This function is called when the TDes8::AppendFormat() variant that takes
1.176 + an overflow handler argument, fails.
1.177 +
1.178 + @param aDes The 8-bit modifiable descriptor whose overflow results in the
1.179 + call to this overflow handler.
1.180 + */
1.181 + virtual void Overflow(TDes8 &aDes)=0;
1.182 + };
1.183 +//
1.184 +class TDes8IgnoreOverflow : public TDes8Overflow
1.185 +/**
1.186 +@publishedAll
1.187 +@released
1.188 +
1.189 +A derived class which provides an implementation for the Overflow() member function
1.190 +where truncation is required.
1.191 +
1.192 +@see TDes16::AppendFormat
1.193 +*/
1.194 + {
1.195 +public:
1.196 + /**
1.197 + Handles the overflow.
1.198 +
1.199 + This function is called when the TDes8::AppendFormat()
1.200 + variant that takes an overflow handler argument, fails.
1.201 +
1.202 + @param aDes The 8-bit modifiable descriptor whose overflow results in the
1.203 + call to this overflow handler.
1.204 + */
1.205 + IMPORT_C virtual void Overflow(TDes8 &aDes);
1.206 + };
1.207 +//
1.208 +class TDesC16;
1.209 +class TRealFormat;
1.210 +class TDes8 : public TDesC8
1.211 +/**
1.212 +@publishedAll
1.213 +@released
1.214 +
1.215 +Abstract base class for 8-bit modifiable descriptors.
1.216 +
1.217 +The class encapsulates the data member containing the maximum length of data
1.218 +represented by an 8-bit descriptor. It also provides member functions through
1.219 +which the data can be modified.
1.220 +
1.221 +The class adds to the behaviour provided by TDesC8.
1.222 +
1.223 +This class cannot be instantiated as it is intended to form part of a class
1.224 +hierarchy; it provides a well defined part of descriptor behaviour. It can,
1.225 +however, be passed as an argument type for functions which need to both modify
1.226 +and access descriptor data.
1.227 +
1.228 +@see TDes
1.229 +@see TDesC8
1.230 +@see TDesC16
1.231 +*/
1.232 + {
1.233 +public:
1.234 + inline TDes8& operator=(const TUint8 *aString);
1.235 + inline TDes8& operator=(const TDesC8 &aDes);
1.236 + inline TDes8& operator=(const TDes8 &aDes);
1.237 + inline TInt MaxLength() const;
1.238 + inline TInt MaxSize() const;
1.239 + inline const TUint8 &operator[](TInt anIndex) const;
1.240 + inline TUint8 &operator[](TInt anIndex);
1.241 + inline TDes8 &operator+=(const TDesC8 &aDes);
1.242 + IMPORT_C void Zero();
1.243 + IMPORT_C void SetLength(TInt aLength);
1.244 + IMPORT_C void SetMax();
1.245 + IMPORT_C void Copy(const TDesC8 &aDes);
1.246 + IMPORT_C void Copy(const TUint8 *aBuf,TInt aLength);
1.247 + IMPORT_C void Copy(const TUint8 *aString);
1.248 + IMPORT_C void Copy(const TDesC16 &aDes);
1.249 + IMPORT_C void Append(TChar aChar);
1.250 + IMPORT_C void Append(const TDesC8 &aDes);
1.251 + IMPORT_C void Append(const TDesC16 &aDes);
1.252 + IMPORT_C void Append(const TUint8 *aBuf,TInt aLength);
1.253 + IMPORT_C void Fill(TChar aChar);
1.254 + IMPORT_C void Fill(TChar aChar,TInt aLength);
1.255 + IMPORT_C void FillZ();
1.256 + IMPORT_C void FillZ(TInt aLength);
1.257 + IMPORT_C void Num(TInt64 aVal);
1.258 + IMPORT_C void Num(TUint64 aVal, TRadix aRadix);
1.259 + IMPORT_C void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
1.260 + IMPORT_C void AppendNum(TInt64 aVal);
1.261 + IMPORT_C void AppendNum(TUint64 aVal, TRadix aRadix);
1.262 + IMPORT_C void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
1.263 +#ifndef __KERNEL_MODE__
1.264 + IMPORT_C TPtr8 LeftTPtr(TInt aLength) const;
1.265 + IMPORT_C TPtr8 RightTPtr(TInt aLength) const;
1.266 + IMPORT_C TPtr8 MidTPtr(TInt aPos) const;
1.267 + IMPORT_C TPtr8 MidTPtr(TInt aPos,TInt aLength) const;
1.268 + IMPORT_C const TUint8 *PtrZ();
1.269 + IMPORT_C void CopyF(const TDesC8 &aDes);
1.270 + IMPORT_C void CopyC(const TDesC8 &aDes);
1.271 + IMPORT_C void CopyLC(const TDesC8 &aDes);
1.272 + IMPORT_C void CopyUC(const TDesC8 &aDes);
1.273 + IMPORT_C void CopyCP(const TDesC8 &aDes);
1.274 + IMPORT_C void Swap(TDes8 &aDes);
1.275 + IMPORT_C void AppendFill(TChar aChar,TInt aLength);
1.276 + IMPORT_C void ZeroTerminate();
1.277 + IMPORT_C void Fold();
1.278 + IMPORT_C void Collate();
1.279 + IMPORT_C void LowerCase();
1.280 + IMPORT_C void UpperCase();
1.281 + IMPORT_C void Capitalize();
1.282 + IMPORT_C void Repeat(const TUint8 *aBuf,TInt aLength);
1.283 + IMPORT_C void Repeat(const TDesC8 &aDes);
1.284 + IMPORT_C void Trim();
1.285 + IMPORT_C void TrimAll();
1.286 + IMPORT_C void TrimLeft();
1.287 + IMPORT_C void TrimRight();
1.288 + IMPORT_C void Insert(TInt aPos,const TDesC8 &aDes);
1.289 + IMPORT_C void Delete(TInt aPos,TInt aLength);
1.290 + IMPORT_C void Replace(TInt aPos,TInt aLength,const TDesC8 &aDes);
1.291 + IMPORT_C void Justify(const TDesC8 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
1.292 + IMPORT_C void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
1.293 + IMPORT_C void NumUC(TUint64 aVal, TRadix aRadix=EDecimal);
1.294 + IMPORT_C TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
1.295 + IMPORT_C void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
1.296 + IMPORT_C TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
1.297 + IMPORT_C void AppendNumUC(TUint64 aVal,TRadix aRadix=EDecimal);
1.298 + IMPORT_C void Format(TRefByValue<const TDesC8> aFmt,...);
1.299 + IMPORT_C void FormatList(const TDesC8 &aFmt,VA_LIST aList);
1.300 + IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
1.301 + IMPORT_C void AppendJustify(const TDesC8 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
1.302 + IMPORT_C void AppendJustify(const TUint8 *aString,TInt aWidth,TAlign anAlignment,TChar aFill);
1.303 + IMPORT_C void AppendJustify(const TUint8 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
1.304 + IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,TDes8Overflow *aOverflowHandler,...);
1.305 + IMPORT_C void AppendFormat(TRefByValue<const TDesC8> aFmt,...);
1.306 + IMPORT_C void AppendFormatList(const TDesC8 &aFmt,VA_LIST aList,TDes8Overflow *aOverflowHandler=NULL);
1.307 + IMPORT_C TPtr16 Expand();
1.308 + IMPORT_C void Collapse();
1.309 +#endif //__KERNEL_MODE__
1.310 +protected:
1.311 + inline TDes8(TInt aType,TInt aLength,TInt aMaxLength);
1.312 + inline TUint8 *WPtr() const;
1.313 + inline TDes8() {}
1.314 +// delay this for a while
1.315 +#ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS
1.316 + inline TDes8(const TDes8& aOther) : TDesC8(aOther), iMaxLength(aOther.iMaxLength) {}
1.317 +#endif
1.318 + void DoAppendNum(TUint64 aVal, TRadix aRadix, TUint aA, TInt aW);
1.319 + void DoPadAppendNum(TInt aLength, TInt aW, const TUint8* aBuf);
1.320 +protected:
1.321 + TInt iMaxLength;
1.322 + __DECLARE_TEST;
1.323 + };
1.324 +//
1.325 +class TPtr8 : public TDes8
1.326 +/**
1.327 +@publishedAll
1.328 +@released
1.329 +
1.330 +8-bit modifiable pointer descriptor.
1.331 +
1.332 +This is a descriptor class intended for instantiation and encapsulates a
1.333 +pointer to the 8-bit data that it represents. The data can live in ROM or
1.334 +RAM and this location is separate from the descriptor object itself.
1.335 +
1.336 +The data is intended to be accessed and modified through this descriptor.
1.337 +The base classes provide the functions through which the data can be
1.338 +manipulated.
1.339 +
1.340 +@see TPtr
1.341 +@see TPtrC8
1.342 +@see TDesC8
1.343 +@see TDes8
1.344 +@see TBufC8
1.345 +@see TBuf8
1.346 +@see HBufC8
1.347 +*/
1.348 + {
1.349 +public:
1.350 + IMPORT_C TPtr8(TUint8 *aBuf,TInt aMaxLength);
1.351 + IMPORT_C TPtr8(TUint8 *aBuf,TInt aLength,TInt aMaxLength);
1.352 + inline TPtr8& operator=(const TUint8 *aString);
1.353 + inline TPtr8& operator=(const TDesC8& aDes);
1.354 + inline TPtr8& operator=(const TPtr8& aPtr);
1.355 + inline void Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength);
1.356 + inline void Set(const TPtr8 &aPtr);
1.357 +private:
1.358 + IMPORT_C TPtr8(TBufCBase8 &aLcb,TInt aMaxLength);
1.359 +protected:
1.360 + TUint8 *iPtr;
1.361 +private:
1.362 + friend class TBufCBase8;
1.363 + __DECLARE_TEST;
1.364 + };
1.365 +//
1.366 +class TBufCBase8 : public TDesC8
1.367 +/**
1.368 +@internalAll
1.369 +*/
1.370 + {
1.371 +protected:
1.372 + IMPORT_C TBufCBase8();
1.373 + inline TBufCBase8(TInt aLength);
1.374 + IMPORT_C TBufCBase8(const TUint8 *aString,TInt aMaxLength);
1.375 + IMPORT_C TBufCBase8(const TDesC8 &aDes,TInt aMaxLength);
1.376 + IMPORT_C void Copy(const TUint8 *aString,TInt aMaxLength);
1.377 + IMPORT_C void Copy(const TDesC8 &aDes,TInt aMaxLength);
1.378 + inline TPtr8 DoDes(TInt aMaxLength);
1.379 + inline TUint8 *WPtr() const;
1.380 + };
1.381 +//
1.382 +#ifndef __KERNEL_MODE__
1.383 +class RReadStream;
1.384 +class HBufC8 : public TBufCBase8
1.385 +/**
1.386 +@publishedAll
1.387 +@released
1.388 +
1.389 +8-bit heap descriptor.
1.390 +
1.391 +This is a descriptor class which provides a buffer of fixed length, allocated
1.392 +on the heap, for containing and accessing data.
1.393 +
1.394 +The class is intended for instantiation.
1.395 +
1.396 +Heap descriptors have the important property that they can be made larger
1.397 +or smaller, changing the size of the descriptor buffer. This is achieved by
1.398 +reallocating the descriptor. Unlike the behaviour of dynamic buffers,
1.399 +reallocation is not done automatically.
1.400 +
1.401 +Data is intended to be accessed, but not modified; however, it can be
1.402 +completely replaced using the assignment operators of this class. The base
1.403 +class (TDesC8) provides the functions through which the data is accessed.
1.404 +
1.405 +The descriptor is hosted by a heap cell, and the 8-bit data that the
1.406 +descriptor represents is part of the descriptor object itself. The size of the
1.407 +cell depends on the requested maximum length of the descriptor buffer when the
1.408 +descriptor is created or re-allocated.
1.409 +
1.410 +It is important to note that the size of the allocated cell, and, therefore,
1.411 +the resulting maximum length of the descriptor, may be larger than requested
1.412 +due to the way memory is allocated in Symbian OS. The amount by which this
1.413 +may be rounded up depends on the platform and build type.
1.414 +
1.415 +@see HBufC
1.416 +@see TPtr8
1.417 +@see TDesC8
1.418 +*/
1.419 + {
1.420 +public:
1.421 + IMPORT_C static HBufC8 *New(TInt aMaxLength);
1.422 + IMPORT_C static HBufC8 *NewL(TInt aMaxLength);
1.423 + IMPORT_C static HBufC8 *NewLC(TInt aMaxLength);
1.424 + IMPORT_C static HBufC8 *NewMax(TInt aMaxLength);
1.425 + IMPORT_C static HBufC8 *NewMaxL(TInt aMaxLength);
1.426 + IMPORT_C static HBufC8 *NewMaxLC(TInt aMaxLength);
1.427 + IMPORT_C static HBufC8 *NewL(RReadStream &aStream,TInt aMaxLength);
1.428 + IMPORT_C static HBufC8 *NewLC(RReadStream &aStream,TInt aMaxLength);
1.429 + IMPORT_C HBufC8& operator=(const TUint8 *aString);
1.430 + IMPORT_C HBufC8& operator=(const TDesC8 &aDes);
1.431 + inline HBufC8& operator=(const HBufC8 &aLcb);
1.432 + IMPORT_C HBufC8 *ReAlloc(TInt aMaxLength);
1.433 + IMPORT_C HBufC8 *ReAllocL(TInt aMaxLength);
1.434 + IMPORT_C TPtr8 Des();
1.435 +private:
1.436 + inline HBufC8(TInt aLength);
1.437 +private:
1.438 + TText8 iBuf[1];
1.439 + __DECLARE_TEST;
1.440 + };
1.441 +#endif
1.442 +//
1.443 +/**
1.444 +@internalComponent
1.445 +*/
1.446 +#define __Size8 (sizeof(TInt)/sizeof(TInt8))
1.447 +/**
1.448 +@internalComponent
1.449 +*/
1.450 +#define __Align8(s) ((((s)+__Size8-1)/__Size8)*__Size8)
1.451 +//
1.452 +template <TInt S>
1.453 +class TBufC8 : public TBufCBase8
1.454 +/**
1.455 +@publishedAll
1.456 +@released
1.457 +
1.458 +8-bit non-modifiable buffer descriptor.
1.459 +
1.460 +This is a descriptor class which provides a buffer of fixed length for
1.461 +containing and accessing TUint8 data.
1.462 +
1.463 +The class intended for instantiation. The 8-bit data that the descriptor
1.464 +represents is part of the descriptor object itself.
1.465 +
1.466 +The class is templated, based on an integer value which defines the size of
1.467 +the descriptor's data area.
1.468 +
1.469 +The data is intended to be accessed, but not modified; however, it can be
1.470 +completely replaced using the assignment operators of this class. The base
1.471 +class provides the functions through which the data is accessed.
1.472 +
1.473 +@see TBufC
1.474 +@see TDesC8
1.475 +@see TPtr8
1.476 +@see TUint8
1.477 +*/
1.478 + {
1.479 +public:
1.480 + inline TBufC8();
1.481 + inline TBufC8(const TUint8 *aString);
1.482 + inline TBufC8(const TDesC8 &aDes);
1.483 + inline TBufC8<S> &operator=(const TUint8 *aString);
1.484 + inline TBufC8<S> &operator=(const TDesC8 &aDes);
1.485 + inline TPtr8 Des();
1.486 +protected:
1.487 + TUint8 iBuf[__Align8(S)];
1.488 + };
1.489 +//
1.490 +class TBufBase8 : public TDes8
1.491 +/**
1.492 +@internalAll
1.493 +*/
1.494 + {
1.495 +protected:
1.496 + IMPORT_C TBufBase8(TInt aMaxLength);
1.497 + IMPORT_C TBufBase8(TInt aLength,TInt aMaxLength);
1.498 + IMPORT_C TBufBase8(const TUint8* aString,TInt aMaxLength);
1.499 + IMPORT_C TBufBase8(const TDesC8& aDes,TInt aMaxLength);
1.500 + };
1.501 +//
1.502 +template <TInt S>
1.503 +class TBuf8 : public TBufBase8
1.504 +/**
1.505 +@publishedAll
1.506 +@released
1.507 +
1.508 +A descriptor class which provides a buffer of fixed length for
1.509 +containing, accessing and manipulating TUint8 data.
1.510 +
1.511 +The class is intended for instantiation. The 8-bit data that the descriptor
1.512 +represents is part of the descriptor object itself.
1.513 +
1.514 +The class is templated, based on an integer value which determines the size
1.515 +of the data area which is created as part of the buffer descriptor object;
1.516 +this is also the maximum length of the descriptor.
1.517 +
1.518 +The data is intended to be both accessed and modified. The base classes provide
1.519 +the functions through which the data is accessed.
1.520 +
1.521 +@see TBuf
1.522 +@see TDesC8
1.523 +@see TDes8
1.524 +@see TPtr8
1.525 +*/
1.526 + {
1.527 +public:
1.528 + inline TBuf8();
1.529 + inline explicit TBuf8(TInt aLength);
1.530 + inline TBuf8(const TUint8* aString);
1.531 + inline TBuf8(const TDesC8& aDes);
1.532 + inline TBuf8<S>& operator=(const TUint8* aString);
1.533 + inline TBuf8<S>& operator=(const TDesC8& aDes);
1.534 + inline TBuf8<S>& operator=(const TBuf8<S>& aBuf);
1.535 +protected:
1.536 + TUint8 iBuf[__Align8(S)];
1.537 + };
1.538 +
1.539 +//
1.540 +template <TInt S>
1.541 +class TAlignedBuf8 : public TBufBase8
1.542 +/**
1.543 +@internalComponent
1.544 +
1.545 +A descriptor class functionally identical to TBuf8, the only
1.546 +difference from it being that TAlignedBuf8's internal buffer
1.547 +is guaranteed to be 64-bit aligned.
1.548 +
1.549 +At present this class is not intended for general use. It exists
1.550 +solely to support TPckgBuf which derives from it.
1.551 +
1.552 +@see TBuf8
1.553 +@see TPckgBuf
1.554 +*/
1.555 +{
1.556 +public:
1.557 + inline TAlignedBuf8();
1.558 + inline explicit TAlignedBuf8(TInt aLength);
1.559 + inline TAlignedBuf8(const TUint8* aString);
1.560 + inline TAlignedBuf8(const TDesC8& aDes);
1.561 + inline TAlignedBuf8<S>& operator=(const TUint8* aString);
1.562 + inline TAlignedBuf8<S>& operator=(const TDesC8& aDes);
1.563 + inline TAlignedBuf8<S>& operator=(const TAlignedBuf8<S>& aBuf);
1.564 +protected:
1.565 + union {
1.566 + double only_here_to_force_8byte_alignment;
1.567 + TUint8 iBuf[__Align8(S)];
1.568 + };
1.569 +};
1.570 +
1.571 +#ifndef __KERNEL_MODE__
1.572 +
1.573 +class RBuf8 : public TDes8
1.574 +/**
1.575 +@publishedAll
1.576 +@released
1.577 +
1.578 +8 bit resizable buffer descriptor.
1.579 +
1.580 +The class provides a buffer that contains, accesses and manipulates
1.581 +TUint8 data. The buffer itself is on the heap, and is managed by the class.
1.582 +
1.583 +Internally, RBuf8 behaves in one of two ways:
1.584 +
1.585 +- as a TPtr8 descriptor type, where the buffer just contains data
1.586 +- as a pointer to a heap descriptor, an HBufC8* type, where the buffer
1.587 + contains both descriptor information and the data.
1.588 +
1.589 +Note that the handling of the distinction is hidden from view.
1.590 +
1.591 +An RBuf8 object can allocate its own buffer. Alternatively, it can take
1.592 +ownership of a pre-existing section of allocated memory, or it can take
1.593 +ownership of a pre-existing heap descriptor. It can also reallocate the buffer
1.594 +to resize it. Regardless of the way in which the buffer has been allocated,
1.595 +the RBuf8 object is responsible for freeing memory when the object itself is closed.
1.596 +
1.597 +The class is intended for instantiation.
1.598 +
1.599 +The class is derived from TDes8, which means that data can be both accessed
1.600 +and modified. The base classes provide the functions through which the data is
1.601 +accessed. In addition, an RBuf8 object can be passed to any function that is
1.602 +prototyped to take a TDes8 or a TDesC8 type.
1.603 +
1.604 +@see TBuf8
1.605 +@see TPtr8
1.606 +@see HBufC8
1.607 +@see TDesC8
1.608 +@see TDes8
1.609 +*/
1.610 + {
1.611 +public:
1.612 + IMPORT_C RBuf8();
1.613 + IMPORT_C explicit RBuf8(HBufC8* aHBuf);
1.614 + inline RBuf8& operator=(const TUint8* aString);
1.615 + inline RBuf8& operator=(const TDesC8& aDes);
1.616 + inline RBuf8& operator=(const RBuf8& aDes);
1.617 + IMPORT_C void Assign(const RBuf8& aRBuf);
1.618 + IMPORT_C void Assign(TUint8 *aHeapCell,TInt aMaxLength);
1.619 + IMPORT_C void Assign(TUint8 *aHeapCell,TInt aLength,TInt aMaxLength);
1.620 + IMPORT_C void Assign(HBufC8* aHBuf);
1.621 + IMPORT_C void Swap(RBuf8& aRBuf);
1.622 + IMPORT_C TInt Create(TInt aMaxLength);
1.623 + IMPORT_C void CreateL(TInt aMaxLength);
1.624 + IMPORT_C TInt CreateMax(TInt aMaxLength);
1.625 + IMPORT_C void CreateMaxL(TInt aMaxLength);
1.626 + inline void CreateL(RReadStream &aStream,TInt aMaxLength);
1.627 + IMPORT_C TInt Create(const TDesC8& aDes);
1.628 + IMPORT_C void CreateL(const TDesC8& aDes);
1.629 + IMPORT_C TInt Create(const TDesC8& aDes,TInt aMaxLength);
1.630 + IMPORT_C void CreateL(const TDesC8& aDes,TInt aMaxLength);
1.631 + IMPORT_C TInt ReAlloc(TInt aMaxLength);
1.632 + IMPORT_C void ReAllocL(TInt aMaxLength);
1.633 + IMPORT_C void Close();
1.634 + IMPORT_C void CleanupClosePushL();
1.635 +
1.636 +protected:
1.637 + IMPORT_C RBuf8(TInt aType,TInt aLength,TInt aMaxLength);
1.638 + RBuf8(const RBuf8&); // Outlaw copy construction
1.639 + union
1.640 + {
1.641 + TUint8* iEPtrType; //Pointer to data used when RBuf is of EPtr type
1.642 + HBufC8* iEBufCPtrType; //Pointer to data used when RBuf is of EBufCPtr type
1.643 + };
1.644 + __DECLARE_TEST;
1.645 + };
1.646 +
1.647 +#endif
1.648 +
1.649 +/**
1.650 +@publishedAll
1.651 +@released
1.652 +
1.653 +Value reference used in operator TLitC8::__TRefDesC8()
1.654 +
1.655 +@see TRefByValue
1.656 +*/
1.657 +typedef TRefByValue<const TDesC8> __TRefDesC8;
1.658 +
1.659 +
1.660 +
1.661 +
1.662 +template <TInt S>
1.663 +class TLitC8
1.664 +/**
1.665 +@publishedAll
1.666 +@released
1.667 +
1.668 +Encapsulates literal text.
1.669 +
1.670 +This is always constructed using an _LIT8 macro.
1.671 +
1.672 +This class is build independent; i.e. an explicit 8-bit build variant
1.673 +is generated for both a non-Unicode build and a Unicode build.
1.674 +
1.675 +The class has no explicit constructors.
1.676 +
1.677 +@see _LIT8
1.678 +*/
1.679 + {
1.680 +public:
1.681 + inline const TDesC8* operator&() const;
1.682 + inline operator const TDesC8&() const;
1.683 + inline const TDesC8& operator()() const;
1.684 + inline operator const __TRefDesC8() const;
1.685 +public:
1.686 + /**
1.687 + @internalComponent
1.688 + */
1.689 + TUint iTypeLength;
1.690 +
1.691 + /**
1.692 + @internalComponent
1.693 + */
1.694 + TText8 iBuf[__Align8(S)];
1.695 + };
1.696 +
1.697 +#endif