本文整理汇总了C++中TDesC16::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16::Compare方法的具体用法?C++ TDesC16::Compare怎么用?C++ TDesC16::Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC16
的用法示例。
在下文中一共展示了TDesC16::Compare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertEqualsL
// Check equality of the contents of two 16-bit descriptors
void CTestCase::AssertEqualsL (const TDesC16& aExpected,
const TDesC16& aActual,
TInt aLineNumber,
const TDesC8& aFileName)
{
if (aExpected.Compare(aActual) != 0)
{
AllocFailureSimulation(EFalse);
HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
AssertFailureToTlsL(*msg,aLineNumber,aFileName);
CleanupStack::PopAndDestroy(); // msg
User::Leave (KErrCppUnitAssertionFailed);
}
}
示例2: number
TBool CUT_PBASE_T_USBDI_0486::CheckSN(const TDesC16& aSerialNumberGot, const TDesC& aExpectedSerialNumber)
{
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0486_CHECKSN_ENTRY, this );
TBool areSNsIdenticals = (aSerialNumberGot.Compare(aExpectedSerialNumber) == 0);
if(!areSNsIdenticals)
{
// Incorrect device for this test case
OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_CHECKSN, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
KErrNotFound,aSerialNumberGot, aExpectedSerialNumber);
}
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0486_CHECKSN_EXIT, this, areSNsIdenticals );
return areSNsIdenticals;
}
示例3: SipLogError
//
//
// SIP Uri Logger
//
//
void CSipUriAndAuthorityTest::SipLogError(TInt aError, const TDesC16& aSipUri) const
{
TBool wrongError=EFalse;
//compare the Equivalent SIP URI to look for the correct error, these SIP URIs must be in T_UriParserSipUri.txt
//All equal
if (0==aSipUri.Compare(KCompsSipUriEqual0) && KErrNone != aError
|| 0==aSipUri.Compare(KCompsSipUriEqual1) && KErrNone != aError
|| 0==aSipUri.Compare(KCompsSipUriEqual2) && KErrNone != aError)
{
iTestHarness->LogIt(KCompsSipUriValidMess0);
wrongError=ETrue;
}
//All not equal
if (0==aSipUri.Compare(KCompsSipUriNotEqual0) && KUriUtilsErrDifferentUserInfo == aError
|| 0==aSipUri.Compare(KCompsSipUriNotEqual1) && KUriUtilsErrDifferentPath == aError
|| 0==aSipUri.Compare(KCompsSipUriNotEqual2) && KUriUtilsErrDifferentPort == aError )
{
iTestHarness->LogIt(KCompsSipUriEqualMess1);
}
//compare the SIP URIs to look for the correct error returned by CUri for validation
if (0==aSipUri.Compare(KCompsSipUriNotEqual1) && KUriUtilsErrDifferentPath != aError )
{
iTestHarness->LogIt(KCompsSipUriInvalidMess9);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriValid0) && KErrNone!= aError
|| 0==aSipUri.Compare(KCompsSipUriValid1) && KErrNone!= aError)
{
iTestHarness->LogIt(KCompsSipUriValidMess0);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriInvalid0) && KErrNotSupported != aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess0);
wrongError=ETrue;
}
if( 0==aSipUri.Compare(KCompsSipUriInvalid5) && KUriUtilsErrInvalidParam!= aError
|| 0==aSipUri.Compare(KCompsSipUriInvalid6) && KUriUtilsErrInvalidParam!= aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess1);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriInvalid3) && KUriUtilsErrInvalidHost!= aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess2);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriInvalid2) && KUriUtilsErrInvalidHeaders != aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess8);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriInvalid1) && KUriUtilsErrInvalidPort != aError
|| 0==aSipUri.Compare(KCompsSipUriInvalid4) && KUriUtilsErrInvalidPort!= aError
|| 0==aSipUri.Compare(KCompsSipUriNotEqual2) && KUriUtilsErrDifferentPort != aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess3);
wrongError=ETrue;
}
if (0==aSipUri.Compare(KCompsSipUriInvalid7) && KUriUtilsErrInvalidUserInfo!= aError
|| 0==aSipUri.Compare(KCompsSipUriNotEqual0) && KUriUtilsErrDifferentUserInfo != aError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess7);
wrongError=ETrue;
}
if (wrongError)
{
iTestHarness->LogIt(KCompsSipUriInvalidMess5);
}
LogErrorMessage(aSipUri, aError);
if (wrongError)
{
iTestHarness->EndTest(aError);
}
else
{
iTestHarness->EndTest(KErrNone);
}
}