|
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: CNcdPreminetProtocolDataEntityContentImpl implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include "ncd_pp_dataentitycontentimpl.h" |
|
21 #include "ncd_pp_entitydependency.h" |
|
22 #include "ncdprotocoltypes.h" |
|
23 #include "ncdprotocolutils.h" |
|
24 |
|
25 CNcdPreminetProtocolDataEntityContentImpl* |
|
26 CNcdPreminetProtocolDataEntityContentImpl::NewL() |
|
27 { |
|
28 CNcdPreminetProtocolDataEntityContentImpl* self = |
|
29 new (ELeave) CNcdPreminetProtocolDataEntityContentImpl; |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CNcdPreminetProtocolDataEntityContentImpl* |
|
37 CNcdPreminetProtocolDataEntityContentImpl::NewLC() |
|
38 { |
|
39 CNcdPreminetProtocolDataEntityContentImpl* self = |
|
40 new (ELeave) CNcdPreminetProtocolDataEntityContentImpl; |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 CNcdPreminetProtocolDataEntityContentImpl::~CNcdPreminetProtocolDataEntityContentImpl() |
|
47 { |
|
48 iContentPurposes.ResetAndDestroy(); |
|
49 |
|
50 iEntityDependencies.ResetAndDestroy(); |
|
51 |
|
52 delete iTimestamp; |
|
53 iTimestamp = 0; |
|
54 |
|
55 delete iMime; |
|
56 iMime = 0; |
|
57 |
|
58 delete iId; |
|
59 iId = 0; |
|
60 |
|
61 delete iVersion; |
|
62 iVersion = 0; |
|
63 } |
|
64 |
|
65 CNcdPreminetProtocolDataEntityContentImpl::CNcdPreminetProtocolDataEntityContentImpl() |
|
66 : CBase(), |
|
67 iSubscriptionType(ENotSubscribable), |
|
68 iChildViewable(EFalse), |
|
69 iChildSeparatelyPurchasable(EFalse) |
|
70 { |
|
71 } |
|
72 |
|
73 void CNcdPreminetProtocolDataEntityContentImpl::ConstructL() |
|
74 { |
|
75 NcdProtocolUtils::AssignEmptyDesL( iTimestamp ); |
|
76 NcdProtocolUtils::AssignEmptyDesL( iId ); |
|
77 NcdProtocolUtils::AssignEmptyDesL( iMime ); |
|
78 NcdProtocolUtils::AssignEmptyDesL( iVersion ); |
|
79 } |
|
80 |
|
81 /** |
|
82 * @see MNcdPreminetProtocolDataEntityContent |
|
83 */ |
|
84 const TDesC& CNcdPreminetProtocolDataEntityContentImpl::Timestamp() const |
|
85 { |
|
86 DASSERT((iTimestamp)); |
|
87 return *iTimestamp; |
|
88 } |
|
89 |
|
90 /** |
|
91 * @see MNcdPreminetProtocolDataEntityContent |
|
92 */ |
|
93 TInt CNcdPreminetProtocolDataEntityContentImpl::Size() const |
|
94 { |
|
95 return iSize; |
|
96 } |
|
97 |
|
98 /** |
|
99 * @see MNcdPreminetProtocolDataEntityContent |
|
100 */ |
|
101 const TDesC& CNcdPreminetProtocolDataEntityContentImpl::Mime() const |
|
102 { |
|
103 DASSERT((iMime)); |
|
104 return *iMime; |
|
105 } |
|
106 |
|
107 /** |
|
108 * @see MNcdPreminetProtocolDataEntityContent |
|
109 */ |
|
110 const TDesC& CNcdPreminetProtocolDataEntityContentImpl::Id() const |
|
111 { |
|
112 DASSERT((iId)); |
|
113 return *iId; |
|
114 } |
|
115 |
|
116 /** |
|
117 * @see MNcdPreminetProtocolDataEntityContent |
|
118 */ |
|
119 const TDesC& CNcdPreminetProtocolDataEntityContentImpl::Version() const |
|
120 { |
|
121 DASSERT((iVersion)); |
|
122 return *iVersion; |
|
123 } |
|
124 |
|
125 /** |
|
126 * @see MNcdPreminetProtocolDataEntityContent |
|
127 */ |
|
128 TInt CNcdPreminetProtocolDataEntityContentImpl::ValidUntilDelta() const |
|
129 { |
|
130 return iValidUntilDelta; |
|
131 } |
|
132 |
|
133 /** |
|
134 * @see MNcdPreminetProtocolDataEntityContent |
|
135 */ |
|
136 TBool CNcdPreminetProtocolDataEntityContentImpl::ValidUntilAutoUpdate() const |
|
137 { |
|
138 return iValidUntilAutoUpdate; |
|
139 } |
|
140 |
|
141 /** |
|
142 * @see MNcdPreminetProtocolDataEntityContent |
|
143 */ |
|
144 TInt CNcdPreminetProtocolDataEntityContentImpl::ContentPurposeCount() const |
|
145 { |
|
146 return iContentPurposes.Count(); |
|
147 } |
|
148 |
|
149 /** |
|
150 * @see MNcdPreminetProtocolDataEntityContent |
|
151 */ |
|
152 const TDesC& |
|
153 CNcdPreminetProtocolDataEntityContentImpl::ContentPurposeL(TInt aIndex) const |
|
154 { |
|
155 DASSERT( aIndex >= 0 && aIndex < iContentPurposes.Count() ); |
|
156 if ( aIndex < 0 || aIndex >= iContentPurposes.Count() ) |
|
157 { |
|
158 User::Leave(KErrArgument); |
|
159 } |
|
160 return *iContentPurposes[aIndex]; |
|
161 } |
|
162 |
|
163 /** |
|
164 * @see MNcdPreminetProtocolDataEntityContent |
|
165 */ |
|
166 TInt CNcdPreminetProtocolDataEntityContentImpl::EntityDependencyCount() const |
|
167 { |
|
168 return iEntityDependencies.Count(); |
|
169 } |
|
170 |
|
171 /** |
|
172 * @see MNcdPreminetProtocolDataEntityContent |
|
173 */ |
|
174 const MNcdPreminetProtocolEntityDependency& |
|
175 CNcdPreminetProtocolDataEntityContentImpl::EntityDependencyL(TInt aIndex) const |
|
176 { |
|
177 DASSERT( aIndex >= 0 && aIndex < iEntityDependencies.Count() ); |
|
178 if ( aIndex < 0 || aIndex >= iEntityDependencies.Count() ) |
|
179 { |
|
180 User::Leave(KErrArgument); |
|
181 } |
|
182 return *iEntityDependencies[aIndex]; |
|
183 } |
|
184 |
|
185 /** |
|
186 * @see MNcdPreminetProtocolDataEntityContent |
|
187 */ |
|
188 TNcdSubscriptionType |
|
189 CNcdPreminetProtocolDataEntityContentImpl::SubscriptionType() const |
|
190 { |
|
191 return iSubscriptionType; |
|
192 } |
|
193 |
|
194 /** |
|
195 * @see MNcdPreminetProtocolDataEntityContent |
|
196 */ |
|
197 TBool CNcdPreminetProtocolDataEntityContentImpl::ChildViewable() const |
|
198 { |
|
199 return iChildViewable; |
|
200 } |
|
201 |
|
202 /** |
|
203 * @see MNcdPreminetProtocolDataEntityContent |
|
204 */ |
|
205 TBool CNcdPreminetProtocolDataEntityContentImpl::ChildSeparatelyPurchasable() const |
|
206 { |
|
207 return iChildSeparatelyPurchasable; |
|
208 } |
|
209 |