|
1 /* |
|
2 * Copyright (c) 2002 - 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 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include <LiwServiceHandler.h> |
|
26 #include <Liwbufferextension.h> |
|
27 |
|
28 #include "txmlconvertor.h" |
|
29 |
|
30 #include <f32file.h> |
|
31 #include <e32des16.h> |
|
32 #include <e32base.h> |
|
33 |
|
34 #include "tprovidertestobserver.h" |
|
35 #include "txmlconvertor.h" |
|
36 #include "landmarkliwparams.hrh" |
|
37 #include "tproviderlmarktest.h" |
|
38 |
|
39 using namespace LIW; |
|
40 |
|
41 // EXTERNAL DATA STRUCTURES |
|
42 //extern ?external_data; |
|
43 |
|
44 // EXTERNAL FUNCTION PROTOTYPES |
|
45 //extern ?external_function( ?arg_type,?arg_type ); |
|
46 |
|
47 // CONSTANTS |
|
48 //const ?type ?constant_var = ?constant; |
|
49 |
|
50 // MACROS |
|
51 //#define ?macro ?macro_def |
|
52 |
|
53 // LOCAL CONSTANTS AND MACROS |
|
54 //const ?type ?constant_var = ?constant; |
|
55 //#define ?macro_name ?macro_def |
|
56 |
|
57 // MODULE DATA STRUCTURES |
|
58 //enum ?declaration |
|
59 //typedef ?declaration |
|
60 |
|
61 // LOCAL FUNCTION PROTOTYPES |
|
62 //?type ?function_name( ?arg_type, ?arg_type ); |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 //class ?FORWARD_CLASSNAME; |
|
66 |
|
67 // ============================= LOCAL FUNCTIONS =============================== |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // ?function_name ?description. |
|
71 // ?description |
|
72 // Returns: ?value_1: ?description |
|
73 // ?value_n: ?description_line1 |
|
74 // ?description_line2 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 /* |
|
78 ?type ?function_name( |
|
79 ?arg_type arg, // ?description |
|
80 ?arg_type arg) // ?description |
|
81 { |
|
82 |
|
83 ?code // ?comment |
|
84 |
|
85 // ?comment |
|
86 ?code |
|
87 } |
|
88 */ |
|
89 |
|
90 // ============================ MEMBER FUNCTIONS =============================== |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // Ctproviderlmarktest::Delete |
|
94 // Delete here all resources allocated and opened from test methods. |
|
95 // Called from destructor. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void Ctproviderlmarktest::Delete() |
|
99 { |
|
100 |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // Ctproviderlmarktest::RunMethodL |
|
105 // Run specified method. Contains also table of test mothods and their names. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TInt Ctproviderlmarktest::RunMethodL( |
|
109 CStifItemParser& aItem ) |
|
110 { |
|
111 |
|
112 static TStifFunctionInfo const KFunctions[] = |
|
113 { |
|
114 // Copy this line for every implemented function. |
|
115 // First string is the function name used in TestScripter script file. |
|
116 // Second is the actual implementation member function. |
|
117 ENTRY( "CheckInputArgumentType", Ctproviderlmarktest::CheckInputArgumentType ), |
|
118 ENTRY( "RemoveFile", Ctproviderlmarktest::RemoveFile ), |
|
119 //ADD NEW ENTRY HERE |
|
120 |
|
121 }; |
|
122 |
|
123 const TInt count = sizeof( KFunctions ) / |
|
124 sizeof( TStifFunctionInfo ); |
|
125 |
|
126 return RunInternalL( KFunctions, count, aItem ); |
|
127 |
|
128 } |
|
129 |
|
130 TInt Ctproviderlmarktest::RemoveFile( CStifItemParser& aItem ) |
|
131 { |
|
132 TPtrC16 file; |
|
133 aItem.GetNextString(file); |
|
134 RFile LogResult; |
|
135 RFs LogResultSession; |
|
136 User::LeaveIfError(LogResultSession.Connect()); |
|
137 if(LogResult.Open(LogResultSession ,file , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
138 { |
|
139 LogResult.Close(); |
|
140 |
|
141 LogResultSession.Delete(file); |
|
142 |
|
143 LogResultSession.Close(); |
|
144 } |
|
145 |
|
146 LogResult.Close(); |
|
147 LogResultSession.Close(); |
|
148 return KErrNone; |
|
149 |
|
150 } |
|
151 |
|
152 TInt Ctproviderlmarktest::CheckInputArgumentType( CStifItemParser& aItem ) |
|
153 { |
|
154 |
|
155 __UHEAP_MARK; |
|
156 TPtrC16 serice16; |
|
157 TPtrC16 title; |
|
158 TPtrC16 Interface16; |
|
159 TPtrC16 command16; |
|
160 TInt servicecmdpptions; |
|
161 TPtrC16 callback; |
|
162 |
|
163 TInt expected; |
|
164 TInt32 err = 0; |
|
165 CProviderObserver* callbackobj = NULL; |
|
166 |
|
167 TInt result =KErrNone ;// KErrGeneral; // 0 means pass and -1 means Fail |
|
168 |
|
169 aItem.GetNextString(serice16); |
|
170 aItem.GetNextString(Interface16); |
|
171 aItem.GetNextString(command16); |
|
172 aItem.GetNextInt(servicecmdpptions); |
|
173 aItem.GetNextString(callback); |
|
174 |
|
175 iLog->Log(_L("read varibale ")); |
|
176 |
|
177 /*-------------------------------------------------------------------------------------------*/ |
|
178 |
|
179 |
|
180 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
181 CleanupStack::PushL(iServiceHandler);//1 |
|
182 |
|
183 if ( iServiceHandler ) |
|
184 iLog->Log(_L("Got Service Handler ")); |
|
185 else |
|
186 iLog->Log(_L("Didn't get service handler")); |
|
187 |
|
188 |
|
189 //Take the Interface name and provider from cfg file |
|
190 TBuf8<30> interface8; |
|
191 TBuf8<30> service8; |
|
192 interface8.Copy(Interface16); |
|
193 service8.Copy(serice16); |
|
194 |
|
195 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1,interface8,service8); |
|
196 iLog->Log(_L("Create criterai Item")); |
|
197 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
198 CleanupStack::PushL(crit);//2 |
|
199 |
|
200 |
|
201 RCriteriaArray critArray; |
|
202 iLog->Log(_L("Append in Crit")); |
|
203 critArray.AppendL(crit); |
|
204 CleanupClosePushL(critArray);//3 |
|
205 |
|
206 iServiceHandler->AttachL(critArray); |
|
207 |
|
208 |
|
209 iLog->Log(_L("Creating Output")); |
|
210 CLiwGenericParamList* output = CLiwGenericParamList::NewL(); |
|
211 CleanupStack::PushL(output);//4 |
|
212 CLiwGenericParamList* input = CLiwGenericParamList::NewL(); |
|
213 CleanupStack::PushL(input);//5 |
|
214 |
|
215 iLog->Log(_L("call Service cmd L")); |
|
216 iServiceHandler->ExecuteServiceCmdL(*crit, *input, *output); |
|
217 |
|
218 iLog->Log(_L("Service cmdl is over")); |
|
219 |
|
220 // Create the Instance of SAPI class and the Input Param and output Param |
|
221 TInt pos = 0; |
|
222 MLiwInterface* Interface = NULL; |
|
223 output->FindFirst(pos,interface8 ); |
|
224 if(pos != KErrNotFound) |
|
225 { |
|
226 Interface = (*output)[pos].Value().AsInterface(); |
|
227 } |
|
228 output->Reset(); |
|
229 |
|
230 CleanupClosePushL(*Interface);//6 |
|
231 iLog->Log(_L("got Interface")); |
|
232 input->Reset(); |
|
233 |
|
234 |
|
235 if (FillInputParmaeterList( aItem, input) == KErrNone ) |
|
236 { |
|
237 //Call Service |
|
238 // PrintInputParameterList(input); |
|
239 TBuf8<30> command8; |
|
240 if(command16.Compare(_L("Update"))) |
|
241 command8.Copy(command16); |
|
242 else |
|
243 command8.Copy(_L("Add")); |
|
244 |
|
245 if(callback.CompareF(_L("NULL"))==0) |
|
246 { |
|
247 //without call back |
|
248 Interface->ExecuteCmdL(command8,*input,*output,servicecmdpptions, NULL); |
|
249 } |
|
250 else |
|
251 |
|
252 { |
|
253 //need to change the observer |
|
254 callbackobj = CProviderObserver::NewL(); |
|
255 //CleanupStack::PushL( callbackobj); |
|
256 Interface->ExecuteCmdL(command8,*input,*output,servicecmdpptions, callbackobj); |
|
257 //CleanupStack::PopAndDestroy( ); |
|
258 } |
|
259 |
|
260 aItem.GetNextInt(expected); |
|
261 aItem.GetNextString(title); |
|
262 TInt index =0; |
|
263 const TLiwGenericParam* error = output->FindFirst(index,KErrorCode); |
|
264 if(error) |
|
265 err = error->Value().AsTInt32(); |
|
266 if(err == 0 ) |
|
267 { |
|
268 if(!command16.Compare(_L("GetList"))) |
|
269 { |
|
270 |
|
271 // Requested Accepted by the provider |
|
272 if( (callback != NULL) && (KLiwOptASyncronous == servicecmdpptions) ) |
|
273 { |
|
274 // need to wait for callback |
|
275 CActiveSchedulerWait* wait = new CActiveSchedulerWait(); |
|
276 CleanupStack::PushL( wait); |
|
277 callbackobj->SetWait( wait ); |
|
278 wait->Start(); |
|
279 CleanupStack::PopAndDestroy();//Active Wait Scheduler |
|
280 } |
|
281 /* // Iterate through the items and fetch the count |
|
282 TInt count =0; |
|
283 TInt search_pos=0; |
|
284 const TLiwGenericParam* output_data = output->FindFirst( search_pos,_L8("ReturnValue")); |
|
285 |
|
286 if(output_data) |
|
287 { |
|
288 CLiwIterable* iterlist = output_data->Value().AsIterable(); |
|
289 TLiwVariant data; |
|
290 while( iterlist->NextL(data)) |
|
291 { |
|
292 count++; |
|
293 const CLiwMap* res = data.AsMap(); |
|
294 if ( res ) |
|
295 { |
|
296 TLiwVariant new_data; |
|
297 TLiwVariant desc_data; |
|
298 if(res->FindL(KLandmarkName, new_data)) |
|
299 { |
|
300 TPtrC name = new_data.AsDes(); |
|
301 TBuf<40> name_data; |
|
302 name_data.Copy(name); |
|
303 TInt name_comparison_res = name.Compare(_L("200e-2.5")); |
|
304 |
|
305 } |
|
306 if(res->FindL(KLandmarkDesc, desc_data)) |
|
307 { |
|
308 TPtrC desc = desc_data.AsDes(); |
|
309 TBuf<4000> description_data; |
|
310 description_data.Copy(desc); |
|
311 iLog->Log(_L("Description Data:")); |
|
312 iLog->Log(description_data); |
|
313 } |
|
314 new_data.Reset(); |
|
315 desc_data.Reset(); |
|
316 //const_cast<CLiwMap*>(res)->DecRef(); |
|
317 } |
|
318 } |
|
319 data.Reset(); |
|
320 }*/ |
|
321 } |
|
322 } |
|
323 |
|
324 iLog->Log(_L("Got Error Code ")); |
|
325 iLog->Log(_L("Expected value for test case [%S] is [%d]"), &title,expected ); |
|
326 iLog->Log(_L("Actual value for test case [%S] is [%d]"), &title,err ); |
|
327 |
|
328 if(expected != err) |
|
329 { |
|
330 result = KErrGeneral; |
|
331 } |
|
332 } |
|
333 else |
|
334 { |
|
335 //Input Parameter List is not properly entered in Cfg file |
|
336 // PrintInputParameterList(input); |
|
337 iLog->Log(_L("Input not properly passed ")); |
|
338 result = KErrGeneral; |
|
339 } |
|
340 |
|
341 output->Reset(); |
|
342 input->Reset(); |
|
343 delete callbackobj; |
|
344 CleanupStack::PopAndDestroy( ); |
|
345 CleanupStack::PopAndDestroy( ); |
|
346 CleanupStack::PopAndDestroy( ); |
|
347 CleanupStack::PopAndDestroy( ); |
|
348 CleanupStack::PopAndDestroy( ); |
|
349 CleanupStack::PopAndDestroy( ); |
|
350 |
|
351 __UHEAP_MARKEND; |
|
352 return result; |
|
353 |
|
354 } |
|
355 |
|
356 TInt Ctproviderlmarktest::FillInputParmaeterList( CStifItemParser& aItem , CLiwGenericParamList* input ) |
|
357 |
|
358 { |
|
359 |
|
360 TInt intValue; |
|
361 |
|
362 TPtrC16 value16; |
|
363 TBuf8<40> value8; |
|
364 TLiwVariant value; |
|
365 TLiwGenericParam valueParam; |
|
366 TBuf8<40> next8 ; |
|
367 TPtrC next16; |
|
368 TPtrC16 dataType; |
|
369 |
|
370 aItem.GetNextString(next16); |
|
371 while( next16.CompareF(_L("Finish"))!= 0) |
|
372 { |
|
373 aItem.GetNextString(dataType); |
|
374 //Convert variable name into 8 bit key |
|
375 next8.Copy(next16); |
|
376 |
|
377 if(dataType.CompareF(_L("Int") )== 0) |
|
378 { |
|
379 //Value should be Integer |
|
380 aItem.GetNextInt(intValue); |
|
381 value.SetL((TInt32)intValue); |
|
382 valueParam.SetNameAndValueL(next8, value); |
|
383 input->AppendL(valueParam); |
|
384 } |
|
385 |
|
386 else if ( dataType.CompareF(_L("String") ) == 0) |
|
387 { |
|
388 //Value should be 8 bit |
|
389 aItem.GetNextString(value16); |
|
390 value8.Copy(value16); |
|
391 value.SetL(value8); |
|
392 valueParam.SetNameAndValueL(next8, value); |
|
393 input->AppendL(valueParam); |
|
394 } |
|
395 |
|
396 else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
397 { |
|
398 //Value should be 16 bit string |
|
399 aItem.GetNextString(value16); |
|
400 value.SetL(value16); |
|
401 valueParam.SetNameAndValueL(next8, value); |
|
402 input->AppendL(valueParam); |
|
403 } |
|
404 else if ( dataType.CompareF(_L("Map")) == 0) |
|
405 { |
|
406 //Value should be map |
|
407 CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
408 value.SetL(map); |
|
409 valueParam.SetNameAndValueL(next8, value); |
|
410 input->AppendL(valueParam); |
|
411 map->DecRef(); |
|
412 |
|
413 if( FillMap(aItem,map) !=KErrNone) |
|
414 return KErrGeneral; |
|
415 |
|
416 } |
|
417 else if ( dataType.CompareF(_L("List")) == 0) |
|
418 { |
|
419 //Value should be map |
|
420 CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
421 value.SetL(list); |
|
422 valueParam.SetNameAndValueL(next8, value); |
|
423 input->AppendL(valueParam); |
|
424 list->DecRef(); |
|
425 |
|
426 if( FillList(aItem,list) !=KErrNone) |
|
427 return KErrGeneral; |
|
428 } |
|
429 else |
|
430 { |
|
431 return KErrGeneral; |
|
432 } |
|
433 valueParam.Reset(); |
|
434 value.Reset(); |
|
435 aItem.GetNextString(next16); |
|
436 }//While loop |
|
437 |
|
438 |
|
439 return KErrNone; |
|
440 } |
|
441 |
|
442 TInt Ctproviderlmarktest::FillMap( CStifItemParser& aItem , CLiwDefaultMap* aMap ) |
|
443 |
|
444 { |
|
445 |
|
446 TInt intValue; |
|
447 TReal32 incorrect_realValue = -5433465343434343434343434343.3456; |
|
448 TReal32 correct_realValue = 5401234.32e25; |
|
449 TPtrC16 value16; |
|
450 TPtrC16 null_value; |
|
451 null_value.Set(KNullDesC); |
|
452 TBuf8<40> value8; |
|
453 TLiwVariant value; |
|
454 TBuf8<40> next8 ; |
|
455 TPtrC next16; |
|
456 TPtrC16 dataType; |
|
457 |
|
458 aItem.GetNextString(next16); |
|
459 while( next16.CompareF(_L("End"))!= 0) |
|
460 { |
|
461 aItem.GetNextString(dataType); |
|
462 //Convert variable name into 8 bit key |
|
463 next8.Copy(next16); |
|
464 |
|
465 if(dataType.CompareF(_L("Int") )== 0) |
|
466 { |
|
467 //Value should be Integer |
|
468 aItem.GetNextInt(intValue); |
|
469 value.SetL((TInt32)intValue); |
|
470 aMap->InsertL(next8,value); |
|
471 } |
|
472 else if (dataType.CompareF(_L("Real") ) == 0) |
|
473 { |
|
474 //Value should be Real |
|
475 aItem.GetNextInt(intValue); |
|
476 if(intValue == 1) |
|
477 value.SetL((TReal32)incorrect_realValue); |
|
478 else |
|
479 value.SetL((TReal32)correct_realValue); |
|
480 aMap->InsertL(next8,value); |
|
481 } |
|
482 else if ( dataType.CompareF(_L("Bool") ) == 0) |
|
483 { |
|
484 //Value should be 8 bit |
|
485 aItem.GetNextInt(intValue); |
|
486 if(intValue) |
|
487 value.SetL((TBool)1); |
|
488 else |
|
489 value.SetL((TBool)0); |
|
490 aMap->InsertL(next8,value); |
|
491 } |
|
492 else if ( dataType.CompareF(_L("String") ) == 0) |
|
493 { |
|
494 //Value should be 8 bit |
|
495 aItem.GetNextString(value16); |
|
496 value8.Copy(value16); |
|
497 value.SetL(value8); |
|
498 aMap->InsertL(next8,value); |
|
499 } |
|
500 else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
501 { |
|
502 //Value should be 16 bit string |
|
503 aItem.GetNextString(value16); |
|
504 if(value16.Compare(_L("Null"))) |
|
505 value.SetL(value16); |
|
506 else |
|
507 value.SetL(null_value); |
|
508 aMap->InsertL(next8,value); |
|
509 } |
|
510 else if ( dataType.CompareF(_L("Map")) == 0) |
|
511 { |
|
512 //Value should be map |
|
513 CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
514 value.SetL(map); |
|
515 aMap->InsertL(next8,value); |
|
516 map->DecRef(); |
|
517 |
|
518 if( FillMap(aItem,map) !=KErrNone) |
|
519 return KErrGeneral; |
|
520 |
|
521 } |
|
522 else if ( dataType.CompareF(_L("List")) == 0) |
|
523 { |
|
524 //Value should be map |
|
525 CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
526 value.SetL(list); |
|
527 aMap->InsertL(next8,value); |
|
528 list->DecRef(); |
|
529 |
|
530 if( FillList(aItem,list) !=KErrNone) |
|
531 return KErrGeneral; |
|
532 } |
|
533 else |
|
534 { |
|
535 return KErrGeneral; |
|
536 } |
|
537 value.Reset(); |
|
538 aItem.GetNextString(next16); |
|
539 }//While loop |
|
540 |
|
541 |
|
542 return KErrNone; |
|
543 |
|
544 } |
|
545 |
|
546 |
|
547 |
|
548 TInt Ctproviderlmarktest::FillList( CStifItemParser& aItem , CLiwDefaultList* aList ) |
|
549 |
|
550 { |
|
551 |
|
552 TInt intValue; |
|
553 TPtrC16 value16; |
|
554 TBuf8<40> value8; |
|
555 TLiwVariant value; |
|
556 TBuf8<40> next8 ; |
|
557 TPtrC next16; |
|
558 TPtrC16 dataType; |
|
559 |
|
560 aItem.GetNextString(dataType); |
|
561 while( dataType.CompareF(_L("End"))!= 0) |
|
562 { |
|
563 //aItem.GetNextString(dataType); |
|
564 |
|
565 if(dataType.CompareF(_L("Int") )== 0) |
|
566 { |
|
567 //Value should be Integer |
|
568 aItem.GetNextInt(intValue); |
|
569 value.SetL((TInt32)intValue); |
|
570 aList->AppendL(value); |
|
571 } |
|
572 |
|
573 else if ( dataType.CompareF(_L("String") ) == 0) |
|
574 { |
|
575 //Value should be 8 bit |
|
576 aItem.GetNextString(value16); |
|
577 value8.Copy(value16); |
|
578 value.SetL(value8); |
|
579 aList->AppendL(value); |
|
580 } |
|
581 else if ( dataType.CompareF(_L("UnicodeString") ) == 0) |
|
582 { |
|
583 //Value should be 16 bit string |
|
584 aItem.GetNextString(value16); |
|
585 value.SetL(value16); |
|
586 aList->AppendL(value); |
|
587 } |
|
588 else if ( dataType.CompareF(_L("Map")) == 0) |
|
589 { |
|
590 //Value should be map |
|
591 CLiwDefaultMap *map = CLiwDefaultMap::NewL(); |
|
592 value.SetL(map); |
|
593 aList->AppendL(value); |
|
594 map->DecRef(); |
|
595 |
|
596 if( FillMap(aItem,map) !=KErrNone) |
|
597 return KErrGeneral; |
|
598 |
|
599 } |
|
600 else if ( dataType.CompareF(_L("List")) == 0) |
|
601 { |
|
602 //Value should be List |
|
603 CLiwDefaultList *list = CLiwDefaultList::NewL(); |
|
604 value.SetL(list); |
|
605 aList->AppendL(value); |
|
606 list->DecRef(); |
|
607 |
|
608 if( FillList(aItem,list) !=KErrNone) |
|
609 return KErrGeneral; |
|
610 |
|
611 } |
|
612 else |
|
613 { |
|
614 return KErrGeneral; |
|
615 } |
|
616 value.Reset(); |
|
617 aItem.GetNextString(dataType); |
|
618 }//While loop |
|
619 |
|
620 |
|
621 return KErrNone; |
|
622 |
|
623 } |
|
624 |
|
625 |
|
626 void Ctproviderlmarktest::PrintInputParameterList( CLiwGenericParamList* input ) |
|
627 { |
|
628 |
|
629 // Show the Input List |
|
630 RFs fs; |
|
631 RFile file; |
|
632 User::LeaveIfError(fs.Connect()); |
|
633 |
|
634 CleanupClosePushL(fs);//1 |
|
635 TInt errfile=0; |
|
636 TEntry entry; |
|
637 |
|
638 |
|
639 |
|
640 if( fs.Entry(_L("c:\\Data\\Provider\\"),entry) != KErrNone) |
|
641 { |
|
642 TInt ret = fs.MkDir(_L("c:\\Data\\Provider\\")); |
|
643 } |
|
644 |
|
645 TBuf<100> flname(_L("c:\\Data\\Provider\\InputList.xml")); |
|
646 |
|
647 errfile =file.Replace(fs,flname, EFileWrite | EFileStreamText); |
|
648 CleanupClosePushL(file);//2 |
|
649 |
|
650 |
|
651 /*------------------------------------------------------------------------------*/ |
|
652 //Generate Xml file |
|
653 TPtrC filebuf; |
|
654 |
|
655 |
|
656 CXmlConvertor* convertor = CXmlConvertor::NewL(); |
|
657 CleanupStack::PushL(convertor); |
|
658 convertor->BuildOutputTreeL(*input,filebuf); |
|
659 |
|
660 HBufC8* heapBuffer = HBufC8::NewL(filebuf.Length()); |
|
661 TPtr8 filebuf8(heapBuffer->Des()); |
|
662 filebuf8.Copy(filebuf); |
|
663 |
|
664 file.Write(filebuf8); |
|
665 |
|
666 delete heapBuffer; |
|
667 CleanupStack::PopAndDestroy(); |
|
668 |
|
669 /*------------------------------------------------------------------------------*/ |
|
670 |
|
671 |
|
672 CleanupStack::PopAndDestroy();//File 1 |
|
673 CleanupStack::PopAndDestroy();//File Session 2 |
|
674 } |
|
675 |
|
676 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
677 // None |
|
678 |
|
679 // End of File |