本文整理汇总了C++中TPtrC::CompareC方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC::CompareC方法的具体用法?C++ TPtrC::CompareC怎么用?C++ TPtrC::CompareC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC
的用法示例。
在下文中一共展示了TPtrC::CompareC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTestStepL
/**
doTestStepL()
Reads the POP account name from the ini file. If ALL string is mentioned in the .ini file
it deletes all the IMAP accounts, Else deletes the IMAP account whose name is
mentioned in the ini file
@return
Returns the test step result
*/
TVerdict CT_MsgDeletePopAccount::doTestStepL()
{
INFO_PRINTF1(_L("Test Step: Delete Pop Account"));
TPtrC popAccountName;
// Read Pop Account Name from ini file
if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
{
ERR_PRINTF1(_L("Account name not specified"));
SetTestStepResult(EFail);
}
else
{
CEmailAccounts* account = CEmailAccounts::NewLC();
RArray<TPopAccount> arrayPop3Accounts;
CleanupClosePushL(arrayPop3Accounts);
account->GetPopAccountsL(arrayPop3Accounts);
TInt count=arrayPop3Accounts.Count();
TBuf<12> temp(popAccountName);
temp.UpperCase(); // Making case insensitive
if(temp.CompareC(_L("ALL")) == 0)
{
INFO_PRINTF2(_L("Deleting all accounts. Total = %d"), count);
for(TInt i=0; i<count; i++)
{
TPopAccount id = arrayPop3Accounts[i];
account->DeletePopAccountL(id);
}
}
else
{
TBool deleteFlag = EFalse;
for(TInt i = 0; i < count; i++)
{
if(popAccountName.CompareC(arrayPop3Accounts[i].iPopAccountName) == 0)
{
account->DeletePopAccountL(arrayPop3Accounts[i]);
// Just ensure that if we try to delete it again we hopefuly get an error
// or can see that it has been deleted.
arrayPop3Accounts.Remove(i);
deleteFlag = ETrue;
break;
}
}
if(deleteFlag)
{
INFO_PRINTF2(_L("Pop acount \" %S \" deleted"), &popAccountName);
}
else
{
ERR_PRINTF2(_L("Pop acount \" %S \" not found"), &popAccountName);
SetTestStepResult(EFail);
User::Leave(KErrNotFound);
}
}
CleanupStack::PopAndDestroy(2, account); //arrayPop3Accounts,account
}
return TestStepResult();
}
示例2: doTestStepL
// Each test step must supply a implementation for doTestStepL
enum TVerdict CTestAppLoaderEndTask::doTestStepL( void )
{
// Printing to the console and log file
INFO_PRINTF1(_L("TEST-> END TASK"));
TPtrC program;
if ( !GetStringFromConfig(ConfigSection(), KProgram, program) )
{
ERR_PRINTF2(KErrMissingParameter, &KProgram());
SetTestStepResult(EFail);
}
else
{
RApaLsSession apaLsSession;
User::LeaveIfError(apaLsSession.Connect());
CleanupClosePushL(apaLsSession);
User::LeaveIfError(apaLsSession.GetAllApps());
RWsSession ws;
User::LeaveIfError(ws.Connect());
CleanupClosePushL(ws);
TInt numWindowGroups = ws.NumWindowGroups();
CArrayFixFlat<TInt>* windowGroupList = new(ELeave) CArrayFixFlat<TInt>(numWindowGroups);
CleanupStack::PushL(windowGroupList);
// Populate array with current group list ids
User::LeaveIfError(ws.WindowGroupList(windowGroupList));
CApaWindowGroupName* windowGroupName = CApaWindowGroupName::NewLC(ws);
/* Note: we use windowGroupList->Count() instead of numWindowGroups, as in the middle of the
* update the list could change in length (or worse, be reduced) thus producing an out of bounds
* error if numWindowGroups were used
*/
TBool searching=ETrue;
for ( TInt i=0; (i<windowGroupList->Count()) && searching; ++i )
{
TInt wgId = windowGroupList->At(i);
windowGroupName->ConstructFromWgIdL(wgId);
TUid appUid = windowGroupName->AppUid();
TApaAppInfo appInfo;
HBufC* appCaption = NULL;
// Some applications, like midlets, may not provide any info
if (apaLsSession.GetAppInfo(appInfo, appUid) == KErrNone)
{
appCaption = appInfo.iCaption.AllocL();
}
else
{
appCaption = windowGroupName->Caption().AllocL();
}
CleanupStack::PushL(appCaption);
// Only list 'visible' applications
if ( appCaption->Length() )
{
TPtrC caption=*appCaption;
INFO_PRINTF2(KLogTask, &caption);
if ( program.CompareC(caption)==0 )
{
searching=EFalse;
TApaTask task(ws);
task.SetWgId(wgId);
if (task.Exists())
{
task.EndTask();
}
else
{
ERR_PRINTF2(KErrTaskNotFound, &program);
SetTestStepResult(EFail);
}
}
}
CleanupStack::Pop(1, appCaption); // taskEntry, appCaption
}
if ( searching )
{
ERR_PRINTF2(KErrTaskNotFound, &program);
SetTestStepResult(EFail);
}
CleanupStack::PopAndDestroy(4, &apaLsSession); // windowGroupName, windowGroupList
}
// test steps return a result
return TestStepResult();
}
示例3: VerifyPrivNotifierData
void CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData(CPosNetworkPrivacyRequestInfo* aNetPrivReqInfo, const TLbsTestRequestInfo& aExtReqInfo)
{
INFO_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData()"));
TBuf<KLbsMaxClientNameSize2> testNotifClientName;
TLbsTestRequestInfo::TFormatIndicator testNotifClientId;
aExtReqInfo.GetClientName(testNotifClientName);
testNotifClientId = aExtReqInfo.ClientNameFormat();
TBuf<KLbsMaxRequesterIdSize2> testNotifRequesterName;
TLbsTestRequestInfo::TFormatIndicator testNotifRequesterId;
aExtReqInfo.GetRequesterId(testNotifRequesterName);
testNotifRequesterId = aExtReqInfo.RequesterIdFormat();
TLbsTestRequestInfo::TRequestType storedRequestType;
TLbsTestRequestInfo::TRequestType receivedRequestType;
receivedRequestType = aExtReqInfo.RequestType();
TPtrC testApiClient;
TPtrC testApiRequestor;
if(iRequestInfoType == ERequestInfoTypeSupl)
{
CPosSUPLPrivacyRequestInfo* suplReqInfo = static_cast<CPosSUPLPrivacyRequestInfo*>(aNetPrivReqInfo);
CPosSUPLPrivacyRequestInfo::TIdType testApiRequestorId;
CPosSUPLPrivacyRequestInfo::TIdType testApiClientId;
suplReqInfo->GetLCSClient(testApiClient, testApiClientId);
suplReqInfo->GetRequestor(testApiRequestor, testApiRequestorId);
storedRequestType = suplReqInfo->RequestType();
if(storedRequestType != receivedRequestType)
{
ERR_PRINTF3(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Client RequestTypes Differ, sent value %d, recieved value %d."), storedRequestType, receivedRequestType);
iStep->SetTestStepResult(EFail);
}
if(!CompareRequestInfoType(testNotifClientId, testApiClientId))
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Client Ids Differ"));
iStep->SetTestStepResult(EFail);
}
if(!CompareRequestInfoType(testNotifRequesterId, testApiRequestorId))
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Requester Ids Differ"));
iStep->SetTestStepResult(EFail);
}
}
else if(iRequestInfoType == ERequestInfoTypeGsm)
{
CPosGSMPrivacyRequestInfo* gsmReqInfo = static_cast<CPosGSMPrivacyRequestInfo*>(aNetPrivReqInfo);
CPosGSMPrivacyRequestInfo::TIdType testApiRequestorId;
CPosGSMPrivacyRequestInfo::TIdType testApiClientId;
gsmReqInfo->GetLCSClient(testApiClient, testApiClientId);
gsmReqInfo->GetRequestor(testApiRequestor, testApiRequestorId);
storedRequestType = gsmReqInfo->RequestType();
if(storedRequestType != receivedRequestType)
{
ERR_PRINTF3(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Client RequestTypes Differ, sent value %d, recieved value %d."), storedRequestType, receivedRequestType);
iStep->SetTestStepResult(EFail);
}
if(!CompareRequestInfoType(testNotifClientId, testApiClientId))
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Client Ids Differ"));
iStep->SetTestStepResult(EFail);
}
if(!CompareRequestInfoType(testNotifRequesterId, testApiRequestorId))
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Requester Ids Differ"));
iStep->SetTestStepResult(EFail);
}
}
// Notifier Names may be truncated as a shorter buffer is used.
if(iPrivacyHandler != EPrivacyHandleByNotifier)
{
if(testApiClient.CompareC(testNotifClientName) != 0)
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Client Names Differ"));
iStep->SetTestStepResult(EFail);
}
if(testApiRequestor.CompareC(testNotifRequesterName) != 0)
{
ERR_PRINTF1(_L("CT_LbsPrivFwBaseRequest::VerifyPrivNotifierData() - Failed Requester Names Differ"));
iStep->SetTestStepResult(EFail);
}
}
else
{
/**
* Notifier validation here
* -Requestor Id should be max32 characters
* -Client name should be max64 Characters
* -The first 32/64 or less characters of each should match.
* testApiClient is longest, testNotifClientName comes back from notifier and SHOULD be truncated
*/
//.........这里部分代码省略.........