|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__DESCRIPTORS_H__) |
|
17 #define __DESCRIPTORS_H__ |
|
18 |
|
19 #include <pcstore/pcstoredef.h> |
|
20 |
|
21 namespace PCStore |
|
22 { |
|
23 class CMemoryBlock; |
|
24 /** |
|
25 @internalAll |
|
26 |
|
27 Class to represent 8-bit descriptors. |
|
28 |
|
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. |
|
34 |
|
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. |
|
39 */ |
|
40 class CDes8 |
|
41 { |
|
42 public: |
|
43 CDes8(); |
|
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); |
|
49 ~CDes8(); |
|
50 |
|
51 const TUint8* Ptr() const; |
|
52 TInt32 Length() const; |
|
53 TInt32 MaxLength() const ; |
|
54 TInt32 Size() const; |
|
55 |
|
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); |
|
62 |
|
63 CDes8& operator=(const CDes8& aDes); |
|
64 TBool operator==(const CDes8& aDes) const; |
|
65 TBool operator!=(const CDes8& aDes) const; |
|
66 |
|
67 |
|
68 private: |
|
69 CMemoryBlock* iMemoryBlock; |
|
70 TInt32 iLength; |
|
71 }; |
|
72 |
|
73 |
|
74 /** |
|
75 @internalAll |
|
76 |
|
77 Class to represent 16-bit descriptor. |
|
78 |
|
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. |
|
83 |
|
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. |
|
88 */ |
|
89 class CDes16 |
|
90 { |
|
91 |
|
92 public: |
|
93 CDes16(); |
|
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); |
|
99 ~CDes16(); |
|
100 |
|
101 const TUint16* Ptr() const; |
|
102 TInt32 Length() const; |
|
103 TInt32 MaxLength() const ; |
|
104 TInt32 Size() const; |
|
105 |
|
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); |
|
112 |
|
113 CDes16& operator=(const CDes16& aDes); |
|
114 TBool operator==(const CDes16& aDes) const; |
|
115 TBool operator!=(const CDes16& aDes) const; |
|
116 |
|
117 private: |
|
118 CMemoryBlock* iMemoryBlock; |
|
119 TInt32 iLength; |
|
120 }; |
|
121 } |
|
122 #endif // !defined(__DESCRIPTORS_H__) |