sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\e32des16.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __E32DES16_H__ sl@0: #define __E32DES16_H__ sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: const TUint KMaskDesLength16=0xfffffff; sl@0: sl@0: class TBufCBase16; sl@0: class TDes16; sl@0: class TPtrC16; sl@0: class TPtr16; sl@0: struct TCollationMethod; sl@0: class HBufC16; sl@0: class HBufC8; sl@0: sl@0: class TDesC16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Abstract base class for 16-bit descriptors. sl@0: sl@0: The class encapsulates the data member containing the length of data sl@0: represented by a 16-bit descriptor. It also provides member functions through sl@0: which the data can be accessed, but not modified. sl@0: sl@0: Data represented by this class is treated as a contiguous set of 16-bit (i.e. sl@0: double byte) values or data items. sl@0: sl@0: This class cannot be instantiated as it is intended to form part of a class sl@0: hierarchy; it provides a well defined part of descriptor behaviour. It can, sl@0: however, be passed as an argument type for functions which want access to sl@0: descriptor data but do not need to modify that data. sl@0: sl@0: @see TDesC sl@0: @see TPtrC16 sl@0: */ sl@0: { sl@0: public: sl@0: /** sl@0: A value returned by a call to HasPrefixC(). sl@0: sl@0: @see TDesC16::HasPrefixC sl@0: */ sl@0: enum TPrefix { sl@0: /** sl@0: Indicates that a supplied prefix can be extended to sl@0: be equivalent to the text at the start of a descriptor. sl@0: */ sl@0: EIsPrefix = 0, sl@0: /** sl@0: Indicates that a supplied prefix does not seem to be a sl@0: prefix, but it is possible that it could be extended to sl@0: become equivalent to text at the start of this descriptor. sl@0: */ sl@0: EMightBePrefix = 1, sl@0: /** sl@0: Indicates that a supplied prefix cannot be extended to be sl@0: equivalent to the text at the start of a descriptor. sl@0: */ sl@0: EIsNotPrefix = 2 sl@0: }; sl@0: public: sl@0: inline TBool operator<(const TDesC16 &aDes) const; sl@0: inline TBool operator<=(const TDesC16 &aDes) const; sl@0: inline TBool operator>(const TDesC16 &aDes) const; sl@0: inline TBool operator>=(const TDesC16 &aDes) const; sl@0: inline TBool operator==(const TDesC16 &aDes) const; sl@0: inline TBool operator!=(const TDesC16 &aDes) const; sl@0: inline const TUint16 &operator[](TInt anIndex) const; sl@0: inline TInt Length() const; sl@0: inline TInt Size() const; sl@0: IMPORT_C const TUint16 *Ptr() const; sl@0: IMPORT_C TInt Compare(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt CompareF(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt CompareC(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt CompareC(const TDesC16& aDes,TInt aMaxLevel,const TCollationMethod* aCollationMethod) const; sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: IMPORT_C HBufC16* GetNormalizedDecomposedFormL() const; sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: IMPORT_C HBufC16* GetFoldedDecomposedFormL() const; sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: IMPORT_C HBufC8* GetCollationKeysL(TInt aMaxLevel,const TCollationMethod* aCollationMethod) const; sl@0: IMPORT_C TInt Match(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt MatchF(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt MatchC(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt MatchC(const TDesC16 &aPattern, TInt aWildChar, TInt aWildSequenceChar, sl@0: TInt aEscapeChar, TInt aMaxLevel = 3, const TCollationMethod* aCollationMethod = NULL) const; sl@0: IMPORT_C TInt MatchC(const TDesC16 &aPattern, const TCollationMethod* aCollationMethod, sl@0: TInt aMaxLevel = 3, TInt aWildChar = '?', TInt aWildSequenceChar = '*', TInt aEscapeChar = 0) const; sl@0: IMPORT_C TInt Locate(TChar aChar) const; sl@0: IMPORT_C TInt LocateReverse(TChar aChar) const; sl@0: IMPORT_C TInt Find(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt Find(const TUint16 *aBuf,TInt aLen) const; sl@0: IMPORT_C TPrefix HasPrefixC(const TDesC16& aPossiblePrefix, TInt aLevel, const TCollationMethod* aCollationMethod) const; sl@0: IMPORT_C TPtrC16 Left(TInt aLength) const; sl@0: IMPORT_C TPtrC16 Right(TInt aLength) const; sl@0: IMPORT_C TPtrC16 Mid(TInt aPos) const; sl@0: IMPORT_C TPtrC16 Mid(TInt aPos,TInt aLength) const; sl@0: IMPORT_C TInt LocateF(TChar aChar) const; sl@0: IMPORT_C TInt LocateReverseF(TChar aChar) const; sl@0: IMPORT_C TInt FindF(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt FindF(const TUint16 *aBuf,TInt aLen) const; sl@0: IMPORT_C TInt FindC(const TDesC16 &aDes) const; sl@0: IMPORT_C TInt FindC(const TUint16 *aBuf,TInt aLen) const; sl@0: IMPORT_C TInt FindC(const TUint16 *aText,TInt aLength, TInt aMaxLevel) const; sl@0: IMPORT_C TInt FindC(const TDesC16 &aDes,TInt &aLengthFound, const TCollationMethod &aMethod,TInt aMaxLevel) const; sl@0: IMPORT_C HBufC16 *Alloc() const; sl@0: IMPORT_C HBufC16 *AllocL() const; sl@0: IMPORT_C HBufC16 *AllocLC() const; sl@0: protected: sl@0: inline TDesC16() {} sl@0: inline TDesC16(TInt aType,TInt aLength); sl@0: // delay this for a while sl@0: #ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS sl@0: inline TDesC16( const TDesC16& aOther) : iLength(aOther.iLength) {} sl@0: #endif sl@0: // inline ~TDesC16() {} Commented out for the moment since it breaks code sl@0: inline TInt Type() const; sl@0: inline void DoSetLength(TInt aLength); sl@0: IMPORT_C const TUint16 &AtC(TInt anIndex) const; sl@0: private: sl@0: TUint iLength; sl@0: __DECLARE_TEST; sl@0: }; sl@0: // sl@0: class TPtrC16 : public TDesC16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: 16-bit non-modifiable pointer descriptor. sl@0: sl@0: This is a descriptor class intended for instantiation and encapsulates a sl@0: pointer to the 16-bit data that it represents. The data can live in ROM or RAM sl@0: and this location is separate from the descriptor object itself. sl@0: sl@0: The data is intended to be accessed, but not changed, through this descriptor. sl@0: The base class provides the functions through which data is accessed. sl@0: sl@0: @see TPtr16 sl@0: @see TDesC16 sl@0: @see TDes16 sl@0: @see TBufC16 sl@0: @see TBuf16 sl@0: @see HBufC16 sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C TPtrC16(); sl@0: IMPORT_C TPtrC16(const TDesC16 &aDes); sl@0: IMPORT_C TPtrC16(const TUint16 *aString); sl@0: IMPORT_C TPtrC16(const TUint16 *aBuf,TInt aLength); sl@0: inline void Set(const TUint16 *aBuf,TInt aLength); sl@0: inline void Set(const TDesC16 &aDes); sl@0: inline void Set(const TPtrC16 &aPtr); sl@0: private: sl@0: TPtrC16& operator=(const TPtrC16 &aDes); sl@0: protected: sl@0: const TUint16 *iPtr; sl@0: private: sl@0: __DECLARE_TEST; sl@0: }; sl@0: // sl@0: class TDes16Overflow sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An interface that defines an overflow handler for a 16-bit descriptor. sl@0: sl@0: The interface encapsulates a function that is called when an attempt to append sl@0: formatted text fails because the descriptor is already at its maximum length. sl@0: sl@0: A derived class must provide an implementation for the Overflow() member function. sl@0: sl@0: @see TDes16::AppendFormat sl@0: */ sl@0: { sl@0: public: sl@0: /** sl@0: Handles the overflow. sl@0: sl@0: This function is called when the TDes16::AppendFormat() sl@0: variant that takes an overflow handler argument, fails. sl@0: sl@0: @param aDes The 16-bit modifiable descriptor whose overflow results in the sl@0: call to this overflow handler. sl@0: */ sl@0: virtual void Overflow(TDes16 &aDes)=0; sl@0: }; sl@0: // sl@0: class TDes16IgnoreOverflow : public TDes16Overflow sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A derived class which provides an implementation for the Overflow() member function sl@0: where truncation is required. sl@0: sl@0: @see TDes16::AppendFormat sl@0: */ sl@0: { sl@0: public: sl@0: /** sl@0: Handles the overflow. sl@0: sl@0: This function is called when the TDes16::AppendFormat() sl@0: variant that takes an overflow handler argument, fails. sl@0: sl@0: @param aDes The 16-bit modifiable descriptor whose overflow results in the sl@0: call to this overflow handler. sl@0: */ sl@0: IMPORT_C virtual void Overflow(TDes16 &aDes); sl@0: }; sl@0: // sl@0: class TRealFormat; sl@0: class TDes16 : public TDesC16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Abstract base class for 16-bit modifiable descriptors. sl@0: sl@0: The class encapsulates the data member containing the maximum length of data sl@0: represented by a 16-bit descriptor. It also provides member functions through sl@0: which the data can be modified. sl@0: sl@0: The class adds to the behaviour provided by TDesC16. sl@0: sl@0: This class cannot be instantiated as it is intended to form part of a class sl@0: hierarchy; it provides a well defined part of descriptor behaviour. It can, sl@0: however, be passed as an argument type for functions which need to both modify sl@0: and access descriptor data. sl@0: sl@0: @see TDes sl@0: @see TDesC8 sl@0: @see TDesC16 sl@0: */ sl@0: { sl@0: public: sl@0: inline TDes16& operator=(const TUint16 *aString); sl@0: inline TDes16& operator=(const TDesC16 &aDes); sl@0: inline TDes16& operator=(const TDes16 &aDes); sl@0: inline TInt MaxLength() const; sl@0: inline TInt MaxSize() const; sl@0: inline const TUint16 &operator[](TInt anIndex) const; sl@0: inline TUint16 &operator[](TInt anIndex); sl@0: inline TDes16 &operator+=(const TDesC16 &aDes); sl@0: IMPORT_C void Zero(); sl@0: IMPORT_C void SetLength(TInt aLength); sl@0: IMPORT_C void SetMax(); sl@0: IMPORT_C void Copy(const TDesC8 &aDes); sl@0: IMPORT_C void Copy(const TDesC16 &aDes); sl@0: IMPORT_C void Copy(const TUint16 *aBuf,TInt aLength); sl@0: IMPORT_C void Copy(const TUint16 *aString); sl@0: IMPORT_C void Append(TChar aChar); sl@0: IMPORT_C void Append(const TDesC16 &aDes); sl@0: IMPORT_C void Append(const TUint16 *aBuf,TInt aLength); sl@0: IMPORT_C void Fill(TChar aChar); sl@0: IMPORT_C void Fill(TChar aChar,TInt aLength); sl@0: IMPORT_C void FillZ(); sl@0: IMPORT_C void FillZ(TInt aLength); sl@0: IMPORT_C void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth); sl@0: IMPORT_C void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth); sl@0: IMPORT_C TPtr16 LeftTPtr(TInt aLength) const; sl@0: IMPORT_C TPtr16 RightTPtr(TInt aLength) const; sl@0: IMPORT_C TPtr16 MidTPtr(TInt aPos) const; sl@0: IMPORT_C TPtr16 MidTPtr(TInt aPos,TInt aLength) const; sl@0: IMPORT_C const TUint16 *PtrZ(); sl@0: IMPORT_C void CopyF(const TDesC16 &aDes); sl@0: IMPORT_C void CopyC(const TDesC16 &aDes); sl@0: IMPORT_C void CopyLC(const TDesC16 &aDes); sl@0: IMPORT_C void CopyUC(const TDesC16 &aDes); sl@0: IMPORT_C void CopyCP(const TDesC16 &aDes); sl@0: IMPORT_C void AppendFill(TChar aChar,TInt aLength); sl@0: IMPORT_C void ZeroTerminate(); sl@0: IMPORT_C void Swap(TDes16 &aDes); sl@0: IMPORT_C void Fold(); sl@0: IMPORT_C void Collate(); sl@0: IMPORT_C void LowerCase(); sl@0: IMPORT_C void UpperCase(); sl@0: IMPORT_C void Capitalize(); sl@0: IMPORT_C void Repeat(const TDesC16 &aDes); sl@0: IMPORT_C void Repeat(const TUint16 *aBuf,TInt aLength); sl@0: IMPORT_C void Trim(); sl@0: IMPORT_C void TrimAll(); sl@0: IMPORT_C void TrimLeft(); sl@0: IMPORT_C void TrimRight(); sl@0: IMPORT_C void Insert(TInt aPos,const TDesC16 &aDes); sl@0: IMPORT_C void Delete(TInt aPos,TInt aLength); sl@0: IMPORT_C void Replace(TInt aPos,TInt aLength,const TDesC16 &aDes); sl@0: IMPORT_C void Justify(const TDesC16 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill); sl@0: IMPORT_C void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth); sl@0: IMPORT_C void NumUC(TUint64 aVal, TRadix aRadix=EDecimal); sl@0: IMPORT_C TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP; sl@0: IMPORT_C void Num(TInt64 aVal); sl@0: IMPORT_C void Num(TUint64 aVal, TRadix aRadix); sl@0: IMPORT_C void Format(TRefByValue aFmt,...); sl@0: IMPORT_C void FormatList(const TDesC16 &aFmt,VA_LIST aList); sl@0: IMPORT_C void AppendJustify(const TDesC16 &Des,TInt aWidth,TAlign anAlignment,TChar aFill); sl@0: IMPORT_C void AppendJustify(const TDesC16 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill); sl@0: IMPORT_C void AppendJustify(const TUint16 *aString,TInt aWidth,TAlign anAlignment,TChar aFill); sl@0: IMPORT_C void AppendJustify(const TUint16 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill); sl@0: IMPORT_C void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth); sl@0: IMPORT_C void AppendNumUC(TUint64 aVal, TRadix aRadix=EDecimal); sl@0: IMPORT_C TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP; sl@0: IMPORT_C void AppendNum(TInt64 aVal); sl@0: IMPORT_C void AppendNum(TUint64 aVal, TRadix aRadix); sl@0: IMPORT_C void AppendFormat(TRefByValue aFmt,TDes16Overflow *aOverflowHandler,...); sl@0: IMPORT_C void AppendFormat(TRefByValue aFmt,...); sl@0: IMPORT_C void AppendFormatList(const TDesC16 &aFmt,VA_LIST aList,TDes16Overflow *aOverflowHandler=NULL); sl@0: IMPORT_C TPtr8 Collapse(); sl@0: protected: sl@0: inline TDes16() {} sl@0: inline TDes16(TInt aType,TInt aLength,TInt aMaxLength); sl@0: // delay this for a while sl@0: #ifdef SYMBIAN_FIX_TDESC_CONSTRUCTORS sl@0: inline TDes16(const TDes16& aOther) : TDesC16(aOther), iMaxLength(aOther.iMaxLength) {} sl@0: #endif sl@0: inline TUint16 *WPtr() const; sl@0: void DoAppendNum(TUint64 aVal, TRadix aRadix, TUint aA, TInt aW); sl@0: void DoPadAppendNum(TInt aLength, TInt aW, const TUint8* aBuf); sl@0: protected: sl@0: TInt iMaxLength; sl@0: __DECLARE_TEST; sl@0: }; sl@0: // sl@0: class TPtr16 : public TDes16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: 16-bit modifiable pointer descriptor sl@0: sl@0: This is a descriptor class intended for instantiation and encapsulates a sl@0: pointer to the 16-bit data that it represents. The data can live in ROM or sl@0: RAM and this location is separate from the descriptor object itself. sl@0: sl@0: The data is intended to be accessed and modified through this descriptor. sl@0: The base classes provide the functions through which the data can be sl@0: manipulated. sl@0: sl@0: @see TPtr sl@0: @see TPtrC16 sl@0: @see TDesC16 sl@0: @see TDes16 sl@0: @see TBufC16 sl@0: @see TBuf16 sl@0: @see HBufC16 sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C TPtr16(TUint16 *aBuf,TInt aMaxLength); sl@0: IMPORT_C TPtr16(TUint16 *aBuf,TInt aLength,TInt aMaxLength); sl@0: inline TPtr16& operator=(const TUint16 *aString); sl@0: inline TPtr16& operator=(const TDesC16& aDes); sl@0: inline TPtr16& operator=(const TPtr16& aDes); sl@0: inline void Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength); sl@0: inline void Set(const TPtr16 &aPtr); sl@0: private: sl@0: IMPORT_C TPtr16(TBufCBase16 &aLcb,TInt aMaxLength); sl@0: protected: sl@0: TUint16 *iPtr; sl@0: private: sl@0: friend class TBufCBase16; sl@0: __DECLARE_TEST; sl@0: }; sl@0: // sl@0: class TBufCBase16 : public TDesC16 sl@0: /** sl@0: @internalAll sl@0: */ sl@0: { sl@0: protected: sl@0: IMPORT_C TBufCBase16(); sl@0: inline TBufCBase16(TInt aLength); sl@0: IMPORT_C TBufCBase16(const TUint16 *aString,TInt aMaxLength); sl@0: IMPORT_C TBufCBase16(const TDesC16 &aDes,TInt aMaxLength); sl@0: IMPORT_C void Copy(const TUint16 *aString,TInt aMaxLength); sl@0: IMPORT_C void Copy(const TDesC16 &aDes,TInt aMaxLength); sl@0: inline TPtr16 DoDes(TInt aMaxLength); sl@0: inline TUint16 *WPtr() const; sl@0: }; sl@0: // sl@0: class RReadStream; sl@0: class HBufC16 : public TBufCBase16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: 16-bit heap descriptor. sl@0: sl@0: This is a descriptor class which provides a buffer of fixed length, allocated sl@0: on the heap, for containing and accessing data. sl@0: sl@0: The class is intended for instantiation. sl@0: sl@0: Heap descriptors have the important property that they can be made larger sl@0: or smaller, changing the size of the descriptor buffer. This is achieved by sl@0: reallocating the descriptor. Unlike the behaviour of dynamic buffers, reallocation sl@0: is not done automatically. sl@0: sl@0: Data is intended to be accessed, but not modified; however, it can be completely sl@0: replaced using the assignment operators of this class. The base class (TDesC16) provides sl@0: the functions through which the data is accessed. sl@0: sl@0: The descriptor is hosted by a heap cell, and the 16-bit data that the descriptor sl@0: represents is part of the descriptor object itself. The size of the cell depends sl@0: on the requested maximum length of the descriptor buffer when the descriptor sl@0: is created or re-allocated. sl@0: sl@0: It is important to note that the size of the allocated cell, and, therefore, sl@0: the resulting maximum length of the descriptor, may be larger than requested sl@0: due to the way memory is allocated in Symbian OS. The amount by which this sl@0: may be rounded up depends on the platform and build type. sl@0: sl@0: @see HBufC sl@0: @see TPtr16 sl@0: @see TDesC16 sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C static HBufC16 *New(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewL(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewLC(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewMax(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewMaxL(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewMaxLC(TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewL(RReadStream &aStream,TInt aMaxLength); sl@0: IMPORT_C static HBufC16 *NewLC(RReadStream &aStream,TInt aMaxLength); sl@0: IMPORT_C HBufC16& operator=(const TUint16 *aString); sl@0: IMPORT_C HBufC16& operator=(const TDesC16 &aDes); sl@0: inline HBufC16& operator=(const HBufC16 &aLcb); sl@0: IMPORT_C HBufC16 *ReAlloc(TInt aMaxLength); sl@0: IMPORT_C HBufC16 *ReAllocL(TInt aMaxLength); sl@0: IMPORT_C TPtr16 Des(); sl@0: private: sl@0: inline HBufC16(TInt aLength); sl@0: private: sl@0: TText16 iBuf[1]; sl@0: __DECLARE_TEST; sl@0: }; sl@0: // sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: #define __Size16 (sizeof(TInt)/sizeof(TInt16)) sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: #define __Align16(s) ((((s)+__Size16-1)/__Size16)*__Size16) sl@0: // sl@0: template sl@0: class TBufC16 : public TBufCBase16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: 16-bit non-modifiable buffer descriptor. sl@0: sl@0: This is a descriptor class which provides a buffer of fixed length for sl@0: containing and accessing TUint16 data. sl@0: sl@0: The class intended for instantiation. The 16-bit data that the descriptor sl@0: represents is part of the descriptor object itself. sl@0: sl@0: The class is templated, based on an integer value which defines the size of sl@0: the descriptor's data area. sl@0: sl@0: The data is intended to be accessed, but not modified; however, it can be sl@0: completely replaced using the assignment operators of this class. The base sl@0: class provides the functions through which the data is accessed. sl@0: sl@0: @see TBufC sl@0: @see TDesC16 sl@0: @see TPtr16 sl@0: @see TUint16 sl@0: */ sl@0: { sl@0: public: sl@0: inline TBufC16(); sl@0: inline TBufC16(const TUint16 *aString); sl@0: inline TBufC16(const TDesC16 &aDes); sl@0: inline TBufC16 &operator=(const TUint16 *aString); sl@0: inline TBufC16 &operator=(const TDesC16 &aDes); sl@0: inline TPtr16 Des(); sl@0: protected: sl@0: TUint16 iBuf[__Align16(S)]; sl@0: }; sl@0: // sl@0: class TBufBase16 : public TDes16 sl@0: /** sl@0: @internalAll sl@0: */ sl@0: { sl@0: protected: sl@0: IMPORT_C TBufBase16(TInt aMaxLength); sl@0: IMPORT_C TBufBase16(TInt aLength,TInt aMaxLength); sl@0: IMPORT_C TBufBase16(const TUint16* aString,TInt aMaxLength); sl@0: IMPORT_C TBufBase16(const TDesC16& aDes,TInt aMaxLength); sl@0: }; sl@0: // sl@0: template sl@0: class TBuf16 : public TBufBase16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A descriptor class which provides a buffer of fixed length for sl@0: containing, accessing and manipulating TUint16 data. sl@0: sl@0: The class is intended for instantiation. The 16-bit data that the descriptor sl@0: represents is part of the descriptor object itself. sl@0: sl@0: The class is templated, based on an integer value which determines the size sl@0: of the data area which is created as part of the buffer descriptor object; sl@0: this is also the maximum length of the descriptor. sl@0: sl@0: The data is intended to be both accessed and modified. The base classes provide sl@0: the functions through which the data is accessed. sl@0: sl@0: @see TBuf sl@0: @see TDesC16 sl@0: @see TDes16 sl@0: @see TPtr16 sl@0: */ sl@0: { sl@0: public: sl@0: inline TBuf16(); sl@0: inline explicit TBuf16(TInt aLength); sl@0: inline TBuf16(const TUint16* aString); sl@0: inline TBuf16(const TDesC16& aDes); sl@0: inline TBuf16& operator=(const TUint16* aString); sl@0: inline TBuf16& operator=(const TDesC16& aDes); sl@0: inline TBuf16& operator=(const TBuf16& aDes); sl@0: protected: sl@0: TUint16 iBuf[__Align16(S)]; sl@0: }; sl@0: sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: sl@0: class RBuf16 : public TDes16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: 16 bit resizable buffer descriptor. sl@0: sl@0: The class provides a buffer that contains, accesses and manipulates sl@0: TUint16 data. The buffer itself is on the heap, and is managed by the class. sl@0: sl@0: Internally, RBuf16 behaves in one of two ways: sl@0: sl@0: - as a TPtr16 descriptor type, where the buffer just contains data sl@0: - as a pointer to a heap descriptor, an HBufC16* type, where the buffer sl@0: contains both descriptor information and the data. sl@0: sl@0: Note that the handling of the distinction is hidden from view. sl@0: sl@0: An RBuf16 object can allocate its own buffer. Alternatively, it can take sl@0: ownership of a pre-existing section of allocated memory, or it can take sl@0: ownership of a pre-existing heap descriptor. It can also reallocate the buffer sl@0: to resize it. Regardless of the way in which the buffer has been allocated, sl@0: the RBuf16 object is responsible for freeing memory when the object itself is closed. sl@0: sl@0: The class is intended for instantiation. sl@0: sl@0: The class is derived from TDes16, which means that data can be both accessed sl@0: and modified. The base classes provide the functions through which the data is sl@0: accessed. In addition, an RBuf16 object can be passed to any function that is sl@0: prototyped to take a TDes16 or a TDesC16 type. sl@0: sl@0: @see TBuf16 sl@0: @see TPtr16 sl@0: @see HBufC16 sl@0: @see TDesC16 sl@0: @see TDes16 sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C RBuf16(); sl@0: IMPORT_C explicit RBuf16(HBufC16* aHBuf); sl@0: inline RBuf16& operator=(const TUint16* aString); sl@0: inline RBuf16& operator=(const TDesC16& aDes); sl@0: inline RBuf16& operator=(const RBuf16& aDes); sl@0: IMPORT_C void Assign(const RBuf16& aRBuf); sl@0: IMPORT_C void Assign(TUint16 *aHeapCell,TInt aMaxLength); sl@0: IMPORT_C void Assign(TUint16 *aHeapCell,TInt aLength,TInt aMaxLength); sl@0: IMPORT_C void Assign(HBufC16* aHBuf); sl@0: IMPORT_C void Swap(RBuf16& aRBuf); sl@0: IMPORT_C TInt Create(TInt aMaxLength); sl@0: IMPORT_C void CreateL(TInt aMaxLength); sl@0: IMPORT_C TInt CreateMax(TInt aMaxLength); sl@0: IMPORT_C void CreateMaxL(TInt aMaxLength); sl@0: inline void CreateL(RReadStream &aStream,TInt aMaxLength); sl@0: IMPORT_C TInt Create(const TDesC16& aDes); sl@0: IMPORT_C void CreateL(const TDesC16& aDes); sl@0: IMPORT_C TInt Create(const TDesC16& aDes,TInt aMaxLength); sl@0: IMPORT_C void CreateL(const TDesC16& aDes,TInt aMaxLength); sl@0: IMPORT_C TInt ReAlloc(TInt aMaxLength); sl@0: IMPORT_C void ReAllocL(TInt aMaxLength); sl@0: IMPORT_C void Close(); sl@0: IMPORT_C void CleanupClosePushL(); sl@0: sl@0: protected: sl@0: IMPORT_C RBuf16(TInt aType,TInt aLength,TInt aMaxLength); sl@0: RBuf16(const RBuf16&); // Outlaw copy construction sl@0: union sl@0: { sl@0: TUint16* iEPtrType; //Pointer to data used when RBuf is of EPtr type sl@0: HBufC16* iEBufCPtrType; //Pointer to data used when RBuf is of EBufCPtr type sl@0: }; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: #endif //__KERNEL_MODE__ sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Value reference used in operator TLitC16::__TRefDesC16() sl@0: sl@0: @see TRefByValue sl@0: */ sl@0: typedef TRefByValue __TRefDesC16; sl@0: sl@0: sl@0: sl@0: sl@0: template sl@0: class TLitC16 sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulates literal text. sl@0: sl@0: This is always constructed using an _LIT16 macro. sl@0: sl@0: This class is build independent; i.e. an explicit 16-bit build variant sl@0: is generated for both a non-Unicode build and a Unicode build. sl@0: sl@0: The class has no explicit constructors. sl@0: sl@0: @see _LIT16 sl@0: */ sl@0: { sl@0: public: sl@0: inline const TDesC16* operator&() const; sl@0: inline operator const TDesC16&() const; sl@0: inline const TDesC16& operator()() const; sl@0: inline operator const __TRefDesC16() const; sl@0: public: sl@0: #if defined(__GCC32__) sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: typedef wchar_t __TText; sl@0: #elif defined(__VC32__) sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: typedef wchar_t __TText; sl@0: #elif defined(__CW32__) sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: typedef TUint16 __TText; sl@0: #elif !defined(__TText_defined) sl@0: #error no typedef for __TText sl@0: #endif sl@0: public: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TUint iTypeLength; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: __TText iBuf[__Align16(S)]; sl@0: }; sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: #endif