|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Packing of data for IPC between client and engine server. |
|
16 * Data Format: |
|
17 * integers: memory copy all in once |
|
18 * descriptor: lenght + data bytes |
|
19 * array: nbr-elements (n) + n * length + data bytes |
|
20 * |
|
21 * |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef TImpsPackedEntity_H |
|
26 #define TImpsPackedEntity_H |
|
27 |
|
28 // INCLUDES |
|
29 #include "impsfields.h" |
|
30 #include "impsdata.h" |
|
31 |
|
32 |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CImpsCommonGroupPropsInt; |
|
36 class CImpsPrivateGroupPropsInt; |
|
37 class CImpsGroupProps; |
|
38 |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 class TImpsPackedEntity |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * C++ default constructor. |
|
48 * @param aBuffer buffered entity |
|
49 */ |
|
50 IMPORT_C TImpsPackedEntity( HBufC8*& aBuffer ); |
|
51 |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Make a packed entity |
|
56 * @param aEntity entity to be packed |
|
57 * @return error code |
|
58 */ |
|
59 IMPORT_C TInt PackEntity( const CImpsFields& aEntity ); |
|
60 |
|
61 /** |
|
62 * Open a packed entity |
|
63 * @param aEntity entity where to place the data |
|
64 * @return error code |
|
65 */ |
|
66 IMPORT_C void UnpackEntityL( CImpsFields& aEntity ); |
|
67 |
|
68 /** |
|
69 * Pack array of descriptors |
|
70 */ |
|
71 IMPORT_C static void DoPackArray( |
|
72 const TUint8*& aPtrStart, |
|
73 const MDesCArray* aArray ); |
|
74 |
|
75 /** |
|
76 * Pack a single descriptor. |
|
77 * This is used in access client in this light way |
|
78 */ |
|
79 static void DoPackDescriptor( |
|
80 const TUint8*& aPtrStart, |
|
81 const TDesC& aDescriptor ); |
|
82 |
|
83 /** |
|
84 * Unpack a single descriptor |
|
85 * This is used in access client in this light way |
|
86 */ |
|
87 static void DoUnpackDescriptorLC( |
|
88 const TUint8*& aPtrStart, |
|
89 HBufC*& aDescriptor ); |
|
90 |
|
91 /** |
|
92 * Unpack array of descriptors |
|
93 */ |
|
94 IMPORT_C static void DoUnpackArrayL( |
|
95 const TUint8*& aPtrStart, |
|
96 CDesCArray* aArray ); |
|
97 |
|
98 private: |
|
99 |
|
100 /** |
|
101 * Unpacks general headers (and IM at the very moment) |
|
102 * @param aPtr read data pointer |
|
103 * @param aEntity internal data structure to be updated |
|
104 */ |
|
105 void DoUnpackEntityL( |
|
106 TUint8*& aPtr, |
|
107 CImpsFields& aEntity ); |
|
108 |
|
109 /** |
|
110 * Unpacks CImpsData specific data |
|
111 * @param aPtr read data pointer |
|
112 * @param aEntity internal data structure to be updated |
|
113 */ |
|
114 void DoUnpackDataL( |
|
115 TUint8*& aPtr, |
|
116 CImpsData& aEntity ); |
|
117 |
|
118 /** |
|
119 * Pack CImpsFields into flat memory |
|
120 * @param aPtrStart where to start write. Increased and returned. |
|
121 * @param aPtrEnd end of buffer |
|
122 * @return error code |
|
123 */ |
|
124 TInt DoPackEntity( |
|
125 const TUint8*& aPtrStart, |
|
126 const TUint8* aPtrEnd, |
|
127 const CImpsFields& aEntity ); |
|
128 |
|
129 /** |
|
130 * Pack CImpsData into flat memory |
|
131 * @param aPtrStart where to start write. Increased and returned. |
|
132 * @param aPtrEnd end of buffer |
|
133 * @return error code |
|
134 */ |
|
135 TInt DoPackData( |
|
136 const TUint8*& aPtrStart, |
|
137 const TUint8* aPtrEnd, |
|
138 const CImpsData& aEntity ); |
|
139 |
|
140 private: // Data |
|
141 HBufC8*& iBuffer; |
|
142 |
|
143 }; |
|
144 |
|
145 #endif // ?INCLUDE_H |
|
146 |
|
147 // End of File |