|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 generic IPC package. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PBK2IPCPACKAGE_H |
|
20 #define PBK2IPCPACKAGE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class RDesWriteStream; |
|
27 class RDesReadStream; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * Phonebook 2 generic IPC package. |
|
33 * Utility class for IPC transfer of buffers. |
|
34 * Responsible for externalizing and internalizing buffers. |
|
35 * The buffer may consists of multiple subbuffers. |
|
36 * Before the buffer is written to the stream, it will be converted to |
|
37 * 8-bit format, if necessary. |
|
38 */ |
|
39 class Pbk2IPCPackage |
|
40 { |
|
41 public: //Interface |
|
42 |
|
43 /** |
|
44 * Writes buffer's data to a stream. |
|
45 * |
|
46 * @param aBuffer The buffer to write. |
|
47 * @param aWriteStream The stream to write to. |
|
48 */ |
|
49 IMPORT_C static void ExternalizeL( |
|
50 HBufC8*& aBuffer, |
|
51 RDesWriteStream& aWriteStream ); |
|
52 |
|
53 /** |
|
54 * Writes buffer's data to a stream. |
|
55 * |
|
56 * @param aBuffer The buffer to write. |
|
57 * @param aWriteStream The stream to write to. |
|
58 */ |
|
59 IMPORT_C static void ExternalizeL( |
|
60 HBufC*& aBuffer, |
|
61 RDesWriteStream& aWriteStream ); |
|
62 |
|
63 /** |
|
64 * Reads data from the stream. |
|
65 * |
|
66 * @param aBuffer Buffer to write the data. |
|
67 * @param aReadStream The stream to read from. |
|
68 */ |
|
69 IMPORT_C static void InternalizeL( |
|
70 HBufC8*& aBuffer, |
|
71 RDesReadStream& aReadStream ); |
|
72 |
|
73 /** |
|
74 * Reads data from the stream. |
|
75 * |
|
76 * @param aBuffer Buffer to write the data. |
|
77 * @param aReadStream The stream to read from. |
|
78 */ |
|
79 IMPORT_C static void InternalizeL( |
|
80 HBufC*& aBuffer, |
|
81 RDesReadStream& aReadStream ); |
|
82 |
|
83 /** |
|
84 * Reads data from the specific position of the stream. |
|
85 * |
|
86 * @param aBuffer Buffer to write the data. |
|
87 * @param aReadStream The stream to read from. |
|
88 * @param aPosition The position where to read. |
|
89 */ |
|
90 IMPORT_C static void InternalizeL( |
|
91 HBufC8*& aBuffer, |
|
92 RDesReadStream& aReadStream, |
|
93 const TInt aPosition ); |
|
94 |
|
95 /** |
|
96 * Reads data from the specific position of the stream. |
|
97 * |
|
98 * @param aBuffer Buffer to write the data. |
|
99 * @param aReadStream The stream to read from. |
|
100 * @param aPosition The position where to read. |
|
101 */ |
|
102 IMPORT_C static void InternalizeL( |
|
103 HBufC*& aBuffer, |
|
104 RDesReadStream& aReadStream, |
|
105 const TInt aPosition ); |
|
106 |
|
107 /** |
|
108 * Counts buffer's size in the package. |
|
109 * |
|
110 * @param aBuffer Buffer to inspect. |
|
111 * @return Size of the buffer. |
|
112 */ |
|
113 IMPORT_C static TInt CountPackageSize( |
|
114 HBufC8* aBuffer ); |
|
115 |
|
116 /** |
|
117 * Counts buffer's size in the package. |
|
118 * |
|
119 * @param aBuffer Buffer to inspect. |
|
120 * @return Size of the buffer. |
|
121 */ |
|
122 IMPORT_C static TInt CountPackageSize( |
|
123 HBufC* aBuffer ); |
|
124 |
|
125 private: // Implementation |
|
126 static void FindPositionL( |
|
127 RDesReadStream& aReadStream, |
|
128 const TInt aPosition ); |
|
129 |
|
130 private: // Data types |
|
131 |
|
132 /// Buffer type |
|
133 enum TBuffer |
|
134 { |
|
135 EBuffer8Bit, // 8-bit buffer |
|
136 EBuffer16Bit // 16-bit buffer |
|
137 }; |
|
138 }; |
|
139 |
|
140 #endif // PBK2IPCPACKAGE_H |
|
141 |
|
142 // End of File |