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