1 /* |
|
2 * Copyright (c) 2004-2005 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 * See class description below |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __LANDMARKS_LM_OP_WRAPPER_H__ |
|
21 #define __LANDMARKS_LM_OP_WRAPPER_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 |
|
27 class CLandmarksListContainer; |
|
28 class CAknNavigationDecorator; |
|
29 class CLandmarksEngine; |
|
30 class CPosLmOperation; |
|
31 |
|
32 |
|
33 |
|
34 /** |
|
35 * Active class that wraps an instance of CPosLmOperation. |
|
36 * The wrapped CPosLmOperation instance is executed incrementally. |
|
37 * Execution progress can be reported. |
|
38 * This class is designed to be utilized by active objects. |
|
39 */ |
|
40 class CLandmarksLmOpWrapper: public CActive |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * C++ default constructor. |
|
46 * |
|
47 */ |
|
48 CLandmarksLmOpWrapper(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CLandmarksLmOpWrapper(); |
|
54 |
|
55 public: // New Functions |
|
56 |
|
57 /** |
|
58 * Starts execution of the supplied operation. |
|
59 * |
|
60 * @param aLmOperation operation to execute. Ownership of the operation |
|
61 * is transferred to this instance. |
|
62 * @param aStatus the request status to complete when execution of the |
|
63 * supplied LmOperation is finished. |
|
64 * @param aReportProgress ETrue if progress should be reported |
|
65 * (incremental execution), EFalse otherwise. |
|
66 */ |
|
67 void StartOperation( |
|
68 CPosLmOperation* aLmOperation, |
|
69 TRequestStatus& aStatus, |
|
70 TBool aReportProgress = EFalse); |
|
71 |
|
72 /** |
|
73 * Returns a pointer to the wrapped CPosLmOperation object. |
|
74 * This object keeps ownership of the operation. |
|
75 * |
|
76 * @return a pointer to a CPosLmOperation instance |
|
77 */ |
|
78 CPosLmOperation* LmOperationPtr(); |
|
79 |
|
80 /** |
|
81 * Executes the next step of the incremental operation. Typically |
|
82 * called when progress of the CPosLmOperaiotion is reported. |
|
83 * |
|
84 * @param aStatus the request status to complete when execution of the |
|
85 * next step is finished. |
|
86 */ |
|
87 void ExecuteNextStep(TRequestStatus& aStatus); |
|
88 |
|
89 /** |
|
90 * Return the current progress of the CPosLmnOperation. |
|
91 * |
|
92 * @return a number between 0-100. 100 means that the operation is |
|
93 * completed |
|
94 */ |
|
95 TInt Progress(); |
|
96 |
|
97 protected: // from CActive |
|
98 |
|
99 /** |
|
100 * Implements cancellation of an outstanding request. |
|
101 */ |
|
102 void DoCancel(); |
|
103 |
|
104 /** |
|
105 * Handles an active object’s request completion event. |
|
106 */ |
|
107 void RunL(); |
|
108 |
|
109 private: |
|
110 |
|
111 /** |
|
112 * Executes the next step of the incremental operation. |
|
113 */ |
|
114 void ExecuteNextStep(); |
|
115 |
|
116 private: // Data |
|
117 |
|
118 //! the wrapped CPosLmOperation that is executed |
|
119 CPosLmOperation* iLmOperation; |
|
120 |
|
121 //! contains a value between 0-1 and indicates the progress |
|
122 TReal32 iProgress; |
|
123 |
|
124 //! the req. status of the caller executing the operation |
|
125 TRequestStatus* iCallerStatus; |
|
126 |
|
127 //! indicates if progress should be reported or not |
|
128 TBool iReportProgress; |
|
129 |
|
130 }; |
|
131 |
|
132 |
|
133 #endif // __LANDMARKS_LM_OP_WRAPPER_H__ |
|
134 |
|