当前位置: 首页>>代码示例>>C++>>正文


C++ CContactDatabase::MatchPhoneNumberL方法代码示例

本文整理汇总了C++中CContactDatabase::MatchPhoneNumberL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::MatchPhoneNumberL方法的具体用法?C++ CContactDatabase::MatchPhoneNumberL怎么用?C++ CContactDatabase::MatchPhoneNumberL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContactDatabase的用法示例。


在下文中一共展示了CContactDatabase::MatchPhoneNumberL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestPhoneMatchingL

void TestPhoneMatchingL(CContactDatabase& aDb)
	{
	test.Next(_L("Test phone match"));

	CContactIdArray* array = aDb.MatchPhoneNumberL(KTelephoneNum,KMaxPhoneMatchLength);	
	test(array->Count() == 4);
	delete array;

	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
	syncChecker->SetValidateResponseL(MContactSynchroniser::EEdit, KErrNone);
	syncChecker->SetValidateWriteResponseL(KErrNone);
	aDb.SetDbViewContactType(KUidContactICCEntry);
	TContactItemId id = (*aDb.SortedItemsL())[0];
	CContactItem* item = aDb.OpenContactLX(id);
	CleanupStack::PushL(item);
	CContactItemFieldSet& fieldset = item->CardFields();
	const TInt pos = fieldset.Find(KUidContactFieldPhoneNumber);	
	CContactItemField& field = fieldset[pos];
	CContactTextField* textfield = field.TextStorage();
	textfield->SetTextL(KTelephoneNumModified);
	aDb.CommitContactL(*item);
	CleanupStack::PopAndDestroy(2); //item, lock record

	CContactIdArray* array2 = aDb.MatchPhoneNumberL(KTelephoneNumModified,KMaxPhoneMatchLength);	
	test(array2->Count() == 1);
	delete array2;
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:27,代码来源:t_iccentry.cpp

示例2: TestMatchPhoneNumberL

void TestMatchPhoneNumberL(CContactDatabase& aDb, TContactItemId aIccId, TContactItemId aNonIccId)
	{
	// The synchroniser is not called to validate the IDs at for this method because 
	// phone number resolution needs to be as quick as possible. 
	// Instead, validation is done when the client attempts to read the items.
	test.Next(_L("Test MatchPhoneNumberL"));
	// Successful find of icc entry phone number
	syncChecker->ResetMethodCallCountsL();
	CContactIdArray* array = aDb.MatchPhoneNumberL(KIccNumber,KMaxPhoneMatchLength);
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(array!=NULL);
	test(array->Count() == 1);
	test((*array)[0]==aIccId);
	delete array;
	array=NULL;

	test.Next(_L("Test searching when ICC locked"));
	// successful find when icc locked - validation done when entry read
	syncChecker->SetValidateResponseL(MContactSynchroniser::ESearch,KErrLocked);
	syncChecker->ResetMethodCallCountsL();
	TRAPD(err,array = aDb.MatchPhoneNumberL(KIccNumber,KMaxPhoneMatchLength));
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(array!=NULL);
	test(err==KErrNone);
	test((*array)[0]==aIccId);
	delete array;
	array=NULL;
	syncChecker->ResetMethodCallCountsL();
	array = aDb.MatchPhoneNumberL(KNonIccNumber,KMaxPhoneMatchLength);
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(array!=NULL);
	test(array->Count() == 1);
	test((*array)[0]==aNonIccId);
	delete array;
	array=NULL;
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:36,代码来源:t_iccmultiplephonebook.cpp


注:本文中的CContactDatabase::MatchPhoneNumberL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。