1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__DESCRIPTORS_H__)
17 #define __DESCRIPTORS_H__
19 #include <pcstore/pcstoredef.h>
27 Class to represent 8-bit descriptors.
29 This class implements a subset of 8-bit descriptor's behaviour, which are necessary
30 for the externalization and internalization of 8-bit descriptors. It encapsulates
31 the data members containing the data, its maximum length and actual length. It also
32 provides member functions to append and reset the data, as well as get the pointer of
33 the data. However, there is no method to partly modify the data.
35 The constructors, Set, Append, and assignment methods take a copy of the data they're
36 given, which means it allocates memory to hold the data and releases it when needed.
37 Data represented by this class is treated as a contiguous set of 8-bit
38 (i.e. single byte) values or data items.
44 CDes8(const CDes8& aDes);
45 explicit CDes8(TInt32 aMaxLength);
46 CDes8(const TUint8* aPtr);
47 CDes8(const TUint8* aPtr, TInt32 aLength);
48 CDes8(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
51 const TUint8* Ptr() const;
52 TInt32 Length() const;
53 TInt32 MaxLength() const ;
56 void SetLength(TInt32 aLength);
57 void Set(const CDes8& aDes);
58 void Set(const TUint8* aPtr, TInt32 aLength);
59 void Set(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
60 void Append(const CDes8& aDes);
61 void Append(const TUint8* aPtr, TInt32 aLength);
63 CDes8& operator=(const CDes8& aDes);
64 TBool operator==(const CDes8& aDes) const;
65 TBool operator!=(const CDes8& aDes) const;
69 CMemoryBlock* iMemoryBlock;
77 Class to represent 16-bit descriptor.
79 This class implements a subset of 16-bit descriptor's behaviour, which are necessary
80 for the externalization and internalization of 16-bit descriptors. It encapsulates
81 the data members containing the data, its maximum length and actual length. It also
82 provides member functions to access and reset, but not modify, the data.
84 The constructors, Set, Append, and assignment methods take a copy of the data they're
85 given, which means it allocates memory to hold the data and releases it when needed.
86 Data represented by this class is treated as a contiguous set of 16-bit
87 (i.e. 2-byte word) values or data items.
94 CDes16(const CDes16& aDes);
95 explicit CDes16(TInt32 aMaxLength);
96 CDes16(const TUint16* aPtr);
97 CDes16(const TUint16* aPtr, TInt32 aLength);
98 CDes16(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
101 const TUint16* Ptr() const;
102 TInt32 Length() const;
103 TInt32 MaxLength() const ;
106 void SetLength(TInt32 aLength);
107 void Set(const CDes16& aDes);
108 void Set(const TUint16* aPtr, TInt32 aLength);
109 void Set(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
110 void Append(const CDes16& aDes);
111 void Append(const TUint16* aPtr, TInt32 aLength);
113 CDes16& operator=(const CDes16& aDes);
114 TBool operator==(const CDes16& aDes) const;
115 TBool operator!=(const CDes16& aDes) const;
118 CMemoryBlock* iMemoryBlock;
122 #endif // !defined(__DESCRIPTORS_H__)