|
1 /* |
|
2 * Copyright (c) 2004-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 * sisregistrydependency.h |
|
16 * CSisRegistryPackage class implementation |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @released |
|
24 @internalComponent |
|
25 */ |
|
26 |
|
27 #include <s32strm.h> |
|
28 #include "sisregistrypackage.h" |
|
29 |
|
30 using namespace Swi; |
|
31 |
|
32 |
|
33 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewL(TUid aUid, const TDesC& aName, const TDesC& aVendor) |
|
34 { |
|
35 CSisRegistryPackage* self = CSisRegistryPackage::NewLC(aUid, aName, aVendor); |
|
36 CleanupStack::Pop(self); |
|
37 return self; |
|
38 } |
|
39 |
|
40 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewLC(TUid aUid, const TDesC& aName, const TDesC& aVendor) |
|
41 { |
|
42 CSisRegistryPackage* self = new(ELeave) CSisRegistryPackage(aUid); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(aName, aVendor); |
|
45 return self; |
|
46 } |
|
47 |
|
48 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewL(RReadStream& aStream) |
|
49 { |
|
50 CSisRegistryPackage* self = CSisRegistryPackage::NewLC(aStream); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewLC(RReadStream& aStream) |
|
56 { |
|
57 CSisRegistryPackage* self = new(ELeave) CSisRegistryPackage(); |
|
58 CleanupStack::PushL(self); |
|
59 self->ConstructL(aStream); |
|
60 return self; |
|
61 } |
|
62 |
|
63 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewL(const CSisRegistryPackage& aPackage) |
|
64 { |
|
65 CSisRegistryPackage* self = CSisRegistryPackage::NewLC(aPackage); |
|
66 CleanupStack::Pop(self); |
|
67 return self; |
|
68 } |
|
69 |
|
70 EXPORT_C CSisRegistryPackage* CSisRegistryPackage::NewLC(const CSisRegistryPackage& aPackage) |
|
71 { |
|
72 CSisRegistryPackage* self = new(ELeave) CSisRegistryPackage(); |
|
73 CleanupStack::PushL(self); |
|
74 self->ConstructL(aPackage); |
|
75 return self; |
|
76 } |
|
77 |
|
78 CSisRegistryPackage::CSisRegistryPackage(TUid aUid) : iUid(aUid) |
|
79 { |
|
80 } |
|
81 |
|
82 CSisRegistryPackage::CSisRegistryPackage() |
|
83 { |
|
84 } |
|
85 |
|
86 EXPORT_C CSisRegistryPackage::~CSisRegistryPackage() |
|
87 { |
|
88 delete iPackageName; |
|
89 delete iVendorName; |
|
90 } |
|
91 |
|
92 void CSisRegistryPackage::ConstructL(const TDesC& aName, const TDesC& aVendor) |
|
93 { |
|
94 iPackageName = aName.AllocL(); |
|
95 iVendorName = aVendor.AllocL(); |
|
96 iIndex = UnInitializedIndex; |
|
97 } |
|
98 |
|
99 void CSisRegistryPackage::ConstructL(const CSisRegistryPackage& aPackage) |
|
100 { |
|
101 iPackageName = aPackage.Name().AllocL(); |
|
102 iVendorName = aPackage.Vendor().AllocL(); |
|
103 iUid = aPackage.iUid; |
|
104 iIndex = aPackage.iIndex; |
|
105 } |
|
106 |
|
107 void CSisRegistryPackage::ConstructL(RReadStream& aStream) |
|
108 { |
|
109 InternalizeL(aStream); |
|
110 } |
|
111 |
|
112 EXPORT_C void CSisRegistryPackage::InternalizeL(RReadStream& aStream) |
|
113 { |
|
114 iUid.iUid = aStream.ReadInt32L(); |
|
115 // there cannot be a sensible size limitation as names are strings |
|
116 iPackageName = HBufC::NewL(aStream, KMaxTInt); |
|
117 iVendorName = HBufC::NewL(aStream, KMaxTInt); |
|
118 iIndex = aStream.ReadInt32L(); |
|
119 } |
|
120 |
|
121 EXPORT_C void CSisRegistryPackage::ExternalizeL(RWriteStream& aStream) const |
|
122 { |
|
123 aStream.WriteInt32L(iUid.iUid); |
|
124 aStream << *iPackageName; |
|
125 aStream << *iVendorName; |
|
126 aStream.WriteInt32L(iIndex); |
|
127 } |
|
128 |
|
129 EXPORT_C TBool CSisRegistryPackage::operator==(const CSisRegistryPackage& aOther) const |
|
130 { |
|
131 if ((iUid.iUid == aOther.iUid.iUid) && |
|
132 (*iPackageName == *aOther.iPackageName) && |
|
133 (*iVendorName == *aOther.iVendorName)) |
|
134 { |
|
135 return ETrue; |
|
136 } |
|
137 return EFalse; |
|
138 } |
|
139 |
|
140 EXPORT_C void CSisRegistryPackage::SetNameL(const TDesC& aName) |
|
141 { |
|
142 delete iPackageName; |
|
143 iPackageName = aName.AllocL(); |
|
144 } |
|
145 |