|
1 /* |
|
2 * Copyright (c) 2004-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 * Note: This file may contain code to generate corrupt files for test purposes. |
|
16 * Such code is excluded from production builds by use of compiler defines; |
|
17 * it is recommended that such code should be removed if this code is ever published publicly. |
|
18 * Acts as layer between old MakeSIS and new SISX file format. |
|
19 * Handles creation of a SISX file |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 /** |
|
25 @file |
|
26 @internalComponent |
|
27 @released |
|
28 */ |
|
29 |
|
30 #ifndef __SISWRITE_H_ |
|
31 #define __SISWRITE_H_ |
|
32 |
|
33 #include "siscontents.h" |
|
34 #include <iostream> |
|
35 |
|
36 |
|
37 |
|
38 class CSISXWriter |
|
39 { |
|
40 public: |
|
41 CSISXWriter (); |
|
42 void WriteSIS (const std::wstring aTargetFileName); |
|
43 void Dump (std::ostream& aStream); |
|
44 void SetVersionInfo ( const CSISUid::TUid aUID, const TVersion& aVersion, |
|
45 const TUint32 aType, const TUint32 aFlags); |
|
46 TUint32 GetNoLanguages () const; |
|
47 bool AreLanguagesSpecified () const; |
|
48 void AddLanguage (const CSISLanguage::TDialect aLan); |
|
49 void AddProperty (const CSISProperty::TKey aKey, const CSISProperty::TValue aValue); |
|
50 CSISUid::TUid UID1 () const; |
|
51 void AddName (const std::wstring& aLan); |
|
52 void AddVendorName (const std::wstring& aLan); |
|
53 void SetVendorUniqueName (const std::wstring& aVendorUniqueName); |
|
54 void AddDependencyName (const std::wstring& aName); |
|
55 void AddTargetName (const std::wstring& aName); |
|
56 void AddOptionName (const std::wstring& aName); |
|
57 void AddOption (); |
|
58 CSISFileDescription::TSISInstOption InterpretOption (const std::wstring& aOption); |
|
59 CSISInfo::TSISInstallationType InterpretType (const std::wstring& aOption); |
|
60 void SetMimeType (const std::wstring& aMimeType); |
|
61 void AddIf (); |
|
62 const CSISIf& If () const; |
|
63 CSISIf& If (); |
|
64 const CSISInstallBlock& InstallBlock () const; |
|
65 CSISInstallBlock& InstallBlock (); |
|
66 void SetLogo (const std::wstring& aFile, const std::wstring& aMime, const std::wstring& aTarget); |
|
67 void AddDependency (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo); |
|
68 void AddTarget (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo); |
|
69 void EmbedFile (const std::wstring& aFile, const CSISUid::TUid& aUid, CSISInstallBlock& aInstall); |
|
70 void EmbedPackage (CSISInstallBlock& aInstallBlock, const std::wstring& aFile, const CSISUid::TUid& aUid); |
|
71 void SetDefaultContent (); |
|
72 TUint32 LoadFile (const std::wstring& aFile, TUint64* aSize = NULL); |
|
73 TUint64 CompressedSize () const; |
|
74 TUint64 UncompressedSize () const; |
|
75 const CSISDataUnit& DataUnit () const; |
|
76 const CSISDataUnit& DataUnit (const TUint32 aUnit) const; |
|
77 CSISLanguage::TLanguage Language (const TUint32 aIndex) const; |
|
78 void AddInstallFlag(const TUint8 aFlag); |
|
79 const CSISContents& SISContent() const; |
|
80 |
|
81 private: |
|
82 CSISContents iContent; |
|
83 }; |
|
84 |
|
85 inline CSISXWriter::CSISXWriter () |
|
86 { |
|
87 } |
|
88 |
|
89 inline const CSISContents& CSISXWriter::SISContent() const |
|
90 { |
|
91 return iContent; |
|
92 } |
|
93 |
|
94 inline void CSISXWriter::Dump (std::ostream& aStream) |
|
95 { |
|
96 aStream << std::endl << iContent.Name () << std::endl << " "; |
|
97 iContent.Dump (aStream, 2); |
|
98 aStream << std::endl; |
|
99 } |
|
100 |
|
101 inline void CSISXWriter::SetVersionInfo ( const CSISUid::TUid aUID, const TVersion& aVersion, |
|
102 const TUint32 aType, const TUint32 aFlags) |
|
103 { |
|
104 iContent.SetVersionInfo (aUID, aVersion, aType, aFlags); |
|
105 } |
|
106 |
|
107 inline TUint32 CSISXWriter::GetNoLanguages () const |
|
108 { |
|
109 TUint32 count (iContent.LanguageCount ()); |
|
110 return (count == 0) ? 1 : count; |
|
111 } |
|
112 |
|
113 inline bool CSISXWriter::AreLanguagesSpecified () const |
|
114 { |
|
115 return iContent.AreLanguagesSpecified (); |
|
116 } |
|
117 |
|
118 inline void CSISXWriter::AddLanguage (const CSISLanguage::TDialect aLan) |
|
119 { |
|
120 iContent.AddLanguage (aLan); |
|
121 } |
|
122 |
|
123 inline void CSISXWriter::AddProperty (const CSISProperty::TKey aKey, const CSISProperty::TValue aValue) |
|
124 { |
|
125 iContent.AddProperty (aKey, aValue); |
|
126 } |
|
127 |
|
128 inline CSISUid::TUid CSISXWriter::UID1 () const |
|
129 { |
|
130 return iContent.UID1 (); |
|
131 } |
|
132 |
|
133 inline void CSISXWriter::AddName (const std::wstring& aLan) |
|
134 { |
|
135 iContent.AddName (aLan); |
|
136 } |
|
137 |
|
138 inline void CSISXWriter::AddVendorName (const std::wstring& aLan) |
|
139 { |
|
140 iContent.AddVendorName (aLan); |
|
141 } |
|
142 |
|
143 inline void CSISXWriter::AddDependencyName (const std::wstring& aName) |
|
144 { |
|
145 iContent.AddDependencyName (aName); |
|
146 } |
|
147 |
|
148 inline void CSISXWriter::AddTargetName (const std::wstring& aName) |
|
149 { |
|
150 iContent.AddTargetName (aName); |
|
151 } |
|
152 |
|
153 inline void CSISXWriter::AddOptionName (const std::wstring& aName) |
|
154 { |
|
155 iContent.AddOptionName (aName); |
|
156 } |
|
157 |
|
158 inline void CSISXWriter::AddOption () |
|
159 { |
|
160 iContent.AddOption (); |
|
161 } |
|
162 |
|
163 inline CSISFileDescription::TSISInstOption CSISXWriter::InterpretOption (const std::wstring& aOption) |
|
164 { |
|
165 return iContent.InterpretOption (aOption); |
|
166 } |
|
167 |
|
168 inline CSISInfo::TSISInstallationType CSISXWriter::InterpretType (const std::wstring& aOption) |
|
169 { |
|
170 return iContent.InterpretType (aOption); |
|
171 } |
|
172 |
|
173 inline void CSISXWriter::SetMimeType (const std::wstring& aMimeType) |
|
174 { |
|
175 iContent.SetMimeType (aMimeType); |
|
176 } |
|
177 |
|
178 inline void CSISXWriter::AddIf () |
|
179 { |
|
180 iContent.AddIf (); |
|
181 } |
|
182 |
|
183 inline const CSISIf& CSISXWriter::If () const |
|
184 { |
|
185 return iContent.If (); |
|
186 } |
|
187 |
|
188 inline CSISIf& CSISXWriter::If () |
|
189 { |
|
190 return iContent.If (); |
|
191 } |
|
192 |
|
193 inline const CSISInstallBlock& CSISXWriter::InstallBlock () const |
|
194 { |
|
195 return iContent.InstallBlock (); |
|
196 } |
|
197 |
|
198 inline CSISInstallBlock& CSISXWriter::InstallBlock () |
|
199 { |
|
200 return iContent.InstallBlock (); |
|
201 } |
|
202 |
|
203 inline void CSISXWriter::SetLogo (const std::wstring& aFile, const std::wstring& aMime, const std::wstring& aTarget) |
|
204 { |
|
205 iContent.SetLogo (aMime, aTarget, aFile, DataUnit()); |
|
206 } |
|
207 |
|
208 inline void CSISXWriter::AddDependency (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo) |
|
209 { |
|
210 iContent.AddDependency (aUID, aFrom, aTo); |
|
211 } |
|
212 |
|
213 inline void CSISXWriter::AddTarget (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo) |
|
214 { |
|
215 iContent.AddTarget (aUID, aFrom, aTo); |
|
216 } |
|
217 |
|
218 inline void CSISXWriter::SetDefaultContent () |
|
219 { |
|
220 iContent.SetDefaultContent (); |
|
221 } |
|
222 |
|
223 inline TUint32 CSISXWriter::LoadFile (const std::wstring& aFile, TUint64* aSize) |
|
224 { |
|
225 return iContent.LoadFile (aFile, aSize); |
|
226 } |
|
227 |
|
228 inline TUint64 CSISXWriter::CompressedSize () const |
|
229 { |
|
230 return iContent.CompressedSize (); |
|
231 } |
|
232 |
|
233 inline TUint64 CSISXWriter::UncompressedSize () const |
|
234 { |
|
235 return iContent.UncompressedSize (); |
|
236 } |
|
237 |
|
238 inline const CSISDataUnit& CSISXWriter::DataUnit () const |
|
239 { |
|
240 return iContent.DataUnit (); |
|
241 } |
|
242 |
|
243 inline const CSISDataUnit& CSISXWriter::DataUnit (const TUint32 aUnit) const |
|
244 { |
|
245 return iContent.DataUnit (aUnit); |
|
246 } |
|
247 |
|
248 inline void CSISXWriter::SetVendorUniqueName (const std::wstring& aVendorUniqueName) |
|
249 { |
|
250 iContent.SetVendorUniqueName (aVendorUniqueName); |
|
251 } |
|
252 |
|
253 inline CSISLanguage::TLanguage CSISXWriter::Language (const TUint32 aIndex) const |
|
254 { |
|
255 return iContent.Language (aIndex); |
|
256 } |
|
257 |
|
258 inline void CSISXWriter::EmbedFile (const std::wstring& aFile, const CSISUid::TUid& aUid, CSISInstallBlock& aInstall) |
|
259 { |
|
260 iContent.EmbedFile (aFile, aUid, aInstall); |
|
261 } |
|
262 |
|
263 inline void CSISXWriter::EmbedPackage (CSISInstallBlock& aInstallBlock, const std::wstring& aFile, const CSISUid::TUid& aUid) |
|
264 { |
|
265 iContent.EmbedPackage (aInstallBlock, aFile, aUid); |
|
266 } |
|
267 |
|
268 inline void CSISXWriter::WriteSIS (const std::wstring aTargetFileName) |
|
269 { |
|
270 iContent.WriteSIS (aTargetFileName); |
|
271 } |
|
272 |
|
273 inline void CSISXWriter::AddInstallFlag(const TUint8 aFlag) |
|
274 { |
|
275 iContent.AddInstallFlag(aFlag); |
|
276 } |
|
277 |
|
278 #endif // __SISWRITE_H_ |