|
1 /* |
|
2 * Copyright (c) 2008-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 * This file defines the CSoftwareTypeRegInfo class used for installation of a Layered Eexecution Environment. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef SWTYPEREGINFO_H |
|
27 #define SWTYPEREGINFO_H |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <s32mem.h> |
|
31 #include <ct/rcpointerarray.h> |
|
32 |
|
33 namespace Swi |
|
34 { |
|
35 _LIT(KTxtSoftwareTypeComponentProperty, "softwareTypes"); |
|
36 |
|
37 class CLocalizedSoftwareTypeName : public CBase |
|
38 { |
|
39 public: |
|
40 IMPORT_C static CLocalizedSoftwareTypeName* NewL(const TDesC& aName, TLanguage aLocale); |
|
41 IMPORT_C static CLocalizedSoftwareTypeName* NewLC(const TDesC& aName, TLanguage aLocale); |
|
42 IMPORT_C static CLocalizedSoftwareTypeName* NewL(RReadStream& aStream); |
|
43 |
|
44 IMPORT_C virtual ~CLocalizedSoftwareTypeName(); |
|
45 |
|
46 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
47 |
|
48 inline const TDesC& Name() const; |
|
49 inline TLanguage Locale() const; |
|
50 |
|
51 private: |
|
52 CLocalizedSoftwareTypeName(); |
|
53 CLocalizedSoftwareTypeName(TLanguage aLocale); |
|
54 |
|
55 void InternalizeL(RReadStream& aStream); |
|
56 |
|
57 private: |
|
58 HBufC* iName; |
|
59 TLanguage iLocale; |
|
60 }; |
|
61 |
|
62 // ########################################################################################## |
|
63 |
|
64 class CSoftwareTypeRegInfo : public CBase |
|
65 { |
|
66 public: |
|
67 IMPORT_C static CSoftwareTypeRegInfo* NewL(const TDesC& aUniqueSoftwareTypeName); |
|
68 IMPORT_C static CSoftwareTypeRegInfo* NewL(RReadStream& aStream); |
|
69 |
|
70 IMPORT_C virtual ~CSoftwareTypeRegInfo(); |
|
71 |
|
72 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
73 IMPORT_C TInt ExternalizedSize() const; |
|
74 |
|
75 inline void SetSifPluginUid(TUid aUid); |
|
76 inline void SetInstallerSecureId(TSecureId aSecureId); |
|
77 inline void SetExecutionLayerSecureId(TSecureId aSecureId); |
|
78 IMPORT_C void SetMimeTypeL(const TDesC& aMimeType); |
|
79 IMPORT_C void SetLocalizedSoftwareTypeNameL(TLanguage aLanguage, const TDesC& aName); |
|
80 |
|
81 inline const TDesC& UniqueSoftwareTypeName() const; |
|
82 inline TUid SifPluginUid() const; |
|
83 inline TSecureId InstallerSecureId() const; |
|
84 inline TSecureId ExecutionLayerSecureId() const; |
|
85 inline const RPointerArray<HBufC>& MimeTypes() const; |
|
86 inline const RPointerArray<CLocalizedSoftwareTypeName>& LocalizedSoftwareTypeNames() const; |
|
87 |
|
88 private: |
|
89 CSoftwareTypeRegInfo(); |
|
90 void InternalizeL(RReadStream& aStream); |
|
91 |
|
92 enum { EUniqueSwTypeNameMaxLength = 32 }; |
|
93 |
|
94 HBufC* iUniqueSoftwareTypeName; |
|
95 TUid iSifPluginUid; |
|
96 TSecureId iInstallerSecureId; |
|
97 TSecureId iExecutionLayerSecureId; |
|
98 RCPointerArray<HBufC> iMimeTypes; |
|
99 RCPointerArray<CLocalizedSoftwareTypeName> iLocalizedSoftwareTypeNames; |
|
100 }; |
|
101 |
|
102 // ########################################################################################## |
|
103 |
|
104 class SoftwareTypeRegInfoUtils |
|
105 { |
|
106 public: |
|
107 IMPORT_C static void SerializeArrayL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf8& aSerializedArray); |
|
108 IMPORT_C static void UnserializeArrayL(RReadStream& aStream, RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray); |
|
109 IMPORT_C static void SerializeUniqueSwTypeNamesL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf& aSerializedNames); |
|
110 IMPORT_C static void UnserializeUniqueSwTypeNamesL(const TDesC& aSerializedNames, RArray<TPtrC>& aUniqueSwTypeNames); |
|
111 IMPORT_C static void ExtractMimeTypesL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RPointerArray<HBufC8>& aMimeTypes); |
|
112 public: |
|
113 enum { KUniqueNameSeparator = 0x1E }; // 'record separator' |
|
114 }; |
|
115 |
|
116 // ########################################################################################## |
|
117 |
|
118 inline const TDesC& CLocalizedSoftwareTypeName::Name() const |
|
119 { |
|
120 return *iName; |
|
121 } |
|
122 |
|
123 inline TLanguage CLocalizedSoftwareTypeName::Locale() const |
|
124 { |
|
125 return iLocale; |
|
126 } |
|
127 |
|
128 // ########################################################################################## |
|
129 |
|
130 inline void CSoftwareTypeRegInfo::SetSifPluginUid(TUid aUid) |
|
131 { |
|
132 iSifPluginUid = aUid; |
|
133 } |
|
134 |
|
135 inline void CSoftwareTypeRegInfo::SetInstallerSecureId(TSecureId aSecureId) |
|
136 { |
|
137 iInstallerSecureId = aSecureId; |
|
138 } |
|
139 |
|
140 inline void CSoftwareTypeRegInfo::SetExecutionLayerSecureId(TSecureId aSecureId) |
|
141 { |
|
142 iExecutionLayerSecureId = aSecureId; |
|
143 } |
|
144 |
|
145 inline const TDesC& CSoftwareTypeRegInfo::UniqueSoftwareTypeName() const |
|
146 { |
|
147 if (iUniqueSoftwareTypeName == NULL) |
|
148 { |
|
149 return KNullDesC; |
|
150 } |
|
151 return *iUniqueSoftwareTypeName; |
|
152 } |
|
153 |
|
154 inline TUid CSoftwareTypeRegInfo::SifPluginUid() const |
|
155 { |
|
156 return iSifPluginUid; |
|
157 } |
|
158 |
|
159 TSecureId CSoftwareTypeRegInfo::InstallerSecureId() const |
|
160 { |
|
161 return iInstallerSecureId; |
|
162 } |
|
163 |
|
164 TSecureId CSoftwareTypeRegInfo::ExecutionLayerSecureId() const |
|
165 { |
|
166 return iInstallerSecureId; |
|
167 } |
|
168 |
|
169 const RPointerArray<HBufC>& CSoftwareTypeRegInfo::MimeTypes() const |
|
170 { |
|
171 return iMimeTypes; |
|
172 } |
|
173 |
|
174 const RPointerArray<CLocalizedSoftwareTypeName>& CSoftwareTypeRegInfo::LocalizedSoftwareTypeNames() const |
|
175 { |
|
176 return iLocalizedSoftwareTypeNames; |
|
177 } |
|
178 } |
|
179 |
|
180 #endif // SWTYPEREGINFO_H |