|
1 /* |
|
2 * Copyright (c) 2009 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: Support for executing asynchronously certain plugin |
|
15 * operations. |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __BASEPLUGINDELAYEDOPS_H__ |
|
20 #define __BASEPLUGINDELAYEDOPS_H__ |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "CFSMailCommon.h" |
|
25 #include "BasePlugin.h" |
|
26 #include "DebugLogMacros.h" |
|
27 |
|
28 |
|
29 class CBasePlugin; |
|
30 class CDelayedOp; |
|
31 |
|
32 |
|
33 /** |
|
34 * The interface to the delayed operations manager implementation. Plugins |
|
35 * must talk to the manager only through this interface. |
|
36 */ |
|
37 class MDelayedOpsManager |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** |
|
43 * |
|
44 */ |
|
45 virtual ~MDelayedOpsManager() {}; |
|
46 |
|
47 /** |
|
48 * @param aOp ownership is transferred |
|
49 */ |
|
50 virtual void EnqueueOpL( CDelayedOp* aOp ) = 0; |
|
51 |
|
52 /** |
|
53 * @param aOp the caller must delete the operation |
|
54 */ |
|
55 virtual void DequeueOp( const CDelayedOp& aOp ) = 0; |
|
56 |
|
57 /** |
|
58 * API for future extensions. |
|
59 */ |
|
60 virtual TInt Extension1( |
|
61 TUint aExtensionId, TAny*& a0, TAny* a1 ) = 0; |
|
62 |
|
63 }; |
|
64 |
|
65 |
|
66 |
|
67 /** |
|
68 * The base class for the delayed operations. All of the delayed operations must |
|
69 * derive from it. |
|
70 */ |
|
71 class CDelayedOp : public CAsyncOneShot |
|
72 { |
|
73 |
|
74 public: |
|
75 |
|
76 IMPORT_C virtual ~CDelayedOp(); |
|
77 |
|
78 IMPORT_C void SetContext( |
|
79 CBasePlugin& aPlugin, |
|
80 MDelayedOpsManager& aManager ); |
|
81 |
|
82 /** |
|
83 * Derived classes must implement their asynchronous processing in this |
|
84 * method. The GetPlugin method can only be used from within this method. |
|
85 */ |
|
86 virtual void ExecuteOpL() = 0; |
|
87 |
|
88 protected: |
|
89 |
|
90 IMPORT_C CDelayedOp(); |
|
91 |
|
92 /** |
|
93 * Returns the plugin instance associated with this operation. Available |
|
94 * only from within the ExecuteOpL method. |
|
95 */ |
|
96 IMPORT_C CBasePlugin& GetPlugin(); |
|
97 |
|
98 |
|
99 private: |
|
100 |
|
101 IMPORT_C virtual void RunL(); |
|
102 IMPORT_C virtual void DoCancel(); |
|
103 |
|
104 private: |
|
105 MDelayedOpsManager* iManager; //not owned |
|
106 CBasePlugin* iPlugin; //not owned |
|
107 |
|
108 __LOG_DECLARATION |
|
109 }; |
|
110 |
|
111 #endif // __BASEPLUGINDELAYEDOPS_H__ |