本文整理汇总了C++中CContactDatabase::FindInTextDefLC方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::FindInTextDefLC方法的具体用法?C++ CContactDatabase::FindInTextDefLC怎么用?C++ CContactDatabase::FindInTextDefLC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::FindInTextDefLC方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestFindInTextDefLC
void TestFindInTextDefLC(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
{
test.Next(_L("Test FindInTextDefLC"));
// Successful find of icc entry
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
TCallBack callBack(findWordSplitterL);
CContactTextDef* textDef=CContactTextDef::NewLC();
textDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName));
CDesCArray* desArray = new(ELeave) CDesCArrayFlat(5);
desArray->AppendL(_L("icc"));
syncChecker->ResetMethodCallCountsL();
CContactIdArray* array = aDb.FindInTextDefLC(*desArray,textDef,callBack);
//test(syncChecker->ValidateMethodCallCountL() == 3);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aIccId);
CleanupStack::PopAndDestroy(array);
array=NULL;
test.Next(_L("Test searching when ICC locked"));
// Unsuccessful find of icc entry because icc locked
syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
syncChecker->ResetMethodCallCountsL();
TRAPD(err,array = aDb.FindInTextDefLC(*desArray,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array==NULL);
desArray->Delete(0);
delete desArray;
// successful find of non-icc entry, even though icc locked
CDesCArray* desArray2 = new(ELeave) CDesCArrayFlat(5);
desArray2->AppendL(_L("non-icc"));
syncChecker->ResetMethodCallCountsL();
array = aDb.FindInTextDefLC(*desArray2,textDef,callBack);
test(syncChecker->ValidateMethodCallCountL() == 0);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
// both the icc and non-icc entry should match the search criteria, but only the
// non-icc entry should be returned since icc is locked
SetNameField(aDb,aIccId,KNonIccName);
syncChecker->ResetMethodCallCountsL();
TRAP(err,array = aDb.FindInTextDefLC(*desArray2,textDef,callBack));
test(syncChecker->ValidateMethodCallCountL() == 1);
test(err==KErrLocked);
test(array!=NULL);
test(array->Count() == 1);
test((*array)[0]==aNonIccId);
desArray2->Delete(0);
delete desArray2;
SetNameField(aDb,aIccId,KIccName);
CleanupStack::PopAndDestroy(2,textDef); // array, textDef
}