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