1 /* |
|
2 * Copyright (c) 2008-2010 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 * Implement entry classes for Software Components Registry interface. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedAll |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
27 #include "screntries_internal.h" |
|
28 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
29 #include "screntries.h" |
|
30 #include "usiflog.h" |
|
31 #include <scs/streamingarray.h> |
|
32 #include <scs/cleanuputils.h> |
|
33 #include <usif/scr/screntries_platform.h> |
|
34 |
|
35 using namespace Usif; |
|
36 |
|
37 |
|
38 /////////////////////// |
|
39 // CGlobalComponentId |
|
40 /////////////////////// |
|
41 |
|
42 CGlobalComponentId::CGlobalComponentId() |
|
43 { |
|
44 // empty |
|
45 } |
|
46 |
|
47 EXPORT_C CGlobalComponentId::~CGlobalComponentId() |
|
48 { |
|
49 delete iGlobalIdName; |
|
50 delete iSoftwareTypeName; |
|
51 } |
|
52 |
|
53 EXPORT_C CGlobalComponentId* CGlobalComponentId::NewLC() |
|
54 { |
|
55 CGlobalComponentId *self = new(ELeave) CGlobalComponentId(); |
|
56 CleanupStack::PushL(self); |
|
57 return self; |
|
58 } |
|
59 |
|
60 EXPORT_C CGlobalComponentId* CGlobalComponentId::NewL(const TDesC& aGlobalIdName, const TDesC& aUniqueSwTypeName) |
|
61 { |
|
62 CGlobalComponentId *self = CGlobalComponentId::NewLC(aGlobalIdName, aUniqueSwTypeName); |
|
63 CleanupStack::Pop(self); |
|
64 return self; |
|
65 } |
|
66 |
|
67 EXPORT_C CGlobalComponentId* CGlobalComponentId::NewLC(const TDesC& aGlobalIdName, const TDesC& aUniqueSwTypeName) |
|
68 { |
|
69 CGlobalComponentId *self = CGlobalComponentId::NewLC(); |
|
70 self->ConstructL(aGlobalIdName, aUniqueSwTypeName); |
|
71 return self; |
|
72 } |
|
73 |
|
74 EXPORT_C CGlobalComponentId* CGlobalComponentId::NewL(RReadStream& aStream) |
|
75 { |
|
76 CGlobalComponentId *self = CGlobalComponentId::NewLC(); |
|
77 self->InternalizeL(aStream); |
|
78 CleanupStack::Pop(self); |
|
79 return self; |
|
80 } |
|
81 |
|
82 void CGlobalComponentId::ConstructL(const TDesC& aGlobalIdName, const TDesC& aSoftwareTypeName) |
|
83 { |
|
84 iGlobalIdName = aGlobalIdName.AllocL(); |
|
85 iSoftwareTypeName = aSoftwareTypeName.AllocL(); |
|
86 } |
|
87 |
|
88 EXPORT_C void CGlobalComponentId::ExternalizeL(RWriteStream& aStream) const |
|
89 { |
|
90 aStream << *iGlobalIdName; |
|
91 aStream << *iSoftwareTypeName; |
|
92 } |
|
93 |
|
94 EXPORT_C void CGlobalComponentId::InternalizeL(RReadStream& aStream) |
|
95 { |
|
96 // Read global id name |
|
97 DeleteObjectZ(iGlobalIdName); |
|
98 iGlobalIdName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
99 // Read software type name |
|
100 DeleteObjectZ(iSoftwareTypeName); |
|
101 iSoftwareTypeName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
102 } |
|
103 |
|
104 EXPORT_C const TDesC& CGlobalComponentId::GlobalIdName() const |
|
105 { |
|
106 return *iGlobalIdName; |
|
107 } |
|
108 |
|
109 EXPORT_C const TDesC& CGlobalComponentId::SoftwareTypeName() const |
|
110 { |
|
111 return *iSoftwareTypeName; |
|
112 } |
|
113 |
|
114 |
|
115 //////////////////////// |
|
116 // CVersionedComponentId |
|
117 //////////////////////// |
|
118 |
|
119 CVersionedComponentId::CVersionedComponentId() |
|
120 { |
|
121 // empty |
|
122 } |
|
123 |
|
124 EXPORT_C CVersionedComponentId::~CVersionedComponentId() |
|
125 { |
|
126 delete iGlobalId; |
|
127 delete iVersionFrom; |
|
128 delete iVersionTo; |
|
129 } |
|
130 |
|
131 EXPORT_C CVersionedComponentId* CVersionedComponentId::NewLC() |
|
132 { |
|
133 CVersionedComponentId *self = new(ELeave) CVersionedComponentId(); |
|
134 CleanupStack::PushL(self); |
|
135 return self; |
|
136 } |
|
137 |
|
138 EXPORT_C CVersionedComponentId* CVersionedComponentId::NewL(const CGlobalComponentId& aGlobalId, const TDesC* aVersionFrom, const TDesC* aVersionTo) |
|
139 { |
|
140 CVersionedComponentId *self = CVersionedComponentId::NewLC(aGlobalId, aVersionFrom, aVersionTo); |
|
141 CleanupStack::Pop(self); |
|
142 return self; |
|
143 } |
|
144 |
|
145 EXPORT_C CVersionedComponentId* CVersionedComponentId::NewLC(const CGlobalComponentId& aGlobalId, const TDesC* aVersionFrom, const TDesC* aVersionTo) |
|
146 { |
|
147 CVersionedComponentId *self = CVersionedComponentId::NewLC(); |
|
148 self->ConstructL(aGlobalId, aVersionFrom, aVersionTo); |
|
149 return self; |
|
150 } |
|
151 |
|
152 void CVersionedComponentId::ConstructL(const CGlobalComponentId& aGlobalId, const TDesC* aVersionFrom, const TDesC* aVersionTo) |
|
153 { |
|
154 iGlobalId = CGlobalComponentId::NewL(aGlobalId.GlobalIdName(), aGlobalId.SoftwareTypeName()); |
|
155 |
|
156 if(aVersionFrom) |
|
157 iVersionFrom = aVersionFrom->AllocL(); |
|
158 else |
|
159 iVersionFrom = KNullDesC().AllocL(); |
|
160 |
|
161 if(aVersionTo) |
|
162 iVersionTo = aVersionTo->AllocL(); |
|
163 else |
|
164 iVersionTo = KNullDesC().AllocL(); |
|
165 } |
|
166 |
|
167 EXPORT_C CVersionedComponentId* CVersionedComponentId::NewL(RReadStream& aStream) |
|
168 { |
|
169 CVersionedComponentId *self = CVersionedComponentId::NewLC(); |
|
170 self->InternalizeL(aStream); |
|
171 CleanupStack::Pop(self); |
|
172 return self; |
|
173 } |
|
174 |
|
175 EXPORT_C void CVersionedComponentId::InternalizeL(RReadStream& aStream) |
|
176 { |
|
177 // Read global id |
|
178 DeleteObjectZ(iGlobalId); |
|
179 iGlobalId = CGlobalComponentId::NewL(aStream); |
|
180 // Read version from |
|
181 DeleteObjectZ(iVersionFrom); |
|
182 iVersionFrom = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
183 // Read version to |
|
184 DeleteObjectZ(iVersionTo); |
|
185 iVersionTo = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
186 } |
|
187 |
|
188 EXPORT_C void CVersionedComponentId::ExternalizeL(RWriteStream& aStream) const |
|
189 { |
|
190 aStream << *iGlobalId; |
|
191 aStream << *iVersionFrom; |
|
192 aStream << *iVersionTo; |
|
193 } |
|
194 |
|
195 EXPORT_C const CGlobalComponentId& CVersionedComponentId::GlobalId() const |
|
196 { |
|
197 return *iGlobalId; |
|
198 } |
|
199 |
|
200 EXPORT_C const TDesC* CVersionedComponentId::VersionFrom() const |
|
201 { |
|
202 if(!iVersionFrom->Length()) |
|
203 return NULL; |
|
204 else |
|
205 return iVersionFrom; |
|
206 } |
|
207 |
|
208 EXPORT_C const TDesC* CVersionedComponentId::VersionTo() const |
|
209 { |
|
210 if(!iVersionTo->Length()) |
|
211 return NULL; |
|
212 else |
|
213 return iVersionTo; |
|
214 } |
|
215 |
|
216 |
|
217 /////////////////////// |
|
218 // CComponentEntry |
|
219 /////////////////////// |
|
220 |
|
221 CComponentEntry::CComponentEntry() |
|
222 { |
|
223 // empty |
|
224 } |
|
225 |
|
226 EXPORT_C CComponentEntry::~CComponentEntry() |
|
227 { |
|
228 delete iName; |
|
229 delete iVendor; |
|
230 delete iSwType; |
|
231 delete iGlobalId; |
|
232 delete iVersion; |
|
233 delete iInstallTime; |
|
234 } |
|
235 |
|
236 EXPORT_C CComponentEntry* CComponentEntry::NewL() |
|
237 { |
|
238 CComponentEntry *self = CComponentEntry::NewLC(); |
|
239 CleanupStack::Pop(self); |
|
240 return self; |
|
241 } |
|
242 |
|
243 EXPORT_C CComponentEntry* CComponentEntry::NewLC() |
|
244 { |
|
245 CComponentEntry *self = new(ELeave) CComponentEntry(); |
|
246 CleanupStack::PushL(self); |
|
247 return self; |
|
248 } |
|
249 |
|
250 EXPORT_C CComponentEntry* CComponentEntry::NewL(RReadStream& aStream) |
|
251 { |
|
252 CComponentEntry *self = CComponentEntry::NewLC(); |
|
253 self->InternalizeL(aStream); |
|
254 CleanupStack::Pop(self); |
|
255 return self; |
|
256 } |
|
257 |
|
258 EXPORT_C CComponentEntry* CComponentEntry::NewL(const TComponentId& aId, const TDesC& aName, const TDesC& aVendor, const TDesC& aSwType, |
|
259 const TDesC& aGlobalId, TBool aRemovable, TInt64 aSize, const TScomoState& aScomoState, const TDriveList& aInstalledDrives, |
|
260 const TDesC& aVersion, const TDesC& aInstallTime, TBool aDrmProtected, TBool aHidden, TBool aKnownRevoked, TBool aOriginVerified) |
|
261 { |
|
262 CComponentEntry *self = CComponentEntry::NewLC(aId, aName, aVendor, aSwType, aGlobalId, aRemovable, aSize, aScomoState, aInstalledDrives, |
|
263 aVersion, aInstallTime, aDrmProtected, aHidden, aKnownRevoked, aOriginVerified); |
|
264 CleanupStack::Pop(self); |
|
265 return self; |
|
266 } |
|
267 |
|
268 EXPORT_C CComponentEntry* CComponentEntry::NewLC(const TComponentId& aId, const TDesC& aName, const TDesC& aVendor, const TDesC& aSwType, |
|
269 const TDesC& aGlobalId, TBool aRemovable, TInt64 aSize, const TScomoState& aScomoState, const TDriveList& aInstalledDrives, |
|
270 const TDesC& aVersion, const TDesC& aInstallTime, TBool aDrmProtected, TBool aHidden, TBool aKnownRevoked, TBool aOriginVerified) |
|
271 { |
|
272 CComponentEntry *self = new(ELeave) CComponentEntry(); |
|
273 CleanupStack::PushL(self); |
|
274 self->ConstructL(aId, aName, aVendor, aSwType, aGlobalId, aRemovable, aSize, aScomoState, aInstalledDrives, aVersion, aInstallTime, |
|
275 aDrmProtected, aHidden, aKnownRevoked, aOriginVerified); |
|
276 return self; |
|
277 } |
|
278 |
|
279 void CComponentEntry::ConstructL(const TComponentId& aId, const TDesC& aName, const TDesC& aVendor, const TDesC& aSwType, const TDesC& aGlobalId, |
|
280 TBool aRemovable, TInt64 aSize, const TScomoState& aScomoState, const TDriveList& aInstalledDrives, |
|
281 const TDesC& aVersion, const TDesC& aInstallTime, TBool aDrmProtected, TBool aHidden, TBool aKnownRevoked, TBool aOriginVerified) |
|
282 { |
|
283 iComponentId = aId; |
|
284 iName = aName.AllocL(); |
|
285 iVendor = aVendor.AllocL(); |
|
286 iSwType = aSwType.AllocL(); |
|
287 iGlobalId = aGlobalId.AllocL(); |
|
288 iRemovable = aRemovable; |
|
289 iSize = aSize; |
|
290 iScomoState = aScomoState; |
|
291 iInstalledDrives.Copy(aInstalledDrives); |
|
292 iVersion = aVersion.AllocL(); |
|
293 iInstallTime = aInstallTime.AllocL(); |
|
294 iDrmProtected = aDrmProtected; |
|
295 iHidden = aHidden; |
|
296 iKnownRevoked = aKnownRevoked; |
|
297 iOriginVerified = aOriginVerified; |
|
298 } |
|
299 |
|
300 void WriteInt64L(RWriteStream& aStream, TInt64 aValue) |
|
301 { |
|
302 aStream.WriteInt32L(I64LOW(aValue)); |
|
303 aStream.WriteInt32L(I64HIGH(aValue)); |
|
304 } |
|
305 |
|
306 EXPORT_C void CComponentEntry::ExternalizeL(RWriteStream& aStream) const |
|
307 { |
|
308 aStream << TCardinality(iComponentId); // Write the compressed value by using cardinality class |
|
309 aStream << *iName; |
|
310 aStream << *iVendor; |
|
311 aStream << *iSwType; |
|
312 aStream << *iGlobalId; |
|
313 aStream << TCardinality(iRemovable); |
|
314 WriteInt64L(aStream, iSize); |
|
315 aStream << TCardinality(iScomoState); |
|
316 aStream << iInstalledDrives; |
|
317 aStream << *iVersion; |
|
318 aStream << *iInstallTime; |
|
319 aStream << TCardinality(iDrmProtected); |
|
320 aStream << TCardinality(iHidden); |
|
321 aStream << TCardinality(iKnownRevoked); |
|
322 aStream << TCardinality(iOriginVerified); |
|
323 } |
|
324 |
|
325 TInt64 ReadInt64L(RReadStream& aStream) |
|
326 { |
|
327 TInt32 low32Bit = aStream.ReadInt32L(); |
|
328 TInt32 high32Bit = aStream.ReadInt32L(); |
|
329 return MAKE_TINT64(high32Bit, low32Bit); |
|
330 } |
|
331 |
|
332 EXPORT_C void CComponentEntry::InternalizeL(RReadStream& aStream) |
|
333 { |
|
334 TCardinality c; |
|
335 // Read component id |
|
336 aStream >> c; |
|
337 iComponentId = TComponentId(c); |
|
338 // Read component name |
|
339 DeleteObjectZ(iName); |
|
340 iName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
341 // Read vendor name |
|
342 DeleteObjectZ(iVendor); |
|
343 iVendor = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
344 // Read software type |
|
345 DeleteObjectZ(iSwType); |
|
346 iSwType = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
347 // Read global id |
|
348 DeleteObjectZ(iGlobalId); |
|
349 iGlobalId = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
350 // Read if it is in removable |
|
351 aStream >> c; |
|
352 iRemovable = c; |
|
353 // Read install-time component size |
|
354 iSize = ReadInt64L(aStream); |
|
355 // Read scomo state |
|
356 aStream >> c; |
|
357 iScomoState = static_cast<TScomoState>(static_cast<TInt>(c)); |
|
358 // Read installed drives |
|
359 aStream >> iInstalledDrives; |
|
360 // Read version |
|
361 DeleteObjectZ(iVersion); |
|
362 iVersion = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
363 // Read install-time of the component |
|
364 DeleteObjectZ(iInstallTime); |
|
365 iInstallTime = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
366 // Read if it is DRM protected |
|
367 aStream >> c; |
|
368 iDrmProtected = c; |
|
369 // Read if it is hidden |
|
370 aStream >> c; |
|
371 iHidden = c; |
|
372 // Read if it is known revoked |
|
373 aStream >> c; |
|
374 iKnownRevoked = c; |
|
375 // Read if it is origin verified |
|
376 aStream >> c; |
|
377 iOriginVerified = c; |
|
378 } |
|
379 |
|
380 EXPORT_C const TComponentId& CComponentEntry::ComponentId() const |
|
381 { |
|
382 return iComponentId; |
|
383 } |
|
384 |
|
385 EXPORT_C const TDesC& CComponentEntry::Name() const |
|
386 { |
|
387 return *iName; |
|
388 } |
|
389 |
|
390 EXPORT_C const TDesC& CComponentEntry::Vendor() const |
|
391 { |
|
392 return *iVendor; |
|
393 } |
|
394 |
|
395 EXPORT_C const TDesC& CComponentEntry::SoftwareType() const |
|
396 { |
|
397 return *iSwType; |
|
398 } |
|
399 |
|
400 EXPORT_C const TDesC& CComponentEntry::GlobalId() const |
|
401 { |
|
402 return *iGlobalId; |
|
403 } |
|
404 |
|
405 EXPORT_C TBool CComponentEntry::IsRemovable() const |
|
406 { |
|
407 return iRemovable; |
|
408 } |
|
409 |
|
410 EXPORT_C TInt64 CComponentEntry::ComponentSize() const |
|
411 { |
|
412 return iSize; |
|
413 } |
|
414 |
|
415 EXPORT_C const TScomoState& CComponentEntry::ScomoState() const |
|
416 { |
|
417 return iScomoState; |
|
418 } |
|
419 |
|
420 EXPORT_C const TDriveList& CComponentEntry::InstalledDrives() const |
|
421 { |
|
422 return iInstalledDrives; |
|
423 } |
|
424 |
|
425 EXPORT_C const TDesC& CComponentEntry::Version() const |
|
426 { |
|
427 return *iVersion; |
|
428 } |
|
429 |
|
430 EXPORT_C TTime CComponentEntry::InstallTimeL() const |
|
431 { |
|
432 TTime time; |
|
433 User::LeaveIfError(time.Set(*iInstallTime)); |
|
434 return time; |
|
435 } |
|
436 |
|
437 EXPORT_C TBool CComponentEntry::IsDrmProtected() const |
|
438 { |
|
439 return iDrmProtected; |
|
440 } |
|
441 |
|
442 EXPORT_C TBool CComponentEntry::IsHidden() const |
|
443 { |
|
444 return iHidden; |
|
445 } |
|
446 |
|
447 EXPORT_C TBool CComponentEntry::IsKnownRevoked() const |
|
448 { |
|
449 return iKnownRevoked; |
|
450 } |
|
451 |
|
452 EXPORT_C TBool CComponentEntry::IsOriginVerified() const |
|
453 { |
|
454 return iOriginVerified; |
|
455 } |
|
456 |
|
457 /////////////////////// |
|
458 // CPropertyEntry |
|
459 /////////////////////// |
|
460 |
|
461 CPropertyEntry::CPropertyEntry() |
|
462 { |
|
463 // empty |
|
464 } |
|
465 |
|
466 EXPORT_C CPropertyEntry::~CPropertyEntry() |
|
467 { |
|
468 delete iPropertyName; |
|
469 } |
|
470 |
|
471 void CPropertyEntry::ConstructL(const TDesC& aPropertyName) |
|
472 { |
|
473 iPropertyName = aPropertyName.AllocL(); |
|
474 } |
|
475 |
|
476 EXPORT_C const TDesC& CPropertyEntry::PropertyName() const |
|
477 { |
|
478 return *iPropertyName; |
|
479 } |
|
480 |
|
481 EXPORT_C CPropertyEntry* CPropertyEntry::NewL(RReadStream& aStream) |
|
482 { |
|
483 TCardinality c; |
|
484 aStream >> c; |
|
485 TPropertyType propType = TPropertyType(TInt(c)); |
|
486 CPropertyEntry *property(0); |
|
487 switch(propType) |
|
488 { |
|
489 case EBinaryProperty: |
|
490 property = CBinaryPropertyEntry::NewLC(); |
|
491 break; |
|
492 case EIntProperty: |
|
493 property = CIntPropertyEntry::NewLC(); |
|
494 break; |
|
495 case ELocalizedProperty: |
|
496 property = CLocalizablePropertyEntry::NewLC(); |
|
497 break; |
|
498 default: |
|
499 DEBUG_PRINTF2(_L("CPropertyEntry has got an invalid property type = %d"), propType); |
|
500 User::Leave(KErrCorrupt); |
|
501 } |
|
502 property->DoInternalizeL(aStream); |
|
503 property->iPropertyName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
504 CleanupStack::Pop(property); |
|
505 return property; |
|
506 } |
|
507 |
|
508 EXPORT_C void CPropertyEntry::ExternalizeL(RWriteStream& aStream) const |
|
509 { |
|
510 TPropertyType t = this->PropertyType(); |
|
511 aStream << TCardinality(t); |
|
512 this->DoExternalizeL(aStream); |
|
513 aStream << *iPropertyName; |
|
514 } |
|
515 |
|
516 |
|
517 /////////////////////// |
|
518 // CIntPropertyEntry |
|
519 /////////////////////// |
|
520 |
|
521 CIntPropertyEntry::CIntPropertyEntry() |
|
522 { |
|
523 // empty |
|
524 } |
|
525 |
|
526 CIntPropertyEntry::CIntPropertyEntry(TInt64 aPropertyIntValue) |
|
527 : CPropertyEntry(), iIntValue(aPropertyIntValue) |
|
528 { |
|
529 // empty |
|
530 } |
|
531 |
|
532 EXPORT_C CIntPropertyEntry::~CIntPropertyEntry() |
|
533 { |
|
534 // empty |
|
535 } |
|
536 |
|
537 EXPORT_C CIntPropertyEntry* CIntPropertyEntry::NewL(const TDesC& aPropertyName, TInt64 aPropertyValue) |
|
538 { |
|
539 CIntPropertyEntry *self = CIntPropertyEntry::NewLC(aPropertyName, aPropertyValue); |
|
540 CleanupStack::Pop(self); |
|
541 return self; |
|
542 } |
|
543 |
|
544 EXPORT_C CIntPropertyEntry* CIntPropertyEntry::NewLC(const TDesC& aPropertyName, TInt64 aPropertyValue) |
|
545 { |
|
546 CIntPropertyEntry *self = new (ELeave) CIntPropertyEntry(aPropertyValue); |
|
547 CleanupStack::PushL(self); |
|
548 self->ConstructL(aPropertyName); |
|
549 return self; |
|
550 } |
|
551 |
|
552 void CIntPropertyEntry::ConstructL(const TDesC& aPropertyName) |
|
553 { |
|
554 CPropertyEntry::ConstructL(aPropertyName); |
|
555 } |
|
556 |
|
557 CIntPropertyEntry* CIntPropertyEntry::NewLC() |
|
558 { |
|
559 CIntPropertyEntry *self = new(ELeave) CIntPropertyEntry(); |
|
560 CleanupStack::PushL(self); |
|
561 return self; |
|
562 } |
|
563 |
|
564 void CIntPropertyEntry::DoExternalizeL(RWriteStream& aStream) const |
|
565 { |
|
566 aStream.WriteInt32L(I64LOW(iIntValue)); |
|
567 aStream.WriteInt32L(I64HIGH(iIntValue)); |
|
568 } |
|
569 |
|
570 void CIntPropertyEntry::DoInternalizeL(RReadStream& aStream) |
|
571 { |
|
572 TInt32 low32Bit = aStream.ReadInt32L(); |
|
573 TInt32 high32Bit = aStream.ReadInt32L(); |
|
574 iIntValue = MAKE_TINT64(high32Bit, low32Bit); |
|
575 } |
|
576 |
|
577 EXPORT_C CPropertyEntry::TPropertyType CIntPropertyEntry::PropertyType() const |
|
578 { |
|
579 return CPropertyEntry::EIntProperty; |
|
580 } |
|
581 |
|
582 EXPORT_C TInt CIntPropertyEntry::IntValue() |
|
583 { |
|
584 return static_cast<TInt>(iIntValue); |
|
585 } |
|
586 |
|
587 EXPORT_C TInt64 CIntPropertyEntry::Int64Value() |
|
588 { |
|
589 return iIntValue; |
|
590 } |
|
591 |
|
592 /////////////////////// |
|
593 // CBinaryPropertyEntry |
|
594 /////////////////////// |
|
595 |
|
596 CBinaryPropertyEntry::CBinaryPropertyEntry() |
|
597 { |
|
598 // empty |
|
599 } |
|
600 |
|
601 EXPORT_C CBinaryPropertyEntry::~CBinaryPropertyEntry() |
|
602 { |
|
603 delete iValue; |
|
604 } |
|
605 |
|
606 EXPORT_C CBinaryPropertyEntry* CBinaryPropertyEntry::NewL(const TDesC& aPropertyName, const TDesC8& aPropertyValue) |
|
607 { |
|
608 CBinaryPropertyEntry *self = CBinaryPropertyEntry::NewLC(aPropertyName, aPropertyValue); |
|
609 CleanupStack::Pop(self); |
|
610 return self; |
|
611 } |
|
612 |
|
613 EXPORT_C CBinaryPropertyEntry* CBinaryPropertyEntry::NewLC(const TDesC& aPropertyName, const TDesC8& aPropertyValue) |
|
614 { |
|
615 CBinaryPropertyEntry *self = new(ELeave) CBinaryPropertyEntry(); |
|
616 CleanupStack::PushL(self); |
|
617 self->ConstructL(aPropertyName, aPropertyValue); |
|
618 return self; |
|
619 } |
|
620 |
|
621 void CBinaryPropertyEntry::ConstructL(const TDesC& aPropertyName, const TDesC8& aPropertyValue) |
|
622 { |
|
623 CPropertyEntry::ConstructL(aPropertyName); |
|
624 iValue = aPropertyValue.AllocL(); |
|
625 } |
|
626 |
|
627 CBinaryPropertyEntry* CBinaryPropertyEntry::NewLC() |
|
628 { |
|
629 CBinaryPropertyEntry *self = new(ELeave) CBinaryPropertyEntry(); |
|
630 CleanupStack::PushL(self); |
|
631 return self; |
|
632 } |
|
633 |
|
634 void CBinaryPropertyEntry::DoExternalizeL(RWriteStream &aStream) const |
|
635 { |
|
636 aStream << *iValue; |
|
637 } |
|
638 |
|
639 void CBinaryPropertyEntry::DoInternalizeL(RReadStream& aStream) |
|
640 { |
|
641 DeleteObjectZ(iValue); |
|
642 iValue = HBufC8::NewL(aStream, KMaxTInt); // No restriction on length |
|
643 } |
|
644 |
|
645 EXPORT_C CBinaryPropertyEntry::TPropertyType CBinaryPropertyEntry::PropertyType() const |
|
646 { |
|
647 return CBinaryPropertyEntry::EBinaryProperty; |
|
648 } |
|
649 |
|
650 EXPORT_C const TDesC8& CBinaryPropertyEntry::BinaryValue() |
|
651 { |
|
652 return *iValue; |
|
653 } |
|
654 |
|
655 /////////////////////// |
|
656 // CLocalizablePropertyEntry |
|
657 /////////////////////// |
|
658 |
|
659 CLocalizablePropertyEntry::CLocalizablePropertyEntry() |
|
660 { |
|
661 // empty |
|
662 } |
|
663 |
|
664 CLocalizablePropertyEntry::CLocalizablePropertyEntry(TLanguage aLocale) : iLocale(aLocale) |
|
665 { |
|
666 // empty |
|
667 } |
|
668 |
|
669 EXPORT_C CLocalizablePropertyEntry::~CLocalizablePropertyEntry() |
|
670 { |
|
671 delete iStrValue; |
|
672 } |
|
673 |
|
674 EXPORT_C CLocalizablePropertyEntry* CLocalizablePropertyEntry::NewL(const TDesC& aPropertyName, const TDesC& aPropertyValue, TLanguage aLocale) |
|
675 { |
|
676 CLocalizablePropertyEntry *self = CLocalizablePropertyEntry::NewLC(aPropertyName, aPropertyValue, aLocale); |
|
677 CleanupStack::Pop(self); |
|
678 return self; |
|
679 } |
|
680 |
|
681 EXPORT_C CLocalizablePropertyEntry* CLocalizablePropertyEntry::NewLC( const TDesC& aPropertyName, const TDesC& aPropertyValue, TLanguage aLocale) |
|
682 { |
|
683 CLocalizablePropertyEntry *self = new(ELeave) CLocalizablePropertyEntry(aLocale); |
|
684 CleanupStack::PushL(self); |
|
685 self->ConstructL(aPropertyName, aPropertyValue); |
|
686 return self; |
|
687 } |
|
688 |
|
689 CLocalizablePropertyEntry* CLocalizablePropertyEntry::NewLC() |
|
690 { |
|
691 CLocalizablePropertyEntry *self = new(ELeave) CLocalizablePropertyEntry(); |
|
692 CleanupStack::PushL(self); |
|
693 return self; |
|
694 } |
|
695 |
|
696 void CLocalizablePropertyEntry::ConstructL(const TDesC& aPropertyName, const TDesC& aPropertyValue) |
|
697 { |
|
698 CPropertyEntry::ConstructL(aPropertyName); |
|
699 iStrValue = aPropertyValue.AllocL(); |
|
700 } |
|
701 |
|
702 void CLocalizablePropertyEntry::DoExternalizeL(RWriteStream &aStream) const |
|
703 { |
|
704 aStream << *iStrValue; |
|
705 aStream.WriteInt32L(iLocale); |
|
706 } |
|
707 |
|
708 void CLocalizablePropertyEntry::DoInternalizeL(RReadStream& aStream) |
|
709 { |
|
710 iStrValue = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
711 iLocale = TLanguage(aStream.ReadInt32L()); |
|
712 } |
|
713 |
|
714 EXPORT_C CPropertyEntry::TPropertyType CLocalizablePropertyEntry::PropertyType() const |
|
715 { |
|
716 return CPropertyEntry::ELocalizedProperty; |
|
717 } |
|
718 |
|
719 EXPORT_C TLanguage CLocalizablePropertyEntry::LocaleL() const |
|
720 { |
|
721 return iLocale; |
|
722 } |
|
723 |
|
724 EXPORT_C const TDesC& CLocalizablePropertyEntry::StrValue() const |
|
725 { |
|
726 return *iStrValue; |
|
727 } |
|
728 |
|
729 /////////////////////// |
|
730 // CLocalizableCommonData |
|
731 /////////////////////// |
|
732 |
|
733 CLocalizableCommonData::CLocalizableCommonData() |
|
734 { |
|
735 // empty |
|
736 } |
|
737 |
|
738 CLocalizableCommonData::CLocalizableCommonData(TLanguage aLocale) |
|
739 : iLocale(aLocale) |
|
740 { |
|
741 // empty |
|
742 } |
|
743 |
|
744 CLocalizableCommonData::~CLocalizableCommonData() |
|
745 { |
|
746 // empty |
|
747 } |
|
748 |
|
749 EXPORT_C TLanguage CLocalizableCommonData::Locale() const |
|
750 { |
|
751 return iLocale; |
|
752 } |
|
753 |
|
754 void CLocalizableCommonData::ExternalizeL(RWriteStream& aStream) const |
|
755 { |
|
756 aStream.WriteInt32L(Locale()); |
|
757 } |
|
758 |
|
759 void CLocalizableCommonData::InternalizeL(RReadStream& aStream) |
|
760 { |
|
761 TLanguage locale = static_cast<TLanguage>(aStream.ReadInt32L()); |
|
762 iLocale = locale; |
|
763 } |
|
764 |
|
765 ///////////////////////////// |
|
766 // CLocalizableComponentInfo |
|
767 ///////////////////////////// |
|
768 |
|
769 CLocalizableComponentInfo::CLocalizableComponentInfo() |
|
770 { |
|
771 // empty |
|
772 } |
|
773 |
|
774 CLocalizableComponentInfo::CLocalizableComponentInfo(TLanguage aLocale) |
|
775 : CLocalizableCommonData(aLocale) |
|
776 { |
|
777 // empty |
|
778 } |
|
779 |
|
780 CLocalizableComponentInfo::~CLocalizableComponentInfo() |
|
781 { |
|
782 delete iName; |
|
783 delete iVendor; |
|
784 } |
|
785 |
|
786 EXPORT_C CLocalizableComponentInfo* CLocalizableComponentInfo::NewL(const TDesC& aName, const TDesC& aVendor, TLanguage aLocale) |
|
787 { |
|
788 CLocalizableComponentInfo *self = CLocalizableComponentInfo::NewLC(aName, aVendor, aLocale); |
|
789 CleanupStack::Pop(self); |
|
790 return self; |
|
791 } |
|
792 |
|
793 EXPORT_C CLocalizableComponentInfo* CLocalizableComponentInfo::NewLC(const TDesC& aName, const TDesC& aVendor, TLanguage aLocale) |
|
794 { |
|
795 CLocalizableComponentInfo *self = new(ELeave) CLocalizableComponentInfo(aLocale); |
|
796 CleanupStack::PushL(self); |
|
797 self->ConstructL(aName, aVendor); |
|
798 return self; |
|
799 } |
|
800 |
|
801 EXPORT_C CLocalizableComponentInfo* CLocalizableComponentInfo::NewL(RReadStream& aStream) |
|
802 { |
|
803 CLocalizableComponentInfo* self = new(ELeave) CLocalizableComponentInfo(); |
|
804 CleanupStack::PushL(self); |
|
805 self->InternalizeL(aStream); |
|
806 CleanupStack::Pop(self); |
|
807 return self; |
|
808 } |
|
809 |
|
810 EXPORT_C void CLocalizableComponentInfo::ConstructL(const TDesC& aName, const TDesC& aVendor) |
|
811 { |
|
812 iName = aName.AllocL(); |
|
813 iVendor = aVendor.AllocL(); |
|
814 } |
|
815 |
|
816 |
|
817 EXPORT_C void CLocalizableComponentInfo::ExternalizeL(RWriteStream& aStream) const |
|
818 { |
|
819 CLocalizableCommonData::ExternalizeL(aStream); |
|
820 aStream << *iName; |
|
821 aStream << *iVendor; |
|
822 } |
|
823 |
|
824 EXPORT_C void CLocalizableComponentInfo::InternalizeL(RReadStream& aStream) |
|
825 { |
|
826 CLocalizableCommonData::InternalizeL(aStream); |
|
827 |
|
828 delete iName; |
|
829 iName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
830 |
|
831 delete iVendor; |
|
832 iVendor = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
833 } |
|
834 |
|
835 EXPORT_C const TDesC& CLocalizableComponentInfo::NameL() const |
|
836 { |
|
837 return *iName; |
|
838 } |
|
839 |
|
840 EXPORT_C const TDesC& CLocalizableComponentInfo::VendorL() const |
|
841 { |
|
842 return *iVendor; |
|
843 } |
|
844 |
|
845 ///////////////////////////// |
|
846 // TCustomAccessInfo |
|
847 ///////////////////////////// |
|
848 |
|
849 EXPORT_C TCustomAccessInfo::TCustomAccessInfo(TSecureId aSecureId, TAccessMode aAccessMode) |
|
850 { |
|
851 iSecureId = aSecureId; |
|
852 iAccessMode = aAccessMode; |
|
853 } |
|
854 |
|
855 EXPORT_C TSecureId TCustomAccessInfo::SecureId() const |
|
856 { |
|
857 return iSecureId; |
|
858 } |
|
859 |
|
860 EXPORT_C TAccessMode TCustomAccessInfo::AccessMode() const |
|
861 { |
|
862 return iAccessMode; |
|
863 } |
|
864 |
|
865 ///////////////////////////// |
|
866 // CSoftwareTypeRegInfo |
|
867 ///////////////////////////// |
|
868 |
|
869 EXPORT_C CSoftwareTypeRegInfo* CSoftwareTypeRegInfo::NewL(const TDesC& aUniqueSoftwareTypeName) |
|
870 { |
|
871 CSoftwareTypeRegInfo* self = new (ELeave) CSoftwareTypeRegInfo(); |
|
872 CleanupStack::PushL(self); |
|
873 self->iUniqueSoftwareTypeName = HBufC::NewL(aUniqueSoftwareTypeName.Length()); |
|
874 self->iUniqueSoftwareTypeName->Des().Copy(aUniqueSoftwareTypeName); |
|
875 CleanupStack::Pop(self); |
|
876 return self; |
|
877 } |
|
878 |
|
879 EXPORT_C CSoftwareTypeRegInfo* CSoftwareTypeRegInfo::NewL(RReadStream& aStream) |
|
880 { |
|
881 CSoftwareTypeRegInfo* self = new (ELeave) CSoftwareTypeRegInfo(); |
|
882 CleanupStack::PushL(self); |
|
883 self->InternalizeL(aStream); |
|
884 CleanupStack::Pop(self); |
|
885 return self; |
|
886 } |
|
887 |
|
888 CSoftwareTypeRegInfo::CSoftwareTypeRegInfo() |
|
889 { |
|
890 } |
|
891 |
|
892 EXPORT_C CSoftwareTypeRegInfo::~CSoftwareTypeRegInfo() |
|
893 { |
|
894 delete iUniqueSoftwareTypeName; |
|
895 iCustomAccessList.Close(); |
|
896 iMimeTypes.Close(); |
|
897 iLocalizedSoftwareTypeNames.Close(); |
|
898 delete iLauncherExecutable; |
|
899 } |
|
900 |
|
901 EXPORT_C void CSoftwareTypeRegInfo::ExternalizeL(RWriteStream& aStream) const |
|
902 { |
|
903 aStream << *iUniqueSoftwareTypeName; |
|
904 aStream << iSifPluginUid.iUid; |
|
905 |
|
906 //Sids |
|
907 const TInt numSids = iCustomAccessList.Count(); |
|
908 aStream.WriteInt32L(numSids); |
|
909 for (TInt i=0; i< numSids; ++i) |
|
910 { |
|
911 TUid sid = iCustomAccessList[i].SecureId(); |
|
912 aStream << sid.iUid; |
|
913 aStream.WriteInt32L(iCustomAccessList[i].AccessMode()); |
|
914 } |
|
915 |
|
916 // MIME types |
|
917 const TInt numMimeTypes = iMimeTypes.Count(); |
|
918 aStream.WriteInt32L(numMimeTypes); |
|
919 for (TInt i=0; i<numMimeTypes; ++i) |
|
920 { |
|
921 aStream << *iMimeTypes[i]; |
|
922 } |
|
923 |
|
924 // Localized names |
|
925 const TInt numLocalizedNames = iLocalizedSoftwareTypeNames.Count(); |
|
926 aStream.WriteInt32L(numLocalizedNames); |
|
927 for (TInt i=0; i<numLocalizedNames; ++i) |
|
928 { |
|
929 aStream << *iLocalizedSoftwareTypeNames[i]; |
|
930 } |
|
931 |
|
932 // Launcher executable |
|
933 aStream << *iLauncherExecutable; |
|
934 } |
|
935 |
|
936 void CSoftwareTypeRegInfo::InternalizeL(RReadStream& aStream) |
|
937 { |
|
938 ASSERT(iUniqueSoftwareTypeName == NULL); |
|
939 |
|
940 iUniqueSoftwareTypeName = HBufC::NewL(aStream, EUniqueSwTypeNameMaxLength); |
|
941 |
|
942 iSifPluginUid = TUid::Uid(aStream.ReadInt32L()); |
|
943 |
|
944 // Sids |
|
945 const TInt numSids = aStream.ReadInt32L(); |
|
946 for (TInt i=0; i<numSids; ++i) |
|
947 { |
|
948 TSecureId secId(TUid::Uid(aStream.ReadInt32L())); |
|
949 TCustomAccessInfo customAccessInfo(secId, static_cast<TAccessMode>(aStream.ReadInt32L())); |
|
950 iCustomAccessList.AppendL(customAccessInfo); |
|
951 } |
|
952 |
|
953 // MIME types |
|
954 const TInt numMimeTypes = aStream.ReadInt32L(); |
|
955 for (TInt i=0; i<numMimeTypes; ++i) |
|
956 { |
|
957 HBufC* mimeType = HBufC::NewLC(aStream, EUniqueSwTypeNameMaxLength); |
|
958 iMimeTypes.AppendL(mimeType); |
|
959 CleanupStack::Pop(mimeType); |
|
960 } |
|
961 |
|
962 // Localized names |
|
963 const TInt numLocalizedNames = aStream.ReadInt32L(); |
|
964 for (TInt i=0; i<numLocalizedNames; ++i) |
|
965 { |
|
966 CLocalizedSoftwareTypeName* name = CLocalizedSoftwareTypeName::NewL(aStream); |
|
967 CleanupStack::PushL(name); |
|
968 iLocalizedSoftwareTypeNames.AppendL(name); |
|
969 CleanupStack::Pop(name); |
|
970 } |
|
971 |
|
972 iLauncherExecutable = HBufC::NewL(aStream, ELauncherExecutableMaxLength); |
|
973 } |
|
974 |
|
975 EXPORT_C void CSoftwareTypeRegInfo::SetMimeTypeL(const TDesC& aMimeType) |
|
976 { |
|
977 HBufC* mimeType = HBufC::NewLC(aMimeType.Length()); |
|
978 mimeType->Des().Copy(aMimeType); |
|
979 iMimeTypes.AppendL(mimeType); |
|
980 CleanupStack::Pop(mimeType); |
|
981 } |
|
982 |
|
983 EXPORT_C void CSoftwareTypeRegInfo::SetLocalizedSoftwareTypeNameL(TLanguage aLanguage, const TDesC& aName) |
|
984 { |
|
985 CLocalizedSoftwareTypeName* name = CLocalizedSoftwareTypeName::NewLC(aName, aLanguage); |
|
986 iLocalizedSoftwareTypeNames.AppendL(name); |
|
987 CleanupStack::Pop(name); |
|
988 } |
|
989 |
|
990 EXPORT_C void CSoftwareTypeRegInfo::SetLauncherExecutableL(const TDesC& aLauncherExecutable) |
|
991 { |
|
992 HBufC* launcherExecutable = HBufC::NewLC(aLauncherExecutable.Length()); |
|
993 launcherExecutable->Des().Copy(aLauncherExecutable); |
|
994 iLauncherExecutable = launcherExecutable; |
|
995 CleanupStack::Pop(launcherExecutable); |
|
996 } |
|
997 |
|
998 ///////////////////////////// |
|
999 // CComponentFilter |
|
1000 ///////////////////////////// |
|
1001 |
|
1002 CComponentFilter::CComponentFilter() |
|
1003 { |
|
1004 // empty |
|
1005 } |
|
1006 |
|
1007 CComponentFilter::~CComponentFilter() |
|
1008 { |
|
1009 delete iName; |
|
1010 delete iVendor; |
|
1011 delete iSwType; |
|
1012 delete iFile; |
|
1013 iPropertyList.ResetAndDestroy(); |
|
1014 iPropertyOperatorList.Reset(); |
|
1015 } |
|
1016 |
|
1017 EXPORT_C CComponentFilter* CComponentFilter::NewL() |
|
1018 { |
|
1019 CComponentFilter *self = CComponentFilter::NewLC(); |
|
1020 CleanupStack::Pop(self); |
|
1021 return self; |
|
1022 } |
|
1023 |
|
1024 EXPORT_C CComponentFilter* CComponentFilter::NewLC() |
|
1025 { |
|
1026 CComponentFilter *self = new(ELeave) CComponentFilter(); |
|
1027 CleanupStack::PushL(self); |
|
1028 self->ConstructL(); |
|
1029 return self; |
|
1030 } |
|
1031 |
|
1032 EXPORT_C CComponentFilter* CComponentFilter::NewL(RReadStream& aStream) |
|
1033 { |
|
1034 CComponentFilter *self = CComponentFilter::NewLC(); |
|
1035 self->InternalizeL(aStream); |
|
1036 CleanupStack::Pop(self); |
|
1037 return self; |
|
1038 } |
|
1039 |
|
1040 void CComponentFilter::ConstructL() |
|
1041 { |
|
1042 iName = KNullDesC().AllocL(); |
|
1043 iVendor = KNullDesC().AllocL(); |
|
1044 iSwType = KNullDesC().AllocL(); |
|
1045 iFile = KNullDesC().AllocL(); |
|
1046 } |
|
1047 |
|
1048 EXPORT_C void CComponentFilter::SetNameL(const TDesC& aName) |
|
1049 { |
|
1050 DeleteObjectZ(iName); |
|
1051 iName = aName.AllocL(); |
|
1052 iSetFlag |= EName; |
|
1053 } |
|
1054 |
|
1055 EXPORT_C void CComponentFilter::SetVendorL(const TDesC& aVendor) |
|
1056 { |
|
1057 DeleteObjectZ(iVendor); |
|
1058 iVendor = aVendor.AllocL(); |
|
1059 iSetFlag |= EVendor; |
|
1060 } |
|
1061 |
|
1062 EXPORT_C void CComponentFilter::SetSoftwareTypeL(const TDesC& aSwType) |
|
1063 { |
|
1064 DeleteObjectZ(iSwType); |
|
1065 iSwType = aSwType.AllocL(); |
|
1066 iSetFlag |= ESoftwareType; |
|
1067 } |
|
1068 |
|
1069 EXPORT_C void CComponentFilter::SetRemovable(TBool aValue) |
|
1070 { |
|
1071 iRemovable = aValue; |
|
1072 iSetFlag |= ERemovable; |
|
1073 } |
|
1074 |
|
1075 EXPORT_C void CComponentFilter::SetDrmProtected(TBool aValue) |
|
1076 { |
|
1077 iDrmProtected = aValue; |
|
1078 iSetFlag |= EDrmProtected; |
|
1079 } |
|
1080 |
|
1081 EXPORT_C void CComponentFilter::SetHidden(TBool aValue) |
|
1082 { |
|
1083 iHidden = aValue; |
|
1084 iSetFlag |= EHidden; |
|
1085 } |
|
1086 |
|
1087 EXPORT_C void CComponentFilter::SetKnownRevoked(TBool aValue) |
|
1088 { |
|
1089 iKnownRevoked = aValue; |
|
1090 iSetFlag |= EKnownRevoked; |
|
1091 } |
|
1092 |
|
1093 EXPORT_C void CComponentFilter::SetOriginVerified(TBool aValue) |
|
1094 { |
|
1095 iOriginVerified = aValue; |
|
1096 iSetFlag |= EOriginVerified; |
|
1097 } |
|
1098 |
|
1099 EXPORT_C void CComponentFilter::SetScomoStateL(TScomoState aScomoState) |
|
1100 { |
|
1101 iScomoState = aScomoState; |
|
1102 iSetFlag |= EScomoState; |
|
1103 } |
|
1104 |
|
1105 EXPORT_C void CComponentFilter::SetInstalledDrivesL(const TDriveList& aDrives) |
|
1106 { |
|
1107 iInstalledDrives.Copy(aDrives); |
|
1108 iSetFlag |= EInstalledDrive; |
|
1109 } |
|
1110 |
|
1111 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC& aValue, TLanguage aLocale, |
|
1112 TDbOperator aNameOperator, TDbOperator aValueOperator) |
|
1113 { |
|
1114 CPropertyEntry *prop = CLocalizablePropertyEntry::NewLC(aName, aValue, aLocale); |
|
1115 iPropertyList.AppendL(prop); |
|
1116 CleanupStack::Pop(prop); |
|
1117 iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator)); |
|
1118 iSetFlag |= EProperty; |
|
1119 } |
|
1120 |
|
1121 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, TInt64 aValue, TDbOperator aNameOperator, |
|
1122 TDbOperator aValueOperator) |
|
1123 { |
|
1124 CPropertyEntry *prop = CIntPropertyEntry::NewLC(aName, aValue); |
|
1125 iPropertyList.AppendL(prop); |
|
1126 CleanupStack::Pop(prop); |
|
1127 iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator)); |
|
1128 iSetFlag |= EProperty; |
|
1129 } |
|
1130 |
|
1131 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC8& aValue, TDbOperator aNameOperator, |
|
1132 TDbOperator aValueOperator) |
|
1133 { |
|
1134 CPropertyEntry *prop = CBinaryPropertyEntry::NewLC(aName, aValue); |
|
1135 iPropertyList.AppendL(prop); |
|
1136 CleanupStack::Pop(prop); |
|
1137 iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator)); |
|
1138 iSetFlag |= EProperty; |
|
1139 } |
|
1140 |
|
1141 EXPORT_C void CComponentFilter::SetFileL(const TDesC& aFile) |
|
1142 { |
|
1143 DeleteObjectZ(iFile); |
|
1144 iFile = aFile.AllocL(); |
|
1145 iSetFlag |= EFile; |
|
1146 } |
|
1147 |
|
1148 EXPORT_C void CComponentFilter::ExternalizeL(RWriteStream& aStream) const |
|
1149 { |
|
1150 aStream.WriteUint16L(iSetFlag); |
|
1151 aStream << *iName; |
|
1152 aStream << *iVendor; |
|
1153 aStream << *iSwType; |
|
1154 aStream << TCardinality(iScomoState); |
|
1155 aStream << iInstalledDrives; |
|
1156 aStream << TCardinality(iRemovable); |
|
1157 ExternalizePointersArrayL(iPropertyList, aStream); |
|
1158 ExternalizeFixedLengthArrayL(iPropertyOperatorList, aStream); |
|
1159 aStream << *iFile; |
|
1160 aStream << TCardinality(iDrmProtected); |
|
1161 aStream << TCardinality(iHidden); |
|
1162 aStream << TCardinality(iKnownRevoked); |
|
1163 aStream << TCardinality(iOriginVerified); |
|
1164 } |
|
1165 |
|
1166 void CComponentFilter::InternalizeL(RReadStream& aStream) |
|
1167 { |
|
1168 iSetFlag = aStream.ReadUint16L(); |
|
1169 DeleteObjectZ(iName); |
|
1170 iName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1171 DeleteObjectZ(iVendor); |
|
1172 iVendor = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1173 DeleteObjectZ(iSwType); |
|
1174 iSwType = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1175 TCardinality c; |
|
1176 aStream >> c; |
|
1177 iScomoState = static_cast<TScomoState>(static_cast<TInt>(c)); |
|
1178 aStream >> iInstalledDrives; |
|
1179 aStream >> c; |
|
1180 iRemovable = c; |
|
1181 iPropertyList.Reset(); |
|
1182 InternalizePointersArrayL(iPropertyList, aStream); |
|
1183 iPropertyOperatorList.Reset(); |
|
1184 InternalizeFixedLengthArrayL(iPropertyOperatorList, aStream); |
|
1185 DeleteObjectZ(iFile); |
|
1186 iFile = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1187 // Read if it is DRM protected |
|
1188 aStream >> c; |
|
1189 iDrmProtected = c; |
|
1190 // Read if it is hidden |
|
1191 aStream >> c; |
|
1192 iHidden = c; |
|
1193 // Read if it is known revoked |
|
1194 aStream >> c; |
|
1195 iKnownRevoked = c; |
|
1196 // Read if it is origin verified |
|
1197 aStream >> c; |
|
1198 iOriginVerified = c; |
|
1199 } |
|
1200 |
|
1201 ///////////////////////////// |
|
1202 // CLocalizedSoftwareTypeName |
|
1203 ///////////////////////////// |
|
1204 |
|
1205 CLocalizedSoftwareTypeName::CLocalizedSoftwareTypeName() |
|
1206 { |
|
1207 // empty |
|
1208 } |
|
1209 |
|
1210 CLocalizedSoftwareTypeName::CLocalizedSoftwareTypeName(TLanguage aLocale) |
|
1211 : CLocalizableCommonData(aLocale) |
|
1212 { |
|
1213 // empty |
|
1214 } |
|
1215 |
|
1216 CLocalizedSoftwareTypeName::~CLocalizedSoftwareTypeName() |
|
1217 { |
|
1218 delete iName; |
|
1219 } |
|
1220 |
|
1221 EXPORT_C CLocalizedSoftwareTypeName* CLocalizedSoftwareTypeName::NewL(const TDesC& aName, TLanguage aLocale) |
|
1222 { |
|
1223 CLocalizedSoftwareTypeName *self = CLocalizedSoftwareTypeName::NewLC(aName, aLocale); |
|
1224 CleanupStack::Pop(self); |
|
1225 return self; |
|
1226 } |
|
1227 |
|
1228 EXPORT_C CLocalizedSoftwareTypeName* CLocalizedSoftwareTypeName::NewLC(const TDesC& aName, TLanguage aLocale) |
|
1229 { |
|
1230 CLocalizedSoftwareTypeName *self = new(ELeave) CLocalizedSoftwareTypeName(aLocale); |
|
1231 CleanupStack::PushL(self); |
|
1232 self->ConstructL(aName); |
|
1233 return self; |
|
1234 } |
|
1235 |
|
1236 EXPORT_C CLocalizedSoftwareTypeName* CLocalizedSoftwareTypeName::NewL(RReadStream& aStream) |
|
1237 { |
|
1238 CLocalizedSoftwareTypeName* self = new(ELeave) CLocalizedSoftwareTypeName(); |
|
1239 CleanupStack::PushL(self); |
|
1240 self->InternalizeL(aStream); |
|
1241 CleanupStack::Pop(self); |
|
1242 return self; |
|
1243 } |
|
1244 |
|
1245 EXPORT_C void CLocalizedSoftwareTypeName::ConstructL(const TDesC& aName) |
|
1246 { |
|
1247 iName = aName.AllocL(); |
|
1248 } |
|
1249 |
|
1250 |
|
1251 EXPORT_C void CLocalizedSoftwareTypeName::ExternalizeL(RWriteStream& aStream) const |
|
1252 { |
|
1253 CLocalizableCommonData::ExternalizeL(aStream); |
|
1254 aStream << *iName; |
|
1255 } |
|
1256 |
|
1257 EXPORT_C void CLocalizedSoftwareTypeName::InternalizeL(RReadStream& aStream) |
|
1258 { |
|
1259 CLocalizableCommonData::InternalizeL(aStream); |
|
1260 |
|
1261 delete iName; |
|
1262 iName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1263 } |
|
1264 |
|
1265 EXPORT_C const TDesC& CLocalizedSoftwareTypeName::NameL() const |
|
1266 { |
|
1267 return *iName; |
|
1268 } |
|
1269 |
|
1270 |
|
1271 //////////////// |
|
1272 // CScrLogEntry |
|
1273 //////////////// |
|
1274 |
|
1275 CScrLogEntry::CScrLogEntry() |
|
1276 { |
|
1277 //empty |
|
1278 } |
|
1279 |
|
1280 CScrLogEntry::~CScrLogEntry() |
|
1281 { |
|
1282 delete iComponentName; |
|
1283 delete iSwTypeName; |
|
1284 delete iVersion; |
|
1285 delete iGlobalId; |
|
1286 } |
|
1287 |
|
1288 |
|
1289 EXPORT_C CScrLogEntry* CScrLogEntry::NewL(const TDesC& aComponentName, const TDesC& aUniqueSwTypeName, const TDesC& aGlobalId, const TDesC& aVersion, const TScrComponentOperationType aCompOpType) |
|
1290 { |
|
1291 CScrLogEntry *self = CScrLogEntry::NewLC(aComponentName, aUniqueSwTypeName, aGlobalId, aVersion, aCompOpType); |
|
1292 CleanupStack::Pop(self); |
|
1293 return self; |
|
1294 } |
|
1295 |
|
1296 EXPORT_C CScrLogEntry* CScrLogEntry::NewLC(const TDesC& aComponentName, const TDesC& aUniqueSwTypeName, const TDesC& aGlobalId, const TDesC& aVersion, const TScrComponentOperationType aCompOpType) |
|
1297 { |
|
1298 CScrLogEntry *self = new(ELeave) CScrLogEntry(); |
|
1299 CleanupStack::PushL(self); |
|
1300 self->ConstructL(aComponentName, aUniqueSwTypeName, aGlobalId, aVersion, aCompOpType); |
|
1301 return self; |
|
1302 } |
|
1303 |
|
1304 EXPORT_C CScrLogEntry* CScrLogEntry::NewLC(RReadStream& aStream) |
|
1305 { |
|
1306 CScrLogEntry *self = new(ELeave) CScrLogEntry(); |
|
1307 CleanupStack::PushL(self); |
|
1308 self->InternalizeL(aStream); |
|
1309 return self; |
|
1310 } |
|
1311 |
|
1312 void CScrLogEntry::ConstructL(const TDesC& aComponentName, const TDesC& aUniqueSwTypeName, const TDesC& aGlobalId, const TDesC& aVersion, const TScrComponentOperationType aCompOpType) |
|
1313 { |
|
1314 iComponentName = aComponentName.AllocL(); |
|
1315 iSwTypeName = aUniqueSwTypeName.AllocL(); |
|
1316 iGlobalId = aGlobalId.AllocL(); |
|
1317 iVersion = aVersion.AllocL(); |
|
1318 iOpType = aCompOpType; |
|
1319 iRecordTime.HomeTime(); |
|
1320 } |
|
1321 |
|
1322 |
|
1323 EXPORT_C void CScrLogEntry::ExternalizeL(RWriteStream& aStream) const |
|
1324 { |
|
1325 aStream << *iComponentName; |
|
1326 aStream << *iSwTypeName; |
|
1327 aStream << *iGlobalId; |
|
1328 aStream << *iVersion; |
|
1329 aStream.WriteInt32L(static_cast<TInt>(iOpType)); |
|
1330 WriteInt64L(aStream, iRecordTime.Int64()); |
|
1331 } |
|
1332 |
|
1333 |
|
1334 EXPORT_C void CScrLogEntry::InternalizeL(RReadStream& aStream) |
|
1335 { |
|
1336 DeleteObjectZ(iComponentName); |
|
1337 iComponentName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1338 DeleteObjectZ(iSwTypeName); |
|
1339 iSwTypeName = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1340 DeleteObjectZ(iGlobalId); |
|
1341 iGlobalId = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1342 DeleteObjectZ(iVersion); |
|
1343 iVersion = HBufC::NewL(aStream, KMaxTInt); // No restriction on length |
|
1344 iOpType = static_cast<TScrComponentOperationType>(aStream.ReadInt32L()); |
|
1345 iRecordTime = TTime(ReadInt64L(aStream)); |
|
1346 } |
|
1347 |
|
1348 |
|
1349 EXPORT_C const TDesC& CScrLogEntry::ComponentName() const |
|
1350 { |
|
1351 return *iComponentName; |
|
1352 } |
|
1353 |
|
1354 EXPORT_C const TDesC& CScrLogEntry::SoftwareTypeName() const |
|
1355 { |
|
1356 return *iSwTypeName; |
|
1357 } |
|
1358 |
|
1359 EXPORT_C const TDesC& CScrLogEntry::GlobalId() const |
|
1360 { |
|
1361 return *iGlobalId; |
|
1362 } |
|
1363 |
|
1364 EXPORT_C const TDesC& CScrLogEntry::ComponentVersion() const |
|
1365 { |
|
1366 return *iVersion; |
|
1367 } |
|
1368 |
|
1369 EXPORT_C const TTime CScrLogEntry::OperationTime() const |
|
1370 { |
|
1371 return iRecordTime; |
|
1372 } |
|
1373 |
|
1374 EXPORT_C TScrComponentOperationType CScrLogEntry::OperationType() const |
|
1375 { |
|
1376 return iOpType; |
|
1377 } |
|
1378 |
|
1379 EXPORT_C TComponentId CScrLogEntry::ComponentId() const |
|
1380 { |
|
1381 return iComponentId; |
|
1382 } |
|
1383 |
|
1384 EXPORT_C CComponentFilter::TPropertyOperator::TPropertyOperator(TDbOperator aNameOperator, TDbOperator aValueOperator): |
|
1385 iNameOperator(aNameOperator), |
|
1386 iValueOperator(aValueOperator) |
|
1387 { |
|
1388 } |
|
1389 |
|
1390 void CComponentFilter::TPropertyOperator::ExternalizeL(RWriteStream& aStream) const |
|
1391 { |
|
1392 aStream.WriteInt32L(iNameOperator); |
|
1393 aStream.WriteInt32L(iValueOperator); |
|
1394 } |
|
1395 |
|
1396 EXPORT_C void CComponentFilter::TPropertyOperator::InternalizeL(RReadStream& aStream) |
|
1397 { |
|
1398 iNameOperator = static_cast<TDbOperator>(aStream.ReadInt32L()); |
|
1399 iValueOperator = static_cast<TDbOperator>(aStream.ReadInt32L()); |
|
1400 } |
|
1401 |
|
1402 EXPORT_C CComponentFilter::TDbOperator CComponentFilter::TPropertyOperator::NameOperator() const |
|
1403 { |
|
1404 return iNameOperator; |
|
1405 } |
|
1406 |
|
1407 EXPORT_C CComponentFilter::TDbOperator CComponentFilter::TPropertyOperator::ValueOperator() const |
|
1408 { |
|
1409 return iValueOperator; |
|
1410 } |
|