|
1 /* |
|
2 * Copyright (c) 2004 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: See class description below. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CPENGPLUGINSTATUS_H__ |
|
20 #define __CPENGPLUGINSTATUS_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32def.h> |
|
24 #include <s32strm.h> |
|
25 |
|
26 // CLASS DEFINITION |
|
27 /** |
|
28 * This is container where state of plugins is stored. |
|
29 * This is used for example to inform client if the plugin has been loaded |
|
30 * or if the loading has failed. |
|
31 * |
|
32 * @lib PEngPlgSrv.lib |
|
33 * @since 2.1 |
|
34 */ |
|
35 |
|
36 NONSHARABLE_STRUCT( TPEngPluginResult ) |
|
37 { |
|
38 TUid iUid; |
|
39 TPEngPluginStatusCode iStatus; |
|
40 |
|
41 TPEngPluginResult( TUid aUid, TPEngPluginStatusCode aStatus ) |
|
42 : iUid( aUid ), iStatus( aStatus ) |
|
43 { |
|
44 } |
|
45 }; |
|
46 |
|
47 NONSHARABLE_CLASS( CPEngPluginStatus ) |
|
48 : public CBase, public MPEngPluginStatus |
|
49 { |
|
50 public: // Constructors and destructors |
|
51 |
|
52 static CPEngPluginStatus* NewL(); // Static constructor |
|
53 static CPEngPluginStatus* NewLC(); // Static constructor |
|
54 virtual ~CPEngPluginStatus(); // Destructor (virtual) |
|
55 |
|
56 public: // New methods |
|
57 |
|
58 /** |
|
59 * Count if results in this object. |
|
60 * |
|
61 * |
|
62 * @since 2.8 |
|
63 * @return TUint is count of results |
|
64 */ |
|
65 TUint Count() const; |
|
66 |
|
67 /** |
|
68 * UID3 of plugin. |
|
69 * |
|
70 * @since 2.8 |
|
71 * @param aIndex is index to result buffer. |
|
72 * @return TUid is plugin uid. |
|
73 */ |
|
74 TUid Uid( TUint aIndex ) const; |
|
75 |
|
76 /** |
|
77 * Status of plugin. |
|
78 * |
|
79 * |
|
80 * @since 2.8 |
|
81 * @param aIndex is index of result. |
|
82 * @return TPEngPluginStatusCode is last status of the plugin. |
|
83 * Codes listed in MPEngPluginStatus.h |
|
84 */ |
|
85 TPEngPluginStatusCode Status( TUint aIndex ) const; |
|
86 |
|
87 /** |
|
88 * Find status of certain plugin |
|
89 * |
|
90 * @since 2.8 |
|
91 * @param aPluginUid is UID3 of the plugin |
|
92 * @return TInt is KErrNotFound or index. |
|
93 */ |
|
94 TInt Find( TUid aPluginUid ) const; |
|
95 |
|
96 /** |
|
97 * CleanupStack support. |
|
98 * |
|
99 * !!! Destroys this object !!! |
|
100 * |
|
101 * |
|
102 * @since 2.8 |
|
103 */ |
|
104 void Close(); |
|
105 |
|
106 /** |
|
107 * Add result to result container. |
|
108 * |
|
109 * |
|
110 * @since 2.8 |
|
111 * @param aUid is UID3 of the plugin |
|
112 * @param aStatus is status of the plugin |
|
113 */ |
|
114 void AddResultL( TUid aUid, TPEngPluginStatusCode aStatus ); |
|
115 |
|
116 /** |
|
117 * Frees memory allocated to this result container. |
|
118 * |
|
119 * @since 2.8 |
|
120 */ |
|
121 void Zero(); |
|
122 |
|
123 /** |
|
124 * Remove result from container. |
|
125 * |
|
126 * @since 2.8 |
|
127 * @param aIndex is index of result to be removed. |
|
128 * Will panic if you give invalid index. |
|
129 */ |
|
130 void Remove( TUint aIndex ); |
|
131 |
|
132 /** |
|
133 * Allocate space for result container. |
|
134 * |
|
135 * Used only when transferring results from server to client side. |
|
136 * |
|
137 * @since 2.8 |
|
138 * @param aCount is count of results this container should hold. |
|
139 */ |
|
140 void AllocateSpaceForResultsL( TUint aCount ); |
|
141 |
|
142 /** |
|
143 * Returns buffer when server can write the results. |
|
144 * |
|
145 * @since 2.8 |
|
146 * @param aCount tells how many results will be wrapped in this buffer. |
|
147 * @return TPtr8 is buffer where server can safely read or write results. |
|
148 */ |
|
149 TPtr8 Buffer( TUint aCount = 0 ) const; |
|
150 |
|
151 protected: // Constructors and destructors |
|
152 |
|
153 CPEngPluginStatus();// Default constructor, protected to allow derivation |
|
154 void ConstructL(); // Second phase construct |
|
155 |
|
156 private: // Methods not implemented |
|
157 |
|
158 CPEngPluginStatus( const CPEngPluginStatus& ); // Copy constructor |
|
159 CPEngPluginStatus& operator=( const CPEngPluginStatus& ); // Assigment operator |
|
160 |
|
161 private: // Data |
|
162 |
|
163 //Array of results |
|
164 RArray<TPEngPluginResult> iResults; |
|
165 }; |
|
166 |
|
167 #endif // __CPENGPLUGINSTATUS_H__ |