|
1 /* |
|
2 * Copyright (c) 2008 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 "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: Presents plugin info using states uid, interface, type and name |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "plugininfo.h" |
|
20 |
|
21 const TInt32 KMultiInstanceDefaultValue = 1; |
|
22 const TInt32 KMaxChildsDefaultValue = 6; |
|
23 |
|
24 namespace hspswrapper{ |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CPluginInfo::CPluginInfo() |
|
30 : iMultiInstance( KMultiInstanceDefaultValue ) |
|
31 { |
|
32 iMaxChilds = KMaxChildsDefaultValue; |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 void CPluginInfo::ConstructL() |
|
39 { |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CPluginInfo* CPluginInfo::NewL() |
|
46 { |
|
47 CPluginInfo* self = CPluginInfo::NewLC(); |
|
48 CleanupStack::Pop( self ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 EXPORT_C CPluginInfo* CPluginInfo::NewLC() |
|
56 { |
|
57 CPluginInfo* self = new( ELeave ) CPluginInfo; |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C CPluginInfo::~CPluginInfo() |
|
67 { |
|
68 delete iUid; |
|
69 delete iType; |
|
70 delete iInterface; |
|
71 delete iName; |
|
72 delete iConfigurationState; |
|
73 delete iDescription; |
|
74 delete iLogoIcon; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 EXPORT_C CPluginInfo& CPluginInfo::SetUidL(const TDesC8& aUid) |
|
81 { |
|
82 delete iUid; |
|
83 iUid = NULL; |
|
84 iUid = aUid.AllocL(); |
|
85 return *this; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 EXPORT_C const TDesC8& CPluginInfo::Uid()const |
|
92 { |
|
93 if(iUid) |
|
94 { |
|
95 return *iUid; |
|
96 } |
|
97 else |
|
98 { |
|
99 return KNullDesC8; |
|
100 } |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C CPluginInfo& CPluginInfo::SetTypeL(const TDesC8& aType) |
|
107 { |
|
108 delete iType; |
|
109 iType = NULL; |
|
110 iType = aType.AllocL(); |
|
111 return *this; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C const TDesC8& CPluginInfo::Type()const |
|
118 { |
|
119 if(iType) |
|
120 { |
|
121 return *iType; |
|
122 } |
|
123 else |
|
124 { |
|
125 return KNullDesC8; |
|
126 } |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C CPluginInfo& CPluginInfo::SetInterfaceL( |
|
133 const TDesC8& aInterface) |
|
134 { |
|
135 delete iInterface; |
|
136 iInterface = NULL; |
|
137 iInterface = aInterface.AllocL(); |
|
138 return *this; |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C const TDesC8& CPluginInfo::Interface()const |
|
145 { |
|
146 if(iInterface) |
|
147 { |
|
148 return *iInterface; |
|
149 } |
|
150 else |
|
151 { |
|
152 return KNullDesC8; |
|
153 } |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 EXPORT_C CPluginInfo& CPluginInfo::SetNameL(const TDesC8& aName) |
|
160 { |
|
161 delete iName; |
|
162 iName = NULL; |
|
163 iName = aName.AllocL(); |
|
164 return *this; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 EXPORT_C const TDesC8& CPluginInfo::Name()const |
|
171 { |
|
172 if(iName) |
|
173 { |
|
174 return *iName; |
|
175 } |
|
176 else |
|
177 { |
|
178 return KNullDesC8; |
|
179 } |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C CPluginInfo& CPluginInfo::SetConfigurationStateL( |
|
186 const TDesC8& aConfigurationState) |
|
187 { |
|
188 delete iConfigurationState; |
|
189 iConfigurationState = NULL; |
|
190 |
|
191 iConfigurationState = aConfigurationState.AllocL(); |
|
192 |
|
193 return *this; |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C const TDesC8& CPluginInfo::ConfigurationState()const |
|
200 { |
|
201 if(iConfigurationState) |
|
202 { |
|
203 return *iConfigurationState; |
|
204 } |
|
205 else |
|
206 { |
|
207 return KNullDesC8; |
|
208 } |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 EXPORT_C CPluginInfo& CPluginInfo::SetMultiInstanceL( |
|
215 const TInt32 aMultiInstance ) |
|
216 { |
|
217 iMultiInstance = aMultiInstance; |
|
218 return *this; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 EXPORT_C const TInt32& CPluginInfo::MultiInstance()const |
|
225 { |
|
226 return iMultiInstance; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 EXPORT_C const TInt32& CPluginInfo::MaxChild()const |
|
233 { |
|
234 return iMaxChilds; |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 EXPORT_C CPluginInfo& CPluginInfo::SetMaxChild( |
|
241 const TInt32 aMaxChild ) |
|
242 { |
|
243 iMaxChilds = aMaxChild; |
|
244 return *this; |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 EXPORT_C CPluginInfo& CPluginInfo::SetDescriptionL( const TDesC& aDescription ) |
|
251 { |
|
252 delete iDescription; |
|
253 iDescription = NULL; |
|
254 |
|
255 iDescription = aDescription.AllocL(); |
|
256 return *this; |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 EXPORT_C CPluginInfo& CPluginInfo::SetDescriptionL( const TDesC8& aDescription ) |
|
263 { |
|
264 delete iDescription; |
|
265 iDescription = NULL; |
|
266 |
|
267 iDescription = HBufC::NewL( aDescription.Length() ); |
|
268 iDescription->Des().Copy( aDescription ); |
|
269 return *this; |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------------------------- |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C const TDesC& CPluginInfo::Description() const |
|
276 { |
|
277 return iDescription ? *iDescription : KNullDesC(); |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 EXPORT_C CPluginInfo& CPluginInfo::SetLogoIconL( const TDesC& aLogoIcon ) |
|
284 { |
|
285 delete iLogoIcon; |
|
286 iLogoIcon = NULL; |
|
287 |
|
288 iLogoIcon = aLogoIcon.AllocL(); |
|
289 return *this; |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 EXPORT_C CPluginInfo& CPluginInfo::SetLogoIconL( const TDesC8& aLogoIcon ) |
|
296 { |
|
297 delete iLogoIcon; |
|
298 iLogoIcon = NULL; |
|
299 |
|
300 iLogoIcon = HBufC::NewL( aLogoIcon.Length() ); |
|
301 iLogoIcon->Des().Copy( aLogoIcon ); |
|
302 return *this; |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 EXPORT_C const TDesC& CPluginInfo::LogoIcon() const |
|
309 { |
|
310 return iLogoIcon ? *iLogoIcon : KNullDesC(); |
|
311 } |
|
312 |
|
313 } // namespace |