|
1 /* |
|
2 * Copyright (c) 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: Definition of client side stream buffer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MENUBUF_H__ |
|
20 #define __MENUBUF_H__ |
|
21 |
|
22 #include "menusrvdef.h" |
|
23 #include <e32base.h> |
|
24 #include <s32buf.h> |
|
25 |
|
26 class RMenu; |
|
27 |
|
28 /** |
|
29 * Client side stream buffer. Not seekable. |
|
30 * @lib mcsmenu.lib |
|
31 * @since S60 v5.0 |
|
32 */ |
|
33 NONSHARABLE_CLASS( RMenuBuf ): public RSubSessionBase, public TStreamBuf |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Close the object. |
|
40 */ |
|
41 void Close(); |
|
42 |
|
43 /** |
|
44 * Open the object (initially empty). |
|
45 * @param aMenu Session to be used. |
|
46 * @return Error code. |
|
47 */ |
|
48 TInt Open( RMenu& aMenu ); |
|
49 |
|
50 /** |
|
51 * Open this object using other object. |
|
52 * @param aHandle Handle used to open this object. |
|
53 * @param aFunction Function. |
|
54 * @param aArgs Arguments. Use arg 0 and 1 only; |
|
55 * arg 2 and 3 are used internally. |
|
56 * @return Error code. |
|
57 */ |
|
58 TInt Open( RMenu& aMenu, TInt aFunction, TIpcArgs& aArgs ); |
|
59 |
|
60 private: |
|
61 |
|
62 /** |
|
63 * Read data from server. |
|
64 * @param aLength The number of bytes read. |
|
65 */ |
|
66 void IpcReadL( TInt& aLength ); |
|
67 |
|
68 /** |
|
69 * Write data to server. |
|
70 */ |
|
71 void IpcWriteL(); |
|
72 |
|
73 /** |
|
74 * Get read lag (number of bytes transferred from server side but not |
|
75 * yet read). |
|
76 * @return Read lag. |
|
77 */ |
|
78 inline TInt Lag( TRead aArea ) const; |
|
79 |
|
80 /** |
|
81 * Get write lag (number of bytes written but not yet transferred to |
|
82 * server side). |
|
83 * @return Write lag. |
|
84 */ |
|
85 inline TInt Lag( TWrite aArea ) const; |
|
86 |
|
87 // from base class TStreamBuf |
|
88 |
|
89 /** |
|
90 * Re-fill the intermediate buffer and reset the start and end points |
|
91 * of the read area. |
|
92 * @param aMaxLength The maximum amount of data required. |
|
93 * @return The amount of data available. |
|
94 */ |
|
95 TInt UnderflowL( TInt aMaxLength ); |
|
96 |
|
97 /** |
|
98 * Empty the intermediate buffer and resets the start and end points |
|
99 * of the write area. |
|
100 */ |
|
101 void OverflowL(); |
|
102 |
|
103 /** |
|
104 * Synchronise the stream buffer with the stream. In effect, this |
|
105 * ensures that buffered data is delivered to the stream. |
|
106 * Write lag flushed. |
|
107 * Read lag leaves with KErrNotSupported. |
|
108 */ |
|
109 void DoSynchL(); |
|
110 |
|
111 private: // Data |
|
112 |
|
113 TMenuBuf iBuf; ///< Data buffer. |
|
114 |
|
115 }; |
|
116 |
|
117 #include "menubuf.inl" |
|
118 |
|
119 #endif // __MENUBUF_H__ |
|
120 |