epoc32/include/pcstore/descriptors.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/pcstore/descriptors.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,122 @@
     1.4 +// Copyright (c) 2006-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 "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 +//
    1.18 +
    1.19 +#if !defined(__DESCRIPTORS_H__)
    1.20 +#define __DESCRIPTORS_H__
    1.21 +
    1.22 +#include <pcstore/pcstoredef.h>
    1.23 +
    1.24 +namespace PCStore
    1.25 +{
    1.26 +class CMemoryBlock;
    1.27 +/**
    1.28 +@internalAll
    1.29 +
    1.30 +Class to represent 8-bit descriptors.
    1.31 +
    1.32 +This class implements a subset of 8-bit descriptor's behaviour, which are necessary 
    1.33 +for the externalization and internalization of 8-bit descriptors. It encapsulates 
    1.34 +the data members containing the data, its maximum length and actual length. It also 
    1.35 +provides member functions to append and reset the data, as well as get the pointer of 
    1.36 +the data. However, there is no method to partly modify the data.
    1.37 +
    1.38 +The constructors, Set, Append, and assignment methods take a copy of the data they're 
    1.39 +given, which means it allocates memory to hold the data and releases it when needed.
    1.40 +Data represented by this class is treated as a contiguous set of 8-bit 
    1.41 +(i.e. single byte) values or data items.
    1.42 +*/
    1.43 +class CDes8
    1.44 +	{
    1.45 +public:
    1.46 +	CDes8();
    1.47 +	CDes8(const CDes8& aDes);
    1.48 +	explicit CDes8(TInt32 aMaxLength);
    1.49 +	CDes8(const TUint8* aPtr);
    1.50 +	CDes8(const TUint8* aPtr, TInt32 aLength);
    1.51 +	CDes8(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
    1.52 +	~CDes8();
    1.53 +	
    1.54 +	const TUint8* Ptr() const;
    1.55 +	TInt32 Length() const;
    1.56 +	TInt32 MaxLength() const ;
    1.57 +	TInt32 Size() const;
    1.58 +	
    1.59 +	void SetLength(TInt32 aLength);
    1.60 +	void Set(const CDes8& aDes);
    1.61 +	void Set(const TUint8* aPtr, TInt32 aLength);
    1.62 +	void Set(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
    1.63 +	void Append(const CDes8& aDes);
    1.64 +	void Append(const TUint8* aPtr, TInt32 aLength);
    1.65 +
    1.66 +	CDes8& operator=(const CDes8& aDes);
    1.67 +	TBool operator==(const CDes8& aDes) const;
    1.68 +	TBool operator!=(const CDes8& aDes) const;	
    1.69 +
    1.70 +
    1.71 +private:
    1.72 +	CMemoryBlock* iMemoryBlock;
    1.73 +	TInt32 iLength;
    1.74 +	};
    1.75 +
    1.76 +
    1.77 +/**
    1.78 +@internalAll
    1.79 +
    1.80 +Class to represent 16-bit descriptor.
    1.81 +
    1.82 +This class implements a subset of 16-bit descriptor's behaviour, which are necessary 
    1.83 +for the externalization and internalization of 16-bit descriptors. It encapsulates 
    1.84 +the data members containing the data, its maximum length and actual length. It also 
    1.85 +provides member functions to access and reset, but not modify, the data.
    1.86 +
    1.87 +The constructors, Set, Append, and assignment methods take a copy of the data they're 
    1.88 +given, which means it allocates memory to hold the data and releases it when needed.
    1.89 +Data represented by this class is treated as a contiguous set of 16-bit 
    1.90 +(i.e. 2-byte word) values or data items.
    1.91 +*/
    1.92 +class CDes16
    1.93 +	{
    1.94 +
    1.95 +public:
    1.96 +	CDes16();
    1.97 +	CDes16(const CDes16& aDes);
    1.98 +	explicit CDes16(TInt32 aMaxLength);
    1.99 +	CDes16(const TUint16* aPtr);
   1.100 +	CDes16(const TUint16* aPtr, TInt32 aLength);
   1.101 +	CDes16(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
   1.102 +	~CDes16();
   1.103 +
   1.104 +	const TUint16* Ptr() const;
   1.105 +	TInt32 Length() const;
   1.106 +	TInt32 MaxLength() const ;
   1.107 +	TInt32 Size() const;
   1.108 +	
   1.109 +	void SetLength(TInt32 aLength);
   1.110 +	void Set(const CDes16& aDes);
   1.111 +	void Set(const TUint16* aPtr, TInt32 aLength);
   1.112 +	void Set(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
   1.113 +	void Append(const CDes16& aDes);
   1.114 +	void Append(const TUint16* aPtr, TInt32 aLength);
   1.115 +
   1.116 +	CDes16& operator=(const CDes16& aDes);
   1.117 +	TBool operator==(const CDes16& aDes) const;
   1.118 +	TBool operator!=(const CDes16& aDes) const;	
   1.119 +
   1.120 +private:
   1.121 +	CMemoryBlock* iMemoryBlock;
   1.122 +	TInt32 iLength;
   1.123 +	};
   1.124 +}
   1.125 +#endif // !defined(__DESCRIPTORS_H__)