williamr@4: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // williamr@4: williamr@4: #if !defined(__DESCRIPTORS_H__) williamr@4: #define __DESCRIPTORS_H__ williamr@4: williamr@4: #include williamr@4: williamr@4: namespace PCStore williamr@4: { williamr@4: class CMemoryBlock; williamr@4: /** williamr@4: @internalAll williamr@4: williamr@4: Class to represent 8-bit descriptors. williamr@4: williamr@4: This class implements a subset of 8-bit descriptor's behaviour, which are necessary williamr@4: for the externalization and internalization of 8-bit descriptors. It encapsulates williamr@4: the data members containing the data, its maximum length and actual length. It also williamr@4: provides member functions to append and reset the data, as well as get the pointer of williamr@4: the data. However, there is no method to partly modify the data. williamr@4: williamr@4: The constructors, Set, Append, and assignment methods take a copy of the data they're williamr@4: given, which means it allocates memory to hold the data and releases it when needed. williamr@4: Data represented by this class is treated as a contiguous set of 8-bit williamr@4: (i.e. single byte) values or data items. williamr@4: */ williamr@4: class CDes8 williamr@4: { williamr@4: public: williamr@4: CDes8(); williamr@4: CDes8(const CDes8& aDes); williamr@4: explicit CDes8(TInt32 aMaxLength); williamr@4: CDes8(const TUint8* aPtr); williamr@4: CDes8(const TUint8* aPtr, TInt32 aLength); williamr@4: CDes8(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength); williamr@4: ~CDes8(); williamr@4: williamr@4: const TUint8* Ptr() const; williamr@4: TInt32 Length() const; williamr@4: TInt32 MaxLength() const ; williamr@4: TInt32 Size() const; williamr@4: williamr@4: void SetLength(TInt32 aLength); williamr@4: void Set(const CDes8& aDes); williamr@4: void Set(const TUint8* aPtr, TInt32 aLength); williamr@4: void Set(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength); williamr@4: void Append(const CDes8& aDes); williamr@4: void Append(const TUint8* aPtr, TInt32 aLength); williamr@4: williamr@4: CDes8& operator=(const CDes8& aDes); williamr@4: TBool operator==(const CDes8& aDes) const; williamr@4: TBool operator!=(const CDes8& aDes) const; williamr@4: williamr@4: williamr@4: private: williamr@4: CMemoryBlock* iMemoryBlock; williamr@4: TInt32 iLength; williamr@4: }; williamr@4: williamr@4: williamr@4: /** williamr@4: @internalAll williamr@4: williamr@4: Class to represent 16-bit descriptor. williamr@4: williamr@4: This class implements a subset of 16-bit descriptor's behaviour, which are necessary williamr@4: for the externalization and internalization of 16-bit descriptors. It encapsulates williamr@4: the data members containing the data, its maximum length and actual length. It also williamr@4: provides member functions to access and reset, but not modify, the data. williamr@4: williamr@4: The constructors, Set, Append, and assignment methods take a copy of the data they're williamr@4: given, which means it allocates memory to hold the data and releases it when needed. williamr@4: Data represented by this class is treated as a contiguous set of 16-bit williamr@4: (i.e. 2-byte word) values or data items. williamr@4: */ williamr@4: class CDes16 williamr@4: { williamr@4: williamr@4: public: williamr@4: CDes16(); williamr@4: CDes16(const CDes16& aDes); williamr@4: explicit CDes16(TInt32 aMaxLength); williamr@4: CDes16(const TUint16* aPtr); williamr@4: CDes16(const TUint16* aPtr, TInt32 aLength); williamr@4: CDes16(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength); williamr@4: ~CDes16(); williamr@4: williamr@4: const TUint16* Ptr() const; williamr@4: TInt32 Length() const; williamr@4: TInt32 MaxLength() const ; williamr@4: TInt32 Size() const; williamr@4: williamr@4: void SetLength(TInt32 aLength); williamr@4: void Set(const CDes16& aDes); williamr@4: void Set(const TUint16* aPtr, TInt32 aLength); williamr@4: void Set(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength); williamr@4: void Append(const CDes16& aDes); williamr@4: void Append(const TUint16* aPtr, TInt32 aLength); williamr@4: williamr@4: CDes16& operator=(const CDes16& aDes); williamr@4: TBool operator==(const CDes16& aDes) const; williamr@4: TBool operator!=(const CDes16& aDes) const; williamr@4: williamr@4: private: williamr@4: CMemoryBlock* iMemoryBlock; williamr@4: TInt32 iLength; williamr@4: }; williamr@4: } williamr@4: #endif // !defined(__DESCRIPTORS_H__)