|
1 /* |
|
2 * Copyright (c) 2006 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: Class CCatalogsAccessPointMap implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "catalogsaccesspointmap.h" |
|
20 #include "catalogsutils.h" |
|
21 |
|
22 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewL(RReadStream& aStream) |
|
23 { |
|
24 CCatalogsAccessPointMap* self = NewLC(aStream); |
|
25 CleanupStack::Pop(); |
|
26 return self; |
|
27 } |
|
28 |
|
29 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewL( |
|
30 const TDesC& aNameSpace, |
|
31 const CCatalogsAccessPointManager::TAction& aAction, |
|
32 const TDesC& aAccessPointId) |
|
33 { |
|
34 CCatalogsAccessPointMap* self = NewLC(aNameSpace, aAction, aAccessPointId); |
|
35 CleanupStack::Pop(); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewL( |
|
40 const TDesC& aNameSpace, |
|
41 const TDesC& aCatalogId, |
|
42 const CCatalogsAccessPointManager::TAction& aAction, |
|
43 const TDesC& aAccessPointId) |
|
44 { |
|
45 CCatalogsAccessPointMap* self = NewLC( |
|
46 aNameSpace, aCatalogId, aAction, aAccessPointId); |
|
47 CleanupStack::Pop(); |
|
48 return self; |
|
49 } |
|
50 |
|
51 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewLC(RReadStream& aStream) |
|
52 { |
|
53 CCatalogsAccessPointMap* self = new (ELeave) CCatalogsAccessPointMap; |
|
54 CleanupStack::PushL(self); |
|
55 self->InternalizeL(aStream); |
|
56 return self; |
|
57 } |
|
58 |
|
59 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewLC( |
|
60 const TDesC& aNameSpace, |
|
61 const CCatalogsAccessPointManager::TAction& aAction, |
|
62 const TDesC& aAccessPointId) |
|
63 { |
|
64 CCatalogsAccessPointMap* self = new (ELeave) CCatalogsAccessPointMap; |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(aNameSpace, aAction, aAccessPointId); |
|
67 return self; |
|
68 } |
|
69 |
|
70 CCatalogsAccessPointMap* CCatalogsAccessPointMap::NewLC( |
|
71 const TDesC& aNameSpace, |
|
72 const TDesC& aCatalogId, |
|
73 const CCatalogsAccessPointManager::TAction& aAction, |
|
74 const TDesC& aAccessPointId) |
|
75 { |
|
76 CCatalogsAccessPointMap* self = new (ELeave) CCatalogsAccessPointMap; |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(aNameSpace, aCatalogId, aAction, aAccessPointId); |
|
79 return self; |
|
80 } |
|
81 |
|
82 CCatalogsAccessPointMap::~CCatalogsAccessPointMap() |
|
83 { |
|
84 delete iNameSpace; |
|
85 delete iCatalogId; |
|
86 delete iAccessPointId; |
|
87 } |
|
88 |
|
89 const TDesC& CCatalogsAccessPointMap::NameSpace() const |
|
90 { |
|
91 return *iNameSpace; |
|
92 } |
|
93 |
|
94 TBool CCatalogsAccessPointMap::HasCatalogId() const |
|
95 { |
|
96 return iHasCatalogId; |
|
97 } |
|
98 |
|
99 const TDesC& CCatalogsAccessPointMap::CatalogId() const |
|
100 { |
|
101 if (iCatalogId != NULL) |
|
102 { |
|
103 return *iCatalogId; |
|
104 } |
|
105 else |
|
106 { |
|
107 return KNullDesC; |
|
108 } |
|
109 } |
|
110 |
|
111 CCatalogsAccessPointManager::TAction CCatalogsAccessPointMap::Action() const |
|
112 { |
|
113 return iAction; |
|
114 } |
|
115 |
|
116 |
|
117 const TDesC& CCatalogsAccessPointMap::AccessPointId() const |
|
118 { |
|
119 return *iAccessPointId; |
|
120 } |
|
121 |
|
122 void CCatalogsAccessPointMap::ExternalizeL(RWriteStream& aStream) |
|
123 { |
|
124 ExternalizeDesL(*iNameSpace, aStream); |
|
125 ExternalizeDesL(*iAccessPointId, aStream); |
|
126 aStream.WriteInt8L(iHasCatalogId); |
|
127 if (iHasCatalogId) |
|
128 { |
|
129 DASSERT(iCatalogId != NULL); |
|
130 ExternalizeDesL(*iCatalogId, aStream); |
|
131 } |
|
132 aStream.WriteInt32L(iAction); |
|
133 } |
|
134 |
|
135 void CCatalogsAccessPointMap::InternalizeL(RReadStream& aStream) |
|
136 { |
|
137 InternalizeDesL(iNameSpace, aStream); |
|
138 InternalizeDesL(iAccessPointId, aStream); |
|
139 iHasCatalogId = aStream.ReadInt8L(); |
|
140 if (iHasCatalogId) |
|
141 { |
|
142 InternalizeDesL(iCatalogId, aStream); |
|
143 } |
|
144 iAction = (CCatalogsAccessPointManager::TAction)aStream.ReadInt32L(); |
|
145 } |
|
146 |
|
147 CCatalogsAccessPointMap::CCatalogsAccessPointMap() |
|
148 { |
|
149 } |
|
150 |
|
151 void CCatalogsAccessPointMap::ConstructL( |
|
152 const TDesC& aNameSpace, |
|
153 const CCatalogsAccessPointManager::TAction& aAction, |
|
154 const TDesC& aAccessPointId) |
|
155 { |
|
156 iNameSpace = aNameSpace.AllocL(); |
|
157 iAction = aAction; |
|
158 iAccessPointId = aAccessPointId.AllocL(); |
|
159 iHasCatalogId = EFalse; |
|
160 } |
|
161 |
|
162 void CCatalogsAccessPointMap::ConstructL( |
|
163 const TDesC& aNameSpace, |
|
164 const TDesC& aCatalogId, |
|
165 const CCatalogsAccessPointManager::TAction& aAction, |
|
166 const TDesC& aAccessPointId) |
|
167 { |
|
168 ConstructL(aNameSpace, aAction, aAccessPointId); |
|
169 iCatalogId = aCatalogId.AllocL(); |
|
170 iHasCatalogId = ETrue; |
|
171 } |