|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifdef _WIN32 |
|
26 #pragma warning (disable: 4786) |
|
27 #endif //_WIN32 |
|
28 |
|
29 #include "sisinstallblock.h" |
|
30 #include "sisdata.h" |
|
31 |
|
32 CSISInstallBlock::CSISInstallBlock () |
|
33 { |
|
34 InsertMembers (); |
|
35 } |
|
36 |
|
37 |
|
38 CSISInstallBlock::CSISInstallBlock (const CSISInstallBlock& aInitialiser) : |
|
39 CStructure <CSISFieldRoot::ESISInstallBlock> (aInitialiser), |
|
40 iFiles (aInitialiser.iFiles), |
|
41 iEmbeddedFiles (aInitialiser.iEmbeddedFiles), |
|
42 iIfs (aInitialiser.iIfs) |
|
43 { |
|
44 InsertMembers (); |
|
45 } |
|
46 |
|
47 |
|
48 void CSISInstallBlock::InsertMembers () |
|
49 { |
|
50 InsertMember (iFiles); |
|
51 InsertMember (iEmbeddedFiles); |
|
52 InsertMember (iIfs); |
|
53 } |
|
54 |
|
55 |
|
56 void CSISInstallBlock::Embed (class CSISController& aController, const TUint32 aIndex) |
|
57 { |
|
58 iEmbeddedFiles.Push (aController); |
|
59 } |
|
60 |
|
61 |
|
62 void CSISInstallBlock::AddIf () |
|
63 { |
|
64 iIfs.Push (CSISIf ()); |
|
65 } |
|
66 |
|
67 |
|
68 CSISIf& CSISInstallBlock::If () |
|
69 { |
|
70 return iIfs.Last (); |
|
71 } |
|
72 |
|
73 const CSISIf& CSISInstallBlock::If () const |
|
74 { |
|
75 return iIfs.Last (); |
|
76 } |
|
77 |
|
78 |
|
79 CSISInstallBlock& CSISInstallBlock::IfInstall () |
|
80 { |
|
81 return iIfs.Last ().InstallBlock (); |
|
82 } |
|
83 |
|
84 |
|
85 const CSISInstallBlock& CSISInstallBlock::IfInstall () const |
|
86 { |
|
87 return iIfs.Last ().InstallBlock (); |
|
88 } |
|
89 |
|
90 void CSISInstallBlock::SetHash (const CSISHash& aHash) |
|
91 { |
|
92 iFiles.Last ().SetHash (aHash); |
|
93 } |
|
94 |
|
95 void CSISInstallBlock::ExtractCapabilities(const std::wstring& aFileName) |
|
96 { |
|
97 iFiles.Last().ExtractCapabilities(aFileName); |
|
98 } |
|
99 |
|
100 void CSISInstallBlock::GetFileList(TFileDescList& aFileList, bool aRecursive) const |
|
101 { |
|
102 for(int i = 0; i < iFiles.size(); ++i) |
|
103 { |
|
104 aFileList.push_back(&iFiles[i]); |
|
105 } |
|
106 |
|
107 if(!aRecursive) |
|
108 { |
|
109 return; |
|
110 } |
|
111 |
|
112 for(i = 0; i < iIfs.size(); ++i) |
|
113 { |
|
114 iIfs[i].GetFileList(aFileList); |
|
115 } |
|
116 } |
|
117 void CSISInstallBlock::GetEmbeddedControllers(TControllerMap& aControllers, bool aRecursive) const |
|
118 { |
|
119 for(int i = 0; i < iEmbeddedFiles.size(); ++i) |
|
120 { |
|
121 aControllers[iEmbeddedFiles[i].DataIndex()] = &iEmbeddedFiles[i]; |
|
122 } |
|
123 |
|
124 if(!aRecursive) |
|
125 { |
|
126 return; |
|
127 } |
|
128 |
|
129 for(i = 0; i < iIfs.size(); ++i) |
|
130 { |
|
131 iIfs[i].GetEmbeddedControllers(aControllers); |
|
132 } |
|
133 } |
|
134 |
|
135 void CSISInstallBlock::AddPackageEntry(std::wostream& aStream, bool aVerbose) const |
|
136 { |
|
137 TUint32 descriptionsCount = iFiles.size(); |
|
138 for (TUint32 i = 0; i < descriptionsCount; ++i) |
|
139 { |
|
140 iFiles[i].AddPackageEntry(aStream, aVerbose); |
|
141 } |
|
142 TUint32 embeddedCount = iEmbeddedFiles.size(); |
|
143 if (embeddedCount) |
|
144 { |
|
145 if (aVerbose) |
|
146 { |
|
147 aStream << std::endl << L"; " << embeddedCount << L" embedded files" << std::endl; |
|
148 } |
|
149 for (int i = 0; i < embeddedCount; ++i) |
|
150 { |
|
151 wchar_t sisFileName[30]; |
|
152 #ifdef _MSC_VER |
|
153 swprintf(sisFileName, L"sis%d.sis", iEmbeddedFiles[i].GetControllerID()); |
|
154 #else |
|
155 swprintf(sisFileName, 30, L"sis%d.sis", iEmbeddedFiles[i].GetControllerID()); |
|
156 #endif //_MSC_VER |
|
157 aStream << L"@\"" << sisFileName << L"\",(0x" << std::hex << iEmbeddedFiles[i].UID1() << std::dec << L")" << std::endl; |
|
158 } |
|
159 } |
|
160 iIfs.AddPackageEntry(aStream, aVerbose); |
|
161 } |