1 /* |
|
2 * Copyright (c) 2005-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 "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 * |
|
16 */ |
|
17 |
|
18 #include "DataWrapperBase.h" |
|
19 |
|
20 /*@{*/ |
|
21 /// Constant Literals used. |
|
22 _LIT(KIncludeSection, "include"); |
|
23 _LIT(KFile, "file%d"); |
|
24 _LIT(KMatch, "*{*,*}*"); |
|
25 _LIT(KStart, "{"); |
|
26 _LIT(KSeparator, ","); |
|
27 _LIT(KEnd, "}"); |
|
28 _LIT(KDataRead, "INI READ : %S %S %S"); |
|
29 |
|
30 _LIT(KFormatEntryField, "%S_%S"); |
|
31 |
|
32 _LIT(KTagFontSpecName, "name"); |
|
33 _LIT(KTagFontSpecHeight, "height"); |
|
34 |
|
35 _LIT(KTagPointX, "x"); |
|
36 _LIT(KTagPointY, "y"); |
|
37 |
|
38 _LIT(KTagRectTop, "top"); |
|
39 _LIT(KTagRectLeft, "left"); |
|
40 _LIT(KTagRectBottom, "bottom"); |
|
41 _LIT(KTagRectRight, "right"); |
|
42 |
|
43 _LIT(KTagRgbRed, "red"); |
|
44 _LIT(KTagRgbGreen, "green"); |
|
45 _LIT(KTagRgbBlue, "blue"); |
|
46 _LIT(KTagRgbAlpha, "alpha"); |
|
47 |
|
48 _LIT(KTagSizeWidth, "width"); |
|
49 _LIT(KTagSizeHeight, "height"); |
|
50 |
|
51 _LIT(KTagWsGraphicIdUid, "uid"); |
|
52 _LIT(KTagWsGraphicIdId, "id"); |
|
53 _LIT(KTagWsGraphicIdName, "name"); |
|
54 |
|
55 _LIT(KFormatFieldNumber, "%S%d"); |
|
56 |
|
57 /// Logging |
|
58 _LIT(KLogMissingParameter, "Missing parameter '%S'"); |
|
59 _LIT(KLogRegion, "Region '%S'"); |
|
60 _LIT(KLogEmpty, "Empty"); |
|
61 _LIT(KLogRegionsRect, "Rect[%d] tl=(%d,%d) br=(%d,%d)"); |
|
62 _LIT(KLogRect, "%S tl=(%d,%d) br=(%d,%d)"); |
|
63 /*@}*/ |
|
64 |
|
65 CDataWrapperBase::CDataWrapperBase() |
|
66 : CDataWrapper() |
|
67 , iHandle(0) |
|
68 , iId(TWsGraphicId::EUninitialized) |
|
69 { |
|
70 } |
|
71 |
|
72 CDataWrapperBase::~CDataWrapperBase() |
|
73 /** |
|
74 * Public destructor |
|
75 */ |
|
76 { |
|
77 iInclude.ResetAndDestroy(); |
|
78 iBuffer.ResetAndDestroy(); |
|
79 iFs.Close(); |
|
80 } |
|
81 |
|
82 void CDataWrapperBase::InitialiseL() |
|
83 { |
|
84 CDataWrapper::InitialiseL(); |
|
85 |
|
86 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
87 TPtrC fileName; |
|
88 TBool moreData=ETrue; |
|
89 TBool index=0; |
|
90 while ( moreData ) |
|
91 { |
|
92 tempStore.Format(KFile(), ++index); |
|
93 moreData=GetStringFromConfig(KIncludeSection, tempStore, fileName); |
|
94 |
|
95 if (moreData) |
|
96 { |
|
97 CIniData* iniData=CIniData::NewL(fileName); |
|
98 CleanupStack::PushL(iniData); |
|
99 iInclude.Append(iniData); |
|
100 CleanupStack::Pop(iniData); |
|
101 } |
|
102 } |
|
103 User::LeaveIfError(iFs.Connect()); |
|
104 } |
|
105 |
|
106 TBool CDataWrapperBase::GetBoolFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TBool& aResult) |
|
107 { |
|
108 TBool ret=EFalse; |
|
109 TPtrC result; |
|
110 TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); |
|
111 if ( err != KErrNone ) |
|
112 { |
|
113 ret=EFalse; |
|
114 } |
|
115 if ( ret ) |
|
116 { |
|
117 _LIT(KTrue,"true"); |
|
118 aResult=(result.FindF(KTrue) != KErrNotFound); |
|
119 } |
|
120 |
|
121 return ret; |
|
122 } |
|
123 |
|
124 TBool CDataWrapperBase::GetFontSpecFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TFontSpec& aResult) |
|
125 { |
|
126 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
127 |
|
128 |
|
129 TPtrC name; |
|
130 tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecName); |
|
131 TBool ret=GetStringFromConfig(aSectName, tempStore, name); |
|
132 |
|
133 TInt height; |
|
134 tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecHeight); |
|
135 if ( !GetIntFromConfig(aSectName, tempStore, height) ) |
|
136 { |
|
137 ret=EFalse; |
|
138 } |
|
139 |
|
140 if ( ret ) |
|
141 { |
|
142 aResult=TFontSpec(name, height); |
|
143 } |
|
144 |
|
145 return ret; |
|
146 } |
|
147 |
|
148 TBool CDataWrapperBase::GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) |
|
149 { |
|
150 TPtrC result; |
|
151 TBool ret=EFalse; |
|
152 TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); |
|
153 if ( err != KErrNone ) |
|
154 { |
|
155 ret=EFalse; |
|
156 } |
|
157 if ( ret ) |
|
158 { |
|
159 TLex lex(result); |
|
160 ret=(lex.Val(aResult)==KErrNone); |
|
161 } |
|
162 |
|
163 return ret; |
|
164 } |
|
165 |
|
166 TBool CDataWrapperBase::GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) |
|
167 { |
|
168 TBool ret=EFalse; |
|
169 TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, aResult)); |
|
170 if ( err != KErrNone ) |
|
171 { |
|
172 ret=EFalse; |
|
173 } |
|
174 return ret; |
|
175 } |
|
176 |
|
177 TBool CDataWrapperBase::GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult) |
|
178 { |
|
179 TPtrC result; |
|
180 TBool ret=EFalse; |
|
181 TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, result)); |
|
182 if ( err != KErrNone ) |
|
183 { |
|
184 ret=EFalse; |
|
185 } |
|
186 if ( ret ) |
|
187 { |
|
188 TLex lex(result); |
|
189 ret=(lex.Val((TUint &)aResult, EHex)==KErrNone); |
|
190 } |
|
191 |
|
192 return ret; |
|
193 } |
|
194 |
|
195 TBool CDataWrapperBase::GetPointFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPoint& aResult) |
|
196 { |
|
197 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
198 |
|
199 TInt x; |
|
200 tempStore.Format(KFormatEntryField, &aKeyName, &KTagPointX); |
|
201 TBool ret=GetIntFromConfig(aSectName, tempStore, x); |
|
202 |
|
203 TInt y; |
|
204 tempStore.Format(KFormatEntryField, &aKeyName, &KTagPointY); |
|
205 if ( !GetIntFromConfig(aSectName, tempStore, y) ) |
|
206 { |
|
207 ret=EFalse; |
|
208 } |
|
209 |
|
210 if ( ret ) |
|
211 { |
|
212 aResult.SetXY(x, y); |
|
213 } |
|
214 |
|
215 return ret; |
|
216 } |
|
217 |
|
218 TBool CDataWrapperBase::GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult) |
|
219 { |
|
220 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
221 |
|
222 TInt top; |
|
223 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectTop); |
|
224 TBool ret=GetIntFromConfig(aSectName, tempStore, top); |
|
225 |
|
226 TInt left; |
|
227 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectLeft); |
|
228 if ( !GetIntFromConfig(aSectName, tempStore, left) ) |
|
229 { |
|
230 ret=EFalse; |
|
231 } |
|
232 |
|
233 TInt bottom; |
|
234 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectBottom); |
|
235 if ( !GetIntFromConfig(aSectName, tempStore, bottom) ) |
|
236 { |
|
237 ret=EFalse; |
|
238 } |
|
239 |
|
240 TInt right; |
|
241 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectRight); |
|
242 if ( !GetIntFromConfig(aSectName, tempStore, right) ) |
|
243 { |
|
244 ret=EFalse; |
|
245 } |
|
246 |
|
247 if ( ret ) |
|
248 { |
|
249 aResult.SetRect(left, top, right, bottom); |
|
250 } |
|
251 |
|
252 return ret; |
|
253 } |
|
254 |
|
255 TBool CDataWrapperBase::GetRegionFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRegion& aResult) |
|
256 { |
|
257 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
258 TRect rect; |
|
259 |
|
260 aResult.Clear(); |
|
261 TBool moreData=ETrue; |
|
262 for ( TInt index=0; moreData; ) |
|
263 { |
|
264 tempStore.Format(KFormatFieldNumber, &aKeyName, ++index); |
|
265 moreData=GetRectFromConfig(aSectName, tempStore, rect); |
|
266 if ( moreData ) |
|
267 { |
|
268 aResult.AddRect(rect); |
|
269 } |
|
270 } |
|
271 |
|
272 return aResult.Count()>0; |
|
273 } |
|
274 |
|
275 TBool CDataWrapperBase::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRgb& aResult) |
|
276 { |
|
277 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
278 |
|
279 TInt red; |
|
280 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed); |
|
281 TBool ret=GetIntFromConfig(aSectName, tempStore, red); |
|
282 |
|
283 TInt green; |
|
284 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen); |
|
285 if ( !GetIntFromConfig(aSectName, tempStore, green) ) |
|
286 { |
|
287 ret=EFalse; |
|
288 } |
|
289 |
|
290 TInt blue; |
|
291 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue); |
|
292 if ( !GetIntFromConfig(aSectName, tempStore, blue) ) |
|
293 { |
|
294 ret=EFalse; |
|
295 } |
|
296 |
|
297 if ( ret ) |
|
298 { |
|
299 aResult.SetRed(red); |
|
300 aResult.SetGreen(green); |
|
301 aResult.SetBlue(blue); |
|
302 |
|
303 TInt alpha; |
|
304 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha); |
|
305 if ( GetIntFromConfig(aSectName, tempStore, alpha) ) |
|
306 { |
|
307 aResult.SetAlpha(alpha); |
|
308 } |
|
309 } |
|
310 |
|
311 return ret; |
|
312 } |
|
313 |
|
314 TBool CDataWrapperBase::GetSizeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TSize& aResult) |
|
315 { |
|
316 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
317 |
|
318 TInt width; |
|
319 tempStore.Format(KFormatEntryField, &aKeyName, &KTagSizeWidth); |
|
320 TBool ret=GetIntFromConfig(aSectName, tempStore, width); |
|
321 |
|
322 TInt height; |
|
323 tempStore.Format(KFormatEntryField, &aKeyName, &KTagSizeHeight); |
|
324 if ( !GetIntFromConfig(aSectName, tempStore, height) ) |
|
325 { |
|
326 ret=EFalse; |
|
327 } |
|
328 |
|
329 if ( ret ) |
|
330 { |
|
331 aResult.SetSize(width, height); |
|
332 } |
|
333 |
|
334 return ret; |
|
335 } |
|
336 |
|
337 TBool CDataWrapperBase::GetRgbListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TRgb*& aResult) |
|
338 { |
|
339 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
340 |
|
341 TBool ok=ETrue; |
|
342 for ( TInt index=0; (index<aSize) && (ok); ) |
|
343 { |
|
344 tempStore.Format(KFormatFieldNumber, &aKeyName, ++index); |
|
345 ok=GetRgbFromConfig(aSectName, tempStore, aResult[index-1]); |
|
346 if ( !ok ) |
|
347 { |
|
348 ERR_PRINTF2(KLogMissingParameter, &tempStore); |
|
349 SetBlockResult(EFail); |
|
350 } |
|
351 } |
|
352 |
|
353 return ok; |
|
354 } |
|
355 |
|
356 TBool CDataWrapperBase::GetPointListFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt aSize, TPoint*& aResult) |
|
357 { |
|
358 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
359 |
|
360 TBool ok=ETrue; |
|
361 for ( TInt index=0; (index<aSize) && (ok); ) |
|
362 { |
|
363 tempStore.Format(KFormatFieldNumber, &aKeyName, ++index); |
|
364 ok=GetPointFromConfig(aSectName, tempStore, aResult[index-1]); |
|
365 if ( !ok ) |
|
366 { |
|
367 ERR_PRINTF2(KLogMissingParameter, &tempStore); |
|
368 SetBlockResult(EFail); |
|
369 } |
|
370 } |
|
371 |
|
372 return ok; |
|
373 } |
|
374 |
|
375 TBool CDataWrapperBase::GetPointListFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TPoint>& aResult) |
|
376 { |
|
377 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
378 TPoint point; |
|
379 |
|
380 aResult.Reset(); |
|
381 TBool ok=ETrue; |
|
382 for ( TInt index=0; ok; ) |
|
383 { |
|
384 tempStore.Format(KFormatFieldNumber, &aKeyName, ++index); |
|
385 ok=GetPointFromConfig(aSectName, tempStore, point); |
|
386 if ( ok ) |
|
387 { |
|
388 aResult.AppendL(point); |
|
389 } |
|
390 } |
|
391 |
|
392 return aResult.Count()>0; |
|
393 } |
|
394 |
|
395 TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult) |
|
396 { |
|
397 TBool ret=EFalse; |
|
398 |
|
399 if ( aSectName.Length()!=0 ) |
|
400 { |
|
401 ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult); |
|
402 |
|
403 for ( TInt index=iInclude.Count(); (index>0) && (!ret); ) |
|
404 { |
|
405 ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult); |
|
406 } |
|
407 } |
|
408 |
|
409 if ( ret ) |
|
410 { |
|
411 if ( aResult.Match(KMatch)!=KErrNotFound ) |
|
412 { |
|
413 // We have an entry of the format |
|
414 // entry =*{section,entry}* |
|
415 // where * is one or more characters |
|
416 // We need to construct this from other data in the ini file replacing {*,*} |
|
417 // with the data from |
|
418 // [section] |
|
419 // entry =some_value |
|
420 HBufC* buffer=HBufC::NewLC(aResult.Length()); |
|
421 buffer->Des().Copy(aResult); |
|
422 |
|
423 TInt startLength=KStart().Length(); |
|
424 TInt sparatorLength=KSeparator().Length(); |
|
425 TInt endLength=KEnd().Length(); |
|
426 TInt bufferLength; |
|
427 TInt start; |
|
428 TInt sparator; |
|
429 TInt end; |
|
430 TPtrC remaining; |
|
431 TLex lex; |
|
432 do |
|
433 { |
|
434 bufferLength=buffer->Length(); |
|
435 start=buffer->Find(KStart); |
|
436 |
|
437 remaining.Set(buffer->Des().Right(bufferLength-start-startLength)); |
|
438 sparator=remaining.Find(KSeparator); |
|
439 remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength)); |
|
440 sparator += (start + startLength); |
|
441 |
|
442 end=remaining.Find(KEnd) + sparator + sparatorLength; |
|
443 |
|
444 TPtrC sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength); |
|
445 TPtrC keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength); |
|
446 sectionName.Set(TLex(sectionName).NextToken()); |
|
447 keyName.Set(TLex(keyName).NextToken()); |
|
448 |
|
449 TInt entrySize=0; |
|
450 TPtrC entryData; |
|
451 TBool found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData); |
|
452 for ( TInt index=iInclude.Count(); (index>0) && (!found); ) |
|
453 { |
|
454 found=iInclude[--index]->FindVar(sectionName, keyName, entryData); |
|
455 } |
|
456 if ( found ) |
|
457 { |
|
458 entrySize=entryData.Length(); |
|
459 } |
|
460 |
|
461 TInt newLength=start + bufferLength - end - endLength + entrySize; |
|
462 HBufC* bufferNew=HBufC::NewLC(newLength); |
|
463 bufferNew->Des().Copy(buffer->Ptr(), start); |
|
464 if ( entrySize>0 ) |
|
465 { |
|
466 bufferNew->Des().Append(entryData); |
|
467 } |
|
468 bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength); |
|
469 CleanupStack::Pop(bufferNew); |
|
470 CleanupStack::PopAndDestroy(buffer); |
|
471 buffer=bufferNew; |
|
472 CleanupStack::PushL(buffer); |
|
473 } |
|
474 while ( buffer->Match(KMatch)!=KErrNotFound ); |
|
475 iBuffer.Append(buffer); |
|
476 CleanupStack::Pop(buffer); |
|
477 aResult.Set(*buffer); |
|
478 INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult); |
|
479 } |
|
480 } |
|
481 |
|
482 return ret; |
|
483 } |
|
484 |
|
485 TBool CDataWrapperBase::GetWsGraphicIdFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicId& aResult) |
|
486 { |
|
487 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
488 |
|
489 TInt id; |
|
490 tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdUid); |
|
491 TBool ret=GetIntFromConfig(aSectName, tempStore, id); |
|
492 |
|
493 if ( ret ) |
|
494 { |
|
495 TUid uid=TUid::Uid(id); |
|
496 aResult.Set(uid); |
|
497 } |
|
498 else |
|
499 { |
|
500 tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdId); |
|
501 ret=GetIntFromConfig(aSectName, tempStore, id); |
|
502 if ( ret ) |
|
503 { |
|
504 aResult.Set(id); |
|
505 } |
|
506 else |
|
507 { |
|
508 tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdName); |
|
509 TPtrC name; |
|
510 ret=GetStringFromConfig(aSectName, tempStore, name); |
|
511 if ( ret ) |
|
512 { |
|
513 CDataWrapperBase* wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(name)); |
|
514 aResult=wrapper->GetId(); |
|
515 } |
|
516 } |
|
517 } |
|
518 |
|
519 return ret; |
|
520 } |
|
521 |
|
522 TBool CDataWrapperBase::GetDateTimeFromConfig(const TDesC& aSectName, TDateTime& aResult) |
|
523 { |
|
524 TInt year , month , day , hour , minute, second, microsecond ; |
|
525 |
|
526 // Fields |
|
527 _LIT(KYear, "year"); |
|
528 _LIT(KMonth, "month"); |
|
529 _LIT(KDay, "day"); |
|
530 _LIT(KHour, "hour"); |
|
531 _LIT(KMinute, "minute"); |
|
532 _LIT(KSecond, "second"); |
|
533 _LIT(KMicrosecond, "microsecond"); |
|
534 |
|
535 TBool ret = ETrue ; |
|
536 if ( !GetIntFromConfig( aSectName, KYear , year)) |
|
537 { |
|
538 ret=EFalse; |
|
539 } |
|
540 if ( !GetIntFromConfig( aSectName, KMonth , month)) |
|
541 { |
|
542 ret=EFalse; |
|
543 } |
|
544 if ( !GetIntFromConfig( aSectName, KDay, day)) |
|
545 { |
|
546 ret=EFalse; |
|
547 } |
|
548 if ( !GetIntFromConfig( aSectName, KHour, hour)) |
|
549 { |
|
550 ret=EFalse; |
|
551 } |
|
552 if ( !GetIntFromConfig( aSectName, KMinute , minute)) |
|
553 { |
|
554 ret=EFalse; |
|
555 } |
|
556 if ( !GetIntFromConfig( aSectName, KSecond , second)) |
|
557 { |
|
558 ret=EFalse; |
|
559 } |
|
560 if ( !GetIntFromConfig( aSectName, KMicrosecond , microsecond)) |
|
561 { |
|
562 ret=EFalse; |
|
563 } |
|
564 if ( ret ) |
|
565 { |
|
566 TMonth amonth ; |
|
567 switch (month) |
|
568 { |
|
569 case 1: |
|
570 amonth = EJanuary ; |
|
571 break ; |
|
572 case 2: |
|
573 amonth = EFebruary ; |
|
574 break ; |
|
575 case 3 : |
|
576 amonth = EMarch ; |
|
577 break ; |
|
578 case 4: |
|
579 amonth = EApril ; |
|
580 break ; |
|
581 case 5: |
|
582 amonth = EMay ; |
|
583 break ; |
|
584 case 6 : |
|
585 amonth = EJune ; |
|
586 break ; |
|
587 case 7 : |
|
588 amonth = EJuly ; |
|
589 break ; |
|
590 case 8 : |
|
591 amonth = EAugust ; |
|
592 break ; |
|
593 case 9 : |
|
594 amonth = ESeptember ; |
|
595 break ; |
|
596 case 10 : |
|
597 amonth = EOctober ; |
|
598 break ; |
|
599 case 11 : |
|
600 amonth = ENovember ; |
|
601 break ; |
|
602 case 12: |
|
603 amonth = EDecember ; |
|
604 break ; |
|
605 default : |
|
606 return ret ; |
|
607 } |
|
608 |
|
609 aResult.Set(year,amonth ,day,hour,minute,second,microsecond); |
|
610 } |
|
611 |
|
612 return ret ; |
|
613 } |
|
614 void CDataWrapperBase::LogRegion(const TDesC& aMessage, const TRegion& aRegion) |
|
615 { |
|
616 INFO_PRINTF2(KLogRegion, &aMessage); |
|
617 TInt indCount = aRegion.Count(); |
|
618 if ( indCount==0 ) |
|
619 { |
|
620 INFO_PRINTF1(KLogEmpty); |
|
621 } |
|
622 else |
|
623 { |
|
624 const TRect* rect=aRegion.RectangleList(); |
|
625 for ( TInt index=0; index<indCount; ++index ) |
|
626 { |
|
627 INFO_PRINTF6(KLogRegionsRect, index, rect[index].iTl.iX, rect[index].iTl.iY, rect[index].iBr.iX, rect[index].iBr.iY); |
|
628 } |
|
629 } |
|
630 } |
|
631 |
|
632 void CDataWrapperBase::LogRect(const TDesC& aMessage, const TRect& aRect) |
|
633 { |
|
634 INFO_PRINTF6(KLogRect, &aMessage, aRect.iTl.iX, aRect.iTl.iY, aRect.iBr.iX, aRect.iBr.iY); |
|
635 } |
|