contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp
equal
deleted
inserted
replaced
20 #include <CPsQueryItem.h> |
20 #include <CPsQueryItem.h> |
21 #include "TestSuiteInputData.h" |
21 #include "TestSuiteInputData.h" |
22 #include "pstestcontactshandler.h" |
22 #include "pstestcontactshandler.h" |
23 #include "psclienttestsuitedefs.h" |
23 #include "psclienttestsuitedefs.h" |
24 #include <vpbkeng.rsg> |
24 #include <vpbkeng.rsg> |
25 #include <f32file.h> |
|
26 #include <CHARCONV.H> |
|
27 |
|
28 void CTestSuiteInputData::ConvUtf2UniL( const TDesC& aOriginal, TDes& aRes ) |
|
29 { |
|
30 HBufC8* buf8 = HBufC8::NewLC( aOriginal.Length() * 2 ); |
|
31 buf8->Des().Copy( aOriginal ); |
|
32 TPtrC8 str = buf8->Des(); |
|
33 |
|
34 HBufC* InfoText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( str ); |
|
35 CleanupStack::PushL( InfoText ); |
|
36 TPtr16 ptr = InfoText->Des(); |
|
37 |
|
38 aRes.Zero(); |
|
39 aRes.Copy( ptr ); |
|
40 |
|
41 CleanupStack::PopAndDestroy( 2 ); |
|
42 } |
|
43 |
25 |
44 // ============================== MEMBER FUNCTIONS ============================ |
26 // ============================== MEMBER FUNCTIONS ============================ |
45 |
27 |
46 // ---------------------------------------------------------------------------- |
28 // ---------------------------------------------------------------------------- |
47 // Two Phase constructor |
29 // Two Phase constructor |
438 |
420 |
439 while ( (j < aInput.Length()) && (aInput[j] != comma) ) |
421 while ( (j < aInput.Length()) && (aInput[j] != comma) ) |
440 j++; |
422 j++; |
441 |
423 |
442 TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); |
424 TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); |
443 |
425 |
444 HBufC* buf = dataPtr.AllocLC(); |
|
445 TPtr uniPtr = buf->Des(); |
|
446 ConvUtf2UniL( dataPtr, uniPtr); |
|
447 |
|
448 // Add data to the class |
426 // Add data to the class |
449 tempcacheData->data.Append(uniPtr.AllocL()); |
427 tempcacheData->data.Append(dataPtr.AllocL()); |
450 CleanupStack::PopAndDestroy(); |
|
451 |
428 |
452 commaPos = j ; |
429 commaPos = j ; |
453 j++; |
430 j++; |
454 } |
431 } |
455 |
432 |
569 // Get the data for each contact |
546 // Get the data for each contact |
570 while ( (j < aInput.Length()) && (aInput[j] != aSeparator) ) |
547 while ( (j < aInput.Length()) && (aInput[j] != aSeparator) ) |
571 j++; |
548 j++; |
572 |
549 |
573 TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); |
550 TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); |
574 HBufC* buf = dataPtr.AllocLC(); |
|
575 TPtr uniPtr = buf->Des(); |
|
576 ConvUtf2UniL( dataPtr, uniPtr); |
|
577 |
551 |
578 // Add data to the output |
552 // Add data to the output |
579 HBufC* tempData = uniPtr.AllocL(); |
553 HBufC* tempData = dataPtr.AllocL(); |
580 aSeparatedData.Append(tempData); |
554 aSeparatedData.Append(tempData); |
581 SeparatorPos = j; |
555 SeparatorPos = j; |
582 j++; |
556 j++; |
583 CleanupStack::PopAndDestroy(); |
|
584 } |
557 } |
585 } |
558 } |
586 |
559 |
587 // ----------------------------------------------------------------------------- |
560 // ----------------------------------------------------------------------------- |
588 // This function parses the input for search query |
561 // This function parses the input for search query |
871 // ----------------------------------------------------------------------------- |
844 // ----------------------------------------------------------------------------- |
872 // This function parses the input search string |
845 // This function parses the input search string |
873 // ----------------------------------------------------------------------------- |
846 // ----------------------------------------------------------------------------- |
874 void CTestSuiteInputData::ParseInputInputSearchStringL(TDesC& aInput) |
847 void CTestSuiteInputData::ParseInputInputSearchStringL(TDesC& aInput) |
875 { |
848 { |
876 HBufC* buf = aInput.AllocLC(); |
849 iInputSearchString = aInput.AllocL(); |
877 TPtr uniPtr = buf->Des(); |
|
878 ConvUtf2UniL( aInput, uniPtr); |
|
879 iInputSearchString = uniPtr.AllocL(); |
|
880 CleanupStack::PopAndDestroy(); |
|
881 } |
850 } |
882 |
851 |
883 // ----------------------------------------------------------------------------- |
852 // ----------------------------------------------------------------------------- |
884 // This function parses the input expected result string |
853 // This function parses the input expected result string |
885 // ----------------------------------------------------------------------------- |
854 // ----------------------------------------------------------------------------- |
979 gropName->Des().Copy(aInput.Left(commaPos)); |
948 gropName->Des().Copy(aInput.Left(commaPos)); |
980 TInt len = aInput.Length() - commaPos; |
949 TInt len = aInput.Length() - commaPos; |
981 HBufC* temp2 = aInput.Right(len - 1).AllocL(); |
950 HBufC* temp2 = aInput.Right(len - 1).AllocL(); |
982 ParseInputForContactsDataL(*temp2,0); |
951 ParseInputForContactsDataL(*temp2,0); |
983 |
952 |
984 HBufC* buf = gropName->AllocLC(); |
|
985 TPtr uniPtr = buf->Des(); |
|
986 ConvUtf2UniL( gropName->Des(), uniPtr); |
|
987 |
|
988 //Add the group |
953 //Add the group |
989 iContactHandler->AddGroupL(*buf); |
954 iContactHandler->AddGroupL(*gropName); |
990 CleanupStack::PopAndDestroy(); |
|
991 CActiveScheduler :: Start(); |
955 CActiveScheduler :: Start(); |
992 |
956 |
993 //Create Contacts |
957 //Create Contacts |
994 CreateContactsL(); |
958 CreateContactsL(); |
995 iContactHandler->AddCreatedContactsToGroup(); |
959 iContactHandler->AddCreatedContactsToGroup(); |
998 // ----------------------------------------------------------------------------- |
962 // ----------------------------------------------------------------------------- |
999 // This function parse the input for the group to seach in that particular group |
963 // This function parse the input for the group to seach in that particular group |
1000 // ----------------------------------------------------------------------------- |
964 // ----------------------------------------------------------------------------- |
1001 void CTestSuiteInputData::ParseInputForSearchWithinGroupL(TDesC& aInput) |
965 void CTestSuiteInputData::ParseInputForSearchWithinGroupL(TDesC& aInput) |
1002 { |
966 { |
1003 HBufC* buf = aInput.AllocLC(); |
967 iGroupToBeSearched = aInput.AllocL(); |
1004 TPtr uniPtr = buf->Des(); |
|
1005 ConvUtf2UniL( aInput, uniPtr); |
|
1006 iGroupToBeSearched = uniPtr.AllocL(); |
|
1007 CleanupStack::PopAndDestroy(); |
|
1008 } |
968 } |
1009 |
969 |
1010 // ----------------------------------------------------------------------------- |
970 // ----------------------------------------------------------------------------- |
1011 // Return the input language |
971 // Return the input language |
1012 // ----------------------------------------------------------------------------- |
972 // ----------------------------------------------------------------------------- |