1 /* |
|
2 * Copyright (c) 2006-2007 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32strm.h> |
|
20 |
|
21 #include "irbrowsechannelitems.h" |
|
22 #include "irdebug.h" |
|
23 |
|
24 // ======== LOCAL FUNCTIONS ======== |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 //CIRBrowseChannelItems::NewLC() |
|
30 //Static function |
|
31 //standard two phased constructor |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CIRBrowseChannelItems* CIRBrowseChannelItems::NewLC() |
|
35 { |
|
36 IRLOG_DEBUG( "CIRBrowseChannelItems::NewLC - Entering" ); |
|
37 CIRBrowseChannelItems* self = new (ELeave) CIRBrowseChannelItems; |
|
38 CleanupStack::PushL(self); |
|
39 self->ConstructL(); |
|
40 IRLOG_DEBUG( "CIRBrowseChannelItems::NewLC - Exiting." ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 //CIRBrowseChannelItems::NewL() |
|
47 //Static function |
|
48 //standard two phased constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C CIRBrowseChannelItems* CIRBrowseChannelItems::NewL() |
|
52 { |
|
53 IRLOG_DEBUG( "CIRBrowseChannelItems::NewL - Entering" ); |
|
54 CIRBrowseChannelItems* self = CIRBrowseChannelItems::NewLC(); |
|
55 CleanupStack::Pop(self); |
|
56 IRLOG_DEBUG( "CIRBrowseChannelItems::NewL - Exiting." ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 //CIRBrowseChannelItems::ConstructL() |
|
63 //standard two phased constructor |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CIRBrowseChannelItems::ConstructL() const |
|
67 { |
|
68 IRLOG_DEBUG( "CIRBrowseChannelItems::ConstructL" ); |
|
69 return; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 //CIRBrowseChannelItems::~CIRBrowseChannelItems() |
|
75 //standard C++ destructor |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 CIRBrowseChannelItems::~CIRBrowseChannelItems() |
|
79 { |
|
80 IRLOG_DEBUG( "CIRBrowseChannelItems::~CIRBrowseChannelItems - Entering" ); |
|
81 delete iChannelName; |
|
82 iChannelName=NULL; |
|
83 delete iChannelGetOperation; |
|
84 iChannelGetOperation=NULL; |
|
85 delete iShortDescription; |
|
86 iShortDescription=NULL; |
|
87 iImgUrl.Close(); |
|
88 |
|
89 delete iBannerUrl; |
|
90 iBannerUrl=NULL; |
|
91 delete iClickThroughUrl; |
|
92 iClickThroughUrl=NULL; |
|
93 |
|
94 IRLOG_DEBUG( "CIRBrowseChannelItems::~CIRBrowseChannelItems - Exiting." ); |
|
95 } |
|
96 |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 //CIRBrowseChannelItems::SetTextL() |
|
100 //Set data namely channelname,channelid,description |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C void CIRBrowseChannelItems::SetTextL(const TDesC& aChannelName, |
|
104 const TDesC& aChannelId,const TDesC& aDescription) |
|
105 { |
|
106 IRLOG_DEBUG( "CIRBrowseChannelItems::SetTextL - Entering" ); |
|
107 iChannelName = aChannelName.Alloc(); |
|
108 iShortDescription=aDescription.Alloc(); |
|
109 TLex var(aChannelId); |
|
110 var.Val(iChannelID); |
|
111 IRLOG_DEBUG( "CIRBrowseChannelItems::SetTextL - Exiting." ); |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 //CIRBrowseChannelItems::SetGetOperationL() |
|
117 //Set data get methord |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C void CIRBrowseChannelItems::SetGetOperationL( |
|
121 const TDesC& aChannelGetOperation) |
|
122 { |
|
123 IRLOG_DEBUG( "CIRBrowseChannelItems::SetGetOperationL - Entering" ); |
|
124 iChannelGetOperation = aChannelGetOperation.Alloc(); |
|
125 IRLOG_DEBUG( "CIRBrowseChannelItems::SetGetOperationL - Exiting." ); |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 //CIRBrowseChannelItems::SetSize() |
|
131 //Set data size of data |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CIRBrowseChannelItems::SetSize(const TDesC& aSize) |
|
135 { |
|
136 IRLOG_DEBUG( "CIRBrowseChannelItems::SetSize - Entering" ); |
|
137 TLex var(aSize); |
|
138 var.Val(iSize); |
|
139 IRLOG_DEBUG( "CIRBrowseChannelItems::SetSize - Exiting." ); |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 //CIRBrowseChannelItems::SetImageUrl() |
|
145 //Set the url for the iImgUrl |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C void CIRBrowseChannelItems::SetImageUrl(const TDesC& aImgUrl) |
|
149 { |
|
150 IRLOG_DEBUG( "CIRBrowseChannelItems::SetImageUrl - Entering" ); |
|
151 iImgUrl.Create(aImgUrl.Length()); |
|
152 iImgUrl.Copy(aImgUrl); |
|
153 IRLOG_DEBUG( "CIRBrowseChannelItems::SetImageUrl - Exiting." ); |
|
154 } |
|
155 |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 //CIRBrowseChannelItems::ExternalizeL() |
|
159 //Externalizes data into persistent storage |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C void CIRBrowseChannelItems::ExternalizeL(RWriteStream& aStream) const |
|
163 { |
|
164 IRLOG_DEBUG( "CIRBrowseChannelItems::ExternalizeL - Entering" ); |
|
165 if (iChannelName ) |
|
166 { |
|
167 aStream.WriteInt32L(iChannelName->Des().MaxLength()); |
|
168 aStream << *iChannelName; |
|
169 } |
|
170 else |
|
171 { |
|
172 aStream.WriteInt32L(0); |
|
173 } |
|
174 if((iShortDescription) && (iShortDescription->Des().MaxLength() != 0)) |
|
175 { |
|
176 TInt a = iShortDescription->Des().MaxLength(); |
|
177 aStream.WriteInt32L(iShortDescription->Des().MaxLength()); |
|
178 aStream << *iShortDescription; |
|
179 } |
|
180 else |
|
181 { |
|
182 aStream.WriteInt32L(0); |
|
183 } |
|
184 if(iChannelGetOperation) |
|
185 { |
|
186 aStream.WriteInt32L(iChannelGetOperation->Des().MaxLength()); |
|
187 aStream << *iChannelGetOperation; |
|
188 } |
|
189 else |
|
190 { |
|
191 aStream.WriteInt32L(0); |
|
192 } |
|
193 aStream.WriteInt32L(iBitrate1); |
|
194 aStream.WriteInt32L(iBitrate2); |
|
195 aStream.WriteInt32L(iBitrate3); |
|
196 aStream.WriteUint32L(iChannelID); |
|
197 if(iBannerUrl) |
|
198 { |
|
199 aStream.WriteInt32L(iBannerUrl->Des().MaxLength()); |
|
200 aStream <<*iBannerUrl; |
|
201 } |
|
202 else |
|
203 { |
|
204 aStream.WriteInt32L(0); |
|
205 } |
|
206 |
|
207 if(iClickThroughUrl) |
|
208 { |
|
209 aStream.WriteInt32L(iClickThroughUrl->Des().MaxLength()); |
|
210 aStream <<*iClickThroughUrl; |
|
211 } |
|
212 else |
|
213 { |
|
214 aStream.WriteInt32L(0); |
|
215 } |
|
216 |
|
217 if(iImgUrl.Length() != 0) |
|
218 { |
|
219 aStream.WriteInt32L(iImgUrl.MaxLength()); |
|
220 aStream <<iImgUrl; |
|
221 } |
|
222 else |
|
223 { |
|
224 aStream.WriteInt32L(0); |
|
225 } |
|
226 |
|
227 IRLOG_DEBUG( "CIRBrowseChannelItems::ExternalizeL - Exiting." ); |
|
228 } |
|
229 |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 //CIRBrowseChannelItems::InternalizeL() |
|
233 //internalizes data from persistent storage |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 EXPORT_C void CIRBrowseChannelItems::InternalizeL(RReadStream& aStream) |
|
237 { |
|
238 IRLOG_DEBUG( "CIRBrowseChannelItems::InternalizeL - Entering" ); |
|
239 TInt maxlen; |
|
240 maxlen = aStream.ReadInt32L(); |
|
241 if(maxlen!=0) |
|
242 { |
|
243 iChannelName = HBufC::NewL(aStream,maxlen); |
|
244 } |
|
245 maxlen = aStream.ReadInt32L(); |
|
246 if(maxlen!=0) |
|
247 { |
|
248 iShortDescription = HBufC::NewL(aStream,maxlen); |
|
249 } |
|
250 maxlen = aStream.ReadInt32L(); |
|
251 if(maxlen!=0) |
|
252 { |
|
253 iChannelGetOperation = HBufC::NewL(aStream,maxlen); |
|
254 } |
|
255 iBitrate1 = aStream.ReadInt32L(); |
|
256 iBitrate2 = aStream.ReadInt32L(); |
|
257 iBitrate3 = aStream.ReadInt32L(); |
|
258 iChannelID = aStream.ReadUint32L(); |
|
259 |
|
260 |
|
261 |
|
262 maxlen = aStream.ReadInt32L(); |
|
263 if(maxlen!=0) |
|
264 { |
|
265 iBannerUrl = HBufC::NewL(aStream, maxlen); |
|
266 } |
|
267 maxlen = aStream.ReadInt32L(); |
|
268 if(maxlen!=0) |
|
269 { |
|
270 iClickThroughUrl = HBufC::NewL(aStream, maxlen); |
|
271 } |
|
272 maxlen = aStream.ReadInt32L(); |
|
273 if(maxlen!=0) |
|
274 { |
|
275 iImgUrl.Close(); |
|
276 iImgUrl.CreateL(aStream, maxlen); |
|
277 } |
|
278 |
|
279 |
|
280 IRLOG_DEBUG( "CIRBrowseChannelItems::InternalizeL - Exiting." ); |
|
281 } |
|
282 |
|
283 |
|
284 |
|
285 // --------------------------------------------------------------------------- |
|
286 //CIRBrowseChannelItems::SetBitrate() |
|
287 //Set data for 3bitrates |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 EXPORT_C void CIRBrowseChannelItems::SetBitrate(const TDesC &aBitrate1, |
|
291 const TDesC &aBitrate2,const TDesC &aBitrate3) |
|
292 { |
|
293 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate3 - Entering" ); |
|
294 TLex var1(aBitrate1); |
|
295 var1.Val(iBitrate1); |
|
296 TLex var2(aBitrate2); |
|
297 var2.Val(iBitrate2); |
|
298 TLex var3(aBitrate3); |
|
299 var3.Val(iBitrate3); |
|
300 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate3 - Exiting." ); |
|
301 } |
|
302 |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 //CIRBrowseChannelItems::SetBitrate() |
|
306 //Set data for 2 bitrates |
|
307 // --------------------------------------------------------------------------- |
|
308 // |
|
309 EXPORT_C void CIRBrowseChannelItems::SetBitrate(const TDesC &aBitrate1, |
|
310 const TDesC &aBitrate2) |
|
311 { |
|
312 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate2 - Entering" ); |
|
313 TLex var1(aBitrate1); |
|
314 var1.Val(iBitrate1); |
|
315 TLex var2(aBitrate2); |
|
316 var2.Val(iBitrate2); |
|
317 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate2 - Exiting." ); |
|
318 } |
|
319 |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 //CIRBrowseChannelItems::SetBitrate() |
|
323 //Set data for 1 bitrate |
|
324 // --------------------------------------------------------------------------- |
|
325 // |
|
326 EXPORT_C void CIRBrowseChannelItems::SetBitrate(const TDesC &aBitrate1) |
|
327 { |
|
328 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate1 - Entering" ); |
|
329 TLex var1(aBitrate1); |
|
330 var1.Val(iBitrate1); |
|
331 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBitrate1 - Exiting." ); |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 //CIRBrowseChannelItems::SetBannerUrl() |
|
336 //Set data namely BannerUrl |
|
337 // --------------------------------------------------------------------------- |
|
338 // |
|
339 EXPORT_C void CIRBrowseChannelItems::SetBannerUrl(const TDesC& aBannerUrl) |
|
340 { |
|
341 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBannerUrl - Entering" ); |
|
342 iBannerUrl = aBannerUrl.Alloc(); |
|
343 IRLOG_DEBUG( "CIRBrowseChannelItems::SetBannerUrl - Exiting." ); |
|
344 } |
|
345 |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 //CIRBrowseChannelItems::SetBannerUrl() |
|
349 //Set data namely BannerUrl |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 EXPORT_C void CIRBrowseChannelItems::SetClickThroughUrl(const TDesC& aClickThroughUrl) |
|
353 { |
|
354 IRLOG_DEBUG( "CIRBrowseChannelItems::SetClickThroughUrl - Entering" ); |
|
355 iClickThroughUrl = aClickThroughUrl.Alloc(); |
|
356 IRLOG_DEBUG( "CIRBrowseChannelItems::SetClickThroughUrl - Exiting." ); |
|
357 } |
|