|
1 /* |
|
2 * Copyright (c) 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: Operation for exporting landmarks from a database. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPOSLMLOCALEXPORTOP_H |
|
21 #define CPOSLMLOCALEXPORTOP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <EPos_CPosLandmarkDatabase.h> |
|
25 #include "EPos_CPosLmLocalOperation.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CPosLmLocalDatabase; |
|
31 class CPosLmGlobalCategoryReader; |
|
32 class CPosLandmarkEncoder; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Operation for exporting landmarks from a database. |
|
38 * |
|
39 * @lib eposlmlocalaccess.lib |
|
40 */ |
|
41 NONSHARABLE_CLASS(CPosLmLocalExportOp) : public CPosLmLocalOperation |
|
42 { |
|
43 |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * |
|
49 * @param aDb A landmark database. |
|
50 * @param aLandmarkEncoder A landmark encoder object. |
|
51 * @param aLandmarkIdArray The landmarks which should be exported. |
|
52 * @param aTransferOptions A bitmap representing the options for the |
|
53 * export operation. The bitmap values are defined by |
|
54 * @ref _TTransferOptions. |
|
55 * @return A new instance of this class. |
|
56 */ |
|
57 static CPosLmLocalExportOp* NewL( |
|
58 /* IN */ CPosLmLocalDatabase& aDb, |
|
59 /* IN */ CPosLandmarkEncoder& aLandmarkEncoder, |
|
60 /* IN */ const RArray<TPosLmItemId>& aLandmarkIdArray, |
|
61 /* IN */ CPosLandmarkDatabase::TTransferOptions aTransferOptions |
|
62 ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CPosLmLocalExportOp(); |
|
68 |
|
69 public: // Functions from base classes |
|
70 |
|
71 /** |
|
72 * From CPosLmLocalOperation; |
|
73 * |
|
74 * @param aProgress Will be set to the progress of the operation when |
|
75 * the step has finished. |
|
76 * @return @p KPosLmOperationNotComplete if the step has completed but |
|
77 * more steps are needed before the operation has finished, |
|
78 * @p KErrNone if the operation has finished successfully. |
|
79 */ |
|
80 TInt NextStepL( |
|
81 /* OUT */ TReal32& aProgress |
|
82 ); |
|
83 |
|
84 /** |
|
85 * From CPosLmLocalOperation; |
|
86 * |
|
87 * @param aError An error code generated by NextStepL. |
|
88 */ |
|
89 void HandleError( |
|
90 /* IN/OUT */ TInt& aError |
|
91 ); |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 * C++ default constructor. |
|
97 * @param aDb A landmark db. |
|
98 */ |
|
99 CPosLmLocalExportOp( |
|
100 /* IN */ CPosLmLocalDatabase& aDb, |
|
101 /* IN */ CPosLandmarkEncoder& aLandmarkEncoder, |
|
102 /* IN */ CPosLandmarkDatabase::TTransferOptions aTransferOptions |
|
103 ); |
|
104 |
|
105 /** |
|
106 * By default Symbian 2nd phase constructor is private. |
|
107 */ |
|
108 void ConstructL( |
|
109 /* IN */ const RArray<TPosLmItemId>& aLandmarkIdArray |
|
110 ); |
|
111 |
|
112 CPosLandmark* ReadLmFromDbLC( |
|
113 /* IN */ TPosLmItemId aId |
|
114 ); |
|
115 |
|
116 CPosLandmarkCategory* ReadCategoryFromDbLC( |
|
117 /* IN */ TPosLmItemId aId |
|
118 ); |
|
119 |
|
120 void SetPredefinedGlobalNameL( |
|
121 /* IN/OUT */ CPosLandmarkCategory* aCategory |
|
122 ); |
|
123 |
|
124 /** |
|
125 * Reads information about number of suboperations for asynchronous |
|
126 * operations from a resource file. |
|
127 */ |
|
128 void ReadInfoFromResourceFileL(); |
|
129 |
|
130 // Prohibit copy constructor if not deriving from CBase. |
|
131 CPosLmLocalExportOp(const CPosLmLocalExportOp&); |
|
132 // Prohibit assigment operator if not deriving from CBase. |
|
133 CPosLmLocalExportOp& operator=(const CPosLmLocalExportOp&); |
|
134 |
|
135 private: // Data |
|
136 |
|
137 // Landmark global category reader. |
|
138 CPosLmGlobalCategoryReader* iReader; |
|
139 |
|
140 // Landmark encoder (no ownership). |
|
141 CPosLandmarkEncoder* iLandmarkEncoder; |
|
142 |
|
143 // Transfer options |
|
144 CPosLandmarkDatabase::TTransferOptions iTransferOptions; |
|
145 |
|
146 // Status flag. Holding the current status. |
|
147 TInt iStatusFlag; |
|
148 |
|
149 // Export landmark in next increment if ETrue, otherwise |
|
150 // export categories. |
|
151 TBool iCurrentIsLm; |
|
152 |
|
153 // Item list with landmarks to export. |
|
154 RArray<TPosLmItemId> iLandmarkIdArray; |
|
155 |
|
156 // The current landmark handled in the id array. |
|
157 TInt iCurrentLm; |
|
158 |
|
159 // Item list with categories to export. |
|
160 RArray<TPosLmItemId> iCategoryIdArray; |
|
161 |
|
162 // The current category handled in the id array. |
|
163 TInt iCurrentCategory; |
|
164 |
|
165 // Number of suboperations in each increment that export categories. |
|
166 TInt iNrOfSubOperations; |
|
167 }; |
|
168 |
|
169 #endif // CPOSLMLOCALEXPORTOP_H |
|
170 |
|
171 // End of File |