|
1 /* |
|
2 * Copyright (c) 2005-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 @publishedPartner |
|
22 */ |
|
23 |
|
24 #ifndef __SISCAPABILITIES_H__ |
|
25 #define __SISCAPABILITIES_H__ |
|
26 |
|
27 #include "structure.h" |
|
28 #include "numeric.h" |
|
29 #include "sisfiledata.h" |
|
30 |
|
31 #include <vector> |
|
32 |
|
33 static const wchar_t* KCapabilityNames[] = |
|
34 { |
|
35 L"TCB", |
|
36 L"CommDD", |
|
37 L"PowerMgmt", |
|
38 L"MultimediaDD", |
|
39 L"ReadDeviceData", |
|
40 L"WriteDeviceData", |
|
41 L"DRM", |
|
42 L"TrustedUI", |
|
43 L"ProtServ", |
|
44 L"DiskAdmin", |
|
45 L"NetworkControl", |
|
46 L"AllFiles", |
|
47 L"SwEvent", |
|
48 L"NetworkServices", |
|
49 L"LocalServices", |
|
50 L"ReadUserData", |
|
51 L"WriteUserData", |
|
52 L"Location", |
|
53 L"SurroundingsDD", |
|
54 L"UserEnvironment" |
|
55 }; |
|
56 |
|
57 #define NUMOFCAPABILITIES (sizeof(KCapabilityNames) / sizeof(KCapabilityNames[0])) |
|
58 |
|
59 class CSISCapabilities : public CStructure <CSISFieldRoot::ESISCapabilities> |
|
60 { |
|
61 public: |
|
62 /** |
|
63 * Default constructor |
|
64 */ |
|
65 explicit CSISCapabilities(const bool aRequired = false); |
|
66 /** |
|
67 * Copy constructor. |
|
68 */ |
|
69 CSISCapabilities(const CSISCapabilities& aInitialiser); |
|
70 |
|
71 /** |
|
72 * This function will verify the class content. Throws |
|
73 * an exception if found invalid. |
|
74 * @param aLanguages Number of languages present in the sis file. |
|
75 */ |
|
76 virtual void Verify (const TUint32 aLanguages) const; |
|
77 /** |
|
78 * Class Name |
|
79 */ |
|
80 virtual std::string Name () const; |
|
81 /** |
|
82 * Function checks if this class should be used or not. |
|
83 * Mainly used in externalization. |
|
84 * @return if true, don't bother writing this record to disc |
|
85 * if false, when reading, it'd better be there |
|
86 */ |
|
87 virtual bool WasteOfSpace() const; |
|
88 |
|
89 /** |
|
90 * Function will extract capabilities of the file passed |
|
91 * and store it in the class. |
|
92 * @param aFileName filename of the file whose capability needs to be extracted. |
|
93 */ |
|
94 void ExtractCapabilities(const std::wstring& aFileName); |
|
95 /** |
|
96 * Adds the write the package details into the stream. |
|
97 * @param aStream - Stream in which the package entries need to be written. |
|
98 * @param aVerbose - If this option is set then detail description of pkg |
|
99 * will be written into the stream. |
|
100 */ |
|
101 void AddPackageEntry(std::wostream& aStream, bool aVerbose) const; |
|
102 /** |
|
103 * Get the stored capability list in human readable format. |
|
104 * @param aCapList will be filled by this function. |
|
105 */ |
|
106 void GetCapabilityList(std::vector<std::wstring>& aCapList) const; |
|
107 /** |
|
108 * Returns the stored capability. |
|
109 */ |
|
110 inline TUint32 Capabilities() const; |
|
111 |
|
112 private: |
|
113 void InsertMembers (); |
|
114 |
|
115 private: |
|
116 CSISUInt32 iCapabilities; |
|
117 int iCapabilitySetSize; |
|
118 |
|
119 }; |
|
120 |
|
121 |
|
122 inline void CSISCapabilities::InsertMembers() |
|
123 { |
|
124 InsertMember(iCapabilities); |
|
125 } |
|
126 |
|
127 inline CSISCapabilities::CSISCapabilities(const bool aRequired) |
|
128 : CStructure<CSISFieldRoot::ESISCapabilities> (aRequired), |
|
129 iCapabilities(0), |
|
130 iCapabilitySetSize(0) |
|
131 { |
|
132 InsertMembers(); |
|
133 } |
|
134 |
|
135 inline TUint32 CSISCapabilities::Capabilities() const |
|
136 { |
|
137 return iCapabilities.Value(); |
|
138 } |
|
139 |
|
140 |
|
141 #endif /* __SISCAPABILITIES_H__ */ |