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