|
1 /* |
|
2 * Copyright (c) 2007-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 the License "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 * As specified in SGL.GT0188.251 |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedPartner |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __SISINSTALLBLOCK_H__ |
|
27 #define __SISINSTALLBLOCK_H__ |
|
28 |
|
29 #include <vector> |
|
30 #include <map> |
|
31 |
|
32 #include "structure.h" |
|
33 #include "sisarray.h" |
|
34 #include "sisfiledescription.h" |
|
35 |
|
36 |
|
37 class CSISIf; |
|
38 class CSISController; |
|
39 class CSISData; |
|
40 class CSISDataUnit; |
|
41 |
|
42 // Typedefs |
|
43 typedef std::map<TUint32, const CSISController*> TControllerMap; |
|
44 typedef std::map<TUint32, const CSISController*>::const_iterator TControllerMapConstIter; |
|
45 typedef std::vector<const CSISFileDescription*> TFileDescList; |
|
46 typedef std::vector<const CSISFileDescription*>::const_iterator TFileDescListConstIter; |
|
47 |
|
48 class CSISInstallBlock : public CStructure <CSISFieldRoot::ESISInstallBlock> |
|
49 { |
|
50 public: |
|
51 /** |
|
52 * Default constructor |
|
53 */ |
|
54 CSISInstallBlock (); |
|
55 /** |
|
56 * Copy constructor |
|
57 */ |
|
58 CSISInstallBlock (const CSISInstallBlock& aInitialiser); |
|
59 /** |
|
60 * Name of the class |
|
61 */ |
|
62 virtual std::string Name () const; |
|
63 |
|
64 /** |
|
65 * Adds a new file description class into the existing list. |
|
66 */ |
|
67 void AddFileDescription (); |
|
68 /** |
|
69 * Adds this new file description class into the existing list. |
|
70 * @param aFileDescription new file description |
|
71 */ |
|
72 void AddFileDescription (const CSISFileDescription& aFileDescription); |
|
73 /** |
|
74 * @return the last file description object from the list |
|
75 */ |
|
76 CSISFileDescription& FileDescription (); |
|
77 /** |
|
78 * @return the last file description object from the list |
|
79 */ |
|
80 const CSISFileDescription& FileDescription () const; |
|
81 /** |
|
82 * Retrieves the file description pointed by index |
|
83 * @param aIndex index of CSISFileDescription |
|
84 * @return file description object pointed by aIndex. |
|
85 */ |
|
86 const CSISFileDescription& FileDescription (TUint32 aIndex) const; |
|
87 /** |
|
88 * Retirieves the number file present in this install block. |
|
89 * @return file count |
|
90 */ |
|
91 inline TUint32 FileCount() const; |
|
92 /** |
|
93 * Converts the string into installation option (only if its valid) and sets the |
|
94 * option to last file of installblock. |
|
95 * @param aOption installation option string. |
|
96 * @return returns the installation option |
|
97 */ |
|
98 CSISFileDescription::TSISInstOption InterpretOption (const std::wstring& aOption); |
|
99 /** |
|
100 * Set MIME type of the last file of the install block. |
|
101 * @param aMimeType MIME type |
|
102 */ |
|
103 void SetMimeType (const std::wstring& aMimeType); |
|
104 /** |
|
105 * Set compressed and uncompressed length of the last file present in the install block. |
|
106 * @param aUncompressed uncompressed length |
|
107 * @param aCompressed compressed length |
|
108 */ |
|
109 void SetLengths (const TUint64 aUncompressed, const TUint64 aCompressed); |
|
110 /** |
|
111 * Sets the file index of the last file present in the install block. |
|
112 * @param aFileIndex new file index. |
|
113 */ |
|
114 void SetFileIndex (const TUint32 aFileIndex); |
|
115 /** |
|
116 * Sets the file target of the last file present in the install block. |
|
117 * @param aTarget new target |
|
118 */ |
|
119 void SetTarget (const std::wstring& aTarget); |
|
120 /** |
|
121 * Sets the file operation of the last file present in the install block. |
|
122 * @param aTarget new operation |
|
123 */ |
|
124 void SetOperation (const TUint32 aOperation); |
|
125 /** |
|
126 * Sets the file options of the last file present in the install block. |
|
127 * @param aTarget new option |
|
128 */ |
|
129 void SetOptions (const TUint32 aOperationOptions); |
|
130 /** |
|
131 * Sets the file hash of the last file present in the install block. |
|
132 * @param aTarget new hash |
|
133 */ |
|
134 void SetHash (const CSISHash& aHash); |
|
135 |
|
136 /** |
|
137 * Add a new if block. |
|
138 */ |
|
139 void AddIf (); |
|
140 /** |
|
141 * returns the last if block |
|
142 * @return CSISIf |
|
143 */ |
|
144 CSISIf& If (); |
|
145 /** |
|
146 * returns the last if block |
|
147 * @return CSISIf |
|
148 */ |
|
149 const CSISIf& If () const; |
|
150 /** |
|
151 * returns the install block of the last if block |
|
152 * @return CSISInstallBlock |
|
153 */ |
|
154 CSISInstallBlock& IfInstall (); |
|
155 /** |
|
156 * returns the install block of the last if block |
|
157 * @return CSISInstallBlock |
|
158 */ |
|
159 const CSISInstallBlock& IfInstall () const; |
|
160 /** |
|
161 * Embeds the controller into the install block. |
|
162 * @param aController controller to be inserted. |
|
163 */ |
|
164 void Embed (class CSISController& aController, const TUint32 aIndex); |
|
165 /** |
|
166 * Extract capabilities of the last file of the install block. |
|
167 */ |
|
168 void ExtractCapabilities(const std::wstring& aFileName); |
|
169 /** |
|
170 * Add package entry related to this install block. |
|
171 * @param aStream stream where the details need to be written. |
|
172 * @param aVerbose if true detail description will be written. |
|
173 */ |
|
174 void AddPackageEntry(std::wostream& aStream, bool aVerbose) const; |
|
175 /** |
|
176 * Get the list of files present in the sis file. It can also return all |
|
177 * the files present in the nested if blocks and else blocks. |
|
178 * @param aFileList file list which will be filled by this function. |
|
179 * @param aRecursive if true it will check all the nested if blocks and else |
|
180 * blocks for files. |
|
181 */ |
|
182 void GetFileList(TFileDescList& aFileList, bool aRecursive = true) const; |
|
183 /** |
|
184 * Get the list of embedded sis files present in the sis file. It can also |
|
185 * return all the embedded sis files present in the nested if blocks |
|
186 * and else blocks. |
|
187 * @param aControllers file list which will be filled by this function. |
|
188 * @param aRecursive if true it will check all the nested if blocks and else |
|
189 * blocks for files. |
|
190 */ |
|
191 void GetEmbeddedControllers(TControllerMap& aControllers, bool aRecursive = true) const; |
|
192 /** |
|
193 * Retrieves the list of if blocks. |
|
194 * @return sis array of CSISIf class. |
|
195 */ |
|
196 inline const CSISArray <CSISIf, CSISFieldRoot::ESISIf>& Ifs() const; |
|
197 |
|
198 private: |
|
199 void InsertMembers (); |
|
200 |
|
201 private: |
|
202 CSISArray <CSISFileDescription, CSISFieldRoot::ESISFileDescription> iFiles; |
|
203 CSISArray <CSISController, CSISFieldRoot::ESISController> iEmbeddedFiles; |
|
204 CSISArray <CSISIf, CSISFieldRoot::ESISIf> iIfs; |
|
205 |
|
206 }; |
|
207 |
|
208 |
|
209 |
|
210 inline std::string CSISInstallBlock::Name () const |
|
211 { |
|
212 return "Install Block"; |
|
213 } |
|
214 |
|
215 |
|
216 inline void CSISInstallBlock::SetMimeType (const std::wstring& aMimeType) |
|
217 { |
|
218 iFiles.Last ().SetMimeType (aMimeType); |
|
219 } |
|
220 |
|
221 |
|
222 inline void CSISInstallBlock::SetLengths (const TUint64 aUncompressed, const TUint64 aCompressed) |
|
223 { |
|
224 iFiles.Last ().SetLengths (aUncompressed, aCompressed); |
|
225 } |
|
226 |
|
227 |
|
228 inline void CSISInstallBlock::AddFileDescription () |
|
229 { |
|
230 iFiles.Push (); |
|
231 } |
|
232 |
|
233 inline void CSISInstallBlock::AddFileDescription (const CSISFileDescription& aFileDescription) |
|
234 { |
|
235 iFiles.Push (aFileDescription); |
|
236 } |
|
237 |
|
238 |
|
239 inline CSISFileDescription::TSISInstOption CSISInstallBlock::InterpretOption (const std::wstring& aOption) |
|
240 { |
|
241 return iFiles.Last ().InterpretOption (aOption); |
|
242 } |
|
243 |
|
244 |
|
245 inline void CSISInstallBlock::SetFileIndex (const TUint32 aFileIndex) |
|
246 { |
|
247 iFiles.Last ().SetFileIndex (aFileIndex); |
|
248 } |
|
249 |
|
250 |
|
251 inline void CSISInstallBlock::SetTarget (const std::wstring& aTarget) |
|
252 { |
|
253 iFiles.Last ().SetTarget (aTarget); |
|
254 } |
|
255 |
|
256 |
|
257 inline void CSISInstallBlock::SetOperation (const TUint32 aOperation) |
|
258 { |
|
259 iFiles.Last ().SetOperation (aOperation); |
|
260 } |
|
261 |
|
262 |
|
263 inline void CSISInstallBlock::SetOptions (const TUint32 aOperationOptions) |
|
264 { |
|
265 iFiles.Last ().SetOptions (aOperationOptions); |
|
266 } |
|
267 |
|
268 inline CSISFileDescription& CSISInstallBlock::FileDescription () |
|
269 { |
|
270 return iFiles.Last (); |
|
271 } |
|
272 |
|
273 inline const CSISFileDescription& CSISInstallBlock::FileDescription () const |
|
274 { |
|
275 return iFiles.Last (); |
|
276 } |
|
277 |
|
278 inline const CSISFileDescription& CSISInstallBlock::FileDescription (TUint32 aIndex) const |
|
279 { |
|
280 return iFiles[aIndex]; |
|
281 } |
|
282 |
|
283 inline TUint32 CSISInstallBlock::FileCount() const |
|
284 { |
|
285 return iFiles.size(); |
|
286 } |
|
287 |
|
288 inline const CSISArray <CSISIf, CSISFieldRoot::ESISIf>& CSISInstallBlock::Ifs() const |
|
289 { |
|
290 return iIfs; |
|
291 } |
|
292 |
|
293 // Due to circular dependency of InstallBlock SISController and SISIf following |
|
294 // header inclusion is done. |
|
295 #include "siscontroller.h" |
|
296 #include "sisif.h" |
|
297 |
|
298 #endif // __SISINSTALLBLOCK_H__ |
|
299 |