williamr@4
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
2 |
// All rights reserved.
|
williamr@4
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
7 |
//
|
williamr@4
|
8 |
// Initial Contributors:
|
williamr@4
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@4
|
10 |
//
|
williamr@4
|
11 |
// Contributors:
|
williamr@4
|
12 |
//
|
williamr@4
|
13 |
// Description:
|
williamr@4
|
14 |
//
|
williamr@4
|
15 |
|
williamr@4
|
16 |
#if !defined(__DESCRIPTORS_H__)
|
williamr@4
|
17 |
#define __DESCRIPTORS_H__
|
williamr@4
|
18 |
|
williamr@4
|
19 |
#include <pcstore/pcstoredef.h>
|
williamr@4
|
20 |
|
williamr@4
|
21 |
namespace PCStore
|
williamr@4
|
22 |
{
|
williamr@4
|
23 |
class CMemoryBlock;
|
williamr@4
|
24 |
/**
|
williamr@4
|
25 |
@internalAll
|
williamr@4
|
26 |
|
williamr@4
|
27 |
Class to represent 8-bit descriptors.
|
williamr@4
|
28 |
|
williamr@4
|
29 |
This class implements a subset of 8-bit descriptor's behaviour, which are necessary
|
williamr@4
|
30 |
for the externalization and internalization of 8-bit descriptors. It encapsulates
|
williamr@4
|
31 |
the data members containing the data, its maximum length and actual length. It also
|
williamr@4
|
32 |
provides member functions to append and reset the data, as well as get the pointer of
|
williamr@4
|
33 |
the data. However, there is no method to partly modify the data.
|
williamr@4
|
34 |
|
williamr@4
|
35 |
The constructors, Set, Append, and assignment methods take a copy of the data they're
|
williamr@4
|
36 |
given, which means it allocates memory to hold the data and releases it when needed.
|
williamr@4
|
37 |
Data represented by this class is treated as a contiguous set of 8-bit
|
williamr@4
|
38 |
(i.e. single byte) values or data items.
|
williamr@4
|
39 |
*/
|
williamr@4
|
40 |
class CDes8
|
williamr@4
|
41 |
{
|
williamr@4
|
42 |
public:
|
williamr@4
|
43 |
CDes8();
|
williamr@4
|
44 |
CDes8(const CDes8& aDes);
|
williamr@4
|
45 |
explicit CDes8(TInt32 aMaxLength);
|
williamr@4
|
46 |
CDes8(const TUint8* aPtr);
|
williamr@4
|
47 |
CDes8(const TUint8* aPtr, TInt32 aLength);
|
williamr@4
|
48 |
CDes8(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
|
williamr@4
|
49 |
~CDes8();
|
williamr@4
|
50 |
|
williamr@4
|
51 |
const TUint8* Ptr() const;
|
williamr@4
|
52 |
TInt32 Length() const;
|
williamr@4
|
53 |
TInt32 MaxLength() const ;
|
williamr@4
|
54 |
TInt32 Size() const;
|
williamr@4
|
55 |
|
williamr@4
|
56 |
void SetLength(TInt32 aLength);
|
williamr@4
|
57 |
void Set(const CDes8& aDes);
|
williamr@4
|
58 |
void Set(const TUint8* aPtr, TInt32 aLength);
|
williamr@4
|
59 |
void Set(const TUint8* aPtr, TInt32 aLength, TInt32 aMaxLength);
|
williamr@4
|
60 |
void Append(const CDes8& aDes);
|
williamr@4
|
61 |
void Append(const TUint8* aPtr, TInt32 aLength);
|
williamr@4
|
62 |
|
williamr@4
|
63 |
CDes8& operator=(const CDes8& aDes);
|
williamr@4
|
64 |
TBool operator==(const CDes8& aDes) const;
|
williamr@4
|
65 |
TBool operator!=(const CDes8& aDes) const;
|
williamr@4
|
66 |
|
williamr@4
|
67 |
|
williamr@4
|
68 |
private:
|
williamr@4
|
69 |
CMemoryBlock* iMemoryBlock;
|
williamr@4
|
70 |
TInt32 iLength;
|
williamr@4
|
71 |
};
|
williamr@4
|
72 |
|
williamr@4
|
73 |
|
williamr@4
|
74 |
/**
|
williamr@4
|
75 |
@internalAll
|
williamr@4
|
76 |
|
williamr@4
|
77 |
Class to represent 16-bit descriptor.
|
williamr@4
|
78 |
|
williamr@4
|
79 |
This class implements a subset of 16-bit descriptor's behaviour, which are necessary
|
williamr@4
|
80 |
for the externalization and internalization of 16-bit descriptors. It encapsulates
|
williamr@4
|
81 |
the data members containing the data, its maximum length and actual length. It also
|
williamr@4
|
82 |
provides member functions to access and reset, but not modify, the data.
|
williamr@4
|
83 |
|
williamr@4
|
84 |
The constructors, Set, Append, and assignment methods take a copy of the data they're
|
williamr@4
|
85 |
given, which means it allocates memory to hold the data and releases it when needed.
|
williamr@4
|
86 |
Data represented by this class is treated as a contiguous set of 16-bit
|
williamr@4
|
87 |
(i.e. 2-byte word) values or data items.
|
williamr@4
|
88 |
*/
|
williamr@4
|
89 |
class CDes16
|
williamr@4
|
90 |
{
|
williamr@4
|
91 |
|
williamr@4
|
92 |
public:
|
williamr@4
|
93 |
CDes16();
|
williamr@4
|
94 |
CDes16(const CDes16& aDes);
|
williamr@4
|
95 |
explicit CDes16(TInt32 aMaxLength);
|
williamr@4
|
96 |
CDes16(const TUint16* aPtr);
|
williamr@4
|
97 |
CDes16(const TUint16* aPtr, TInt32 aLength);
|
williamr@4
|
98 |
CDes16(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
|
williamr@4
|
99 |
~CDes16();
|
williamr@4
|
100 |
|
williamr@4
|
101 |
const TUint16* Ptr() const;
|
williamr@4
|
102 |
TInt32 Length() const;
|
williamr@4
|
103 |
TInt32 MaxLength() const ;
|
williamr@4
|
104 |
TInt32 Size() const;
|
williamr@4
|
105 |
|
williamr@4
|
106 |
void SetLength(TInt32 aLength);
|
williamr@4
|
107 |
void Set(const CDes16& aDes);
|
williamr@4
|
108 |
void Set(const TUint16* aPtr, TInt32 aLength);
|
williamr@4
|
109 |
void Set(const TUint16* aPtr, TInt32 aLength, TInt32 aMaxLength);
|
williamr@4
|
110 |
void Append(const CDes16& aDes);
|
williamr@4
|
111 |
void Append(const TUint16* aPtr, TInt32 aLength);
|
williamr@4
|
112 |
|
williamr@4
|
113 |
CDes16& operator=(const CDes16& aDes);
|
williamr@4
|
114 |
TBool operator==(const CDes16& aDes) const;
|
williamr@4
|
115 |
TBool operator!=(const CDes16& aDes) const;
|
williamr@4
|
116 |
|
williamr@4
|
117 |
private:
|
williamr@4
|
118 |
CMemoryBlock* iMemoryBlock;
|
williamr@4
|
119 |
TInt32 iLength;
|
williamr@4
|
120 |
};
|
williamr@4
|
121 |
}
|
williamr@4
|
122 |
#endif // !defined(__DESCRIPTORS_H__)
|