本文整理汇总了C++中HBufC8::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC8::Compare方法的具体用法?C++ HBufC8::Compare怎么用?C++ HBufC8::Compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC8
的用法示例。
在下文中一共展示了HBufC8::Compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dmMatcherURIFromIAPIdL
TInt Ctreemoduleapi::dmMatcherURIFromIAPIdL()
{
CMSmlDmCallbackTest* callBack = CMSmlDmCallbackTest::NewL();
CleanupStack::PushL(callBack);
CNSmlDMIAPMatcher* dmMatcher = NULL;
dmMatcher = CNSmlDMIAPMatcher::NewLC(callBack);
// _LIT8(KaURI,"./AP/NTMSAP2194660/NAPDef");
_LIT8(KaURI,"AP/NTMSAP2194660");
TBufC8<30> aURI( KaURI );
//TPtr8 ptruri = aURI->Des();
TInt retluid = dmMatcher->IAPIdFromURIL( aURI ); //ptruri);
// TInt luid = 10;
HBufC8* retURI = dmMatcher->URIFromIAPIdL( retluid );
if ( !retURI->Compare(aURI))
{
CleanupStack::PopAndDestroy(dmMatcher);
CleanupStack::PopAndDestroy(callBack);
return KErrGeneral;
}
CleanupStack::PopAndDestroy(dmMatcher);
CleanupStack::PopAndDestroy(callBack);
return KErrNone;
}
示例2: FindRtNodeInStoreL
TBool CDmAdEngine::FindRtNodeInStoreL(const TDesC8& aLuid, const TDesC8& aUri)
{
TRACE("CDmAdEngine::FindRtNodeInStoreL");
TBool ret = EFalse;
if (iDdfApi->IsTopLevelRtNode(aUri))
{
ret = iStoreApi->FindRtNodeL(aLuid, aUri);
}
else
{
HBufC8* parentRtNodeLuid = ParentRtNodeLuidForRtNodeLC(aUri);
if (parentRtNodeLuid->Compare(aLuid) == 0)
{
ret = EFalse;
}
else
{
ret = iStoreApi->FindRtNodeL(aLuid, aUri);
}
CleanupStack::PopAndDestroy(); //parentRtNodeLuid
}
return ret;
}
示例3: GetStoreTypeL
TPkiServiceStoreType CPolicyImporter::GetStoreTypeL(CIkeData* aData)
{
TPkiServiceStoreType ret(EPkiStoreTypeAny);
if (aData->iClientCertType)
{
HBufC8* storename = aData->iClientCertType->GetAsciiDataL();
CleanupStack::PushL(storename);
LOG(Log::Printf(_L8("CPolicyImporter::BuildPeerCertListL() Store type defined in policy: %S\n"), &(*storename)));
if (storename->Compare(_L8("DEVICE")) == 0)
{
LOG_("CPolicyImporter::BuildPeerCertListL() Policy uses DEVICE store\n");
ret = EPkiStoreTypeDevice;
}
else
{
LOG_("CPolicyImporter::BuildPeerCertListL() Policy uses USER store\n");
ret = EPkiStoreTypeUser;
}
CleanupStack::PopAndDestroy(storename);
}
else
{
LOG_("CPolicyImporter::GetStoreType() No store type specified in policy");
}
return ret;
}
示例4: main
int main()
{
__UHEAP_MARK;
{
int retval[10];
_LIT8(KTxt, "HelloHello");
HBufC8* buffer = HBufC8::NewL(10);
*buffer = KTxt;
wstring myWstring(L"gfsdfdufhuhfhfsfsfsdf");
retval[0] = Hbufc8ToWstring(buffer,myWstring);
TPtrC8 myTptr8(KTxt);
char* temp = new char[30];
retval[2] = WstringToTptrc8(myWstring,temp,myTptr8);
char* myChar = new char[40];
int size = 40;
retval[3] = Tptrc8ToCharp(myTptr8,myChar,size);
TBufC8<30> buf8;
TPtr8 myTptr = buf8.Des();
retval[4] = CharpToTptr8(myChar,myTptr);
wchar_t* Wstr_fin = new wchar_t[36];
int size_char=36;
retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);
_LIT8(text_fin, "fgdsgfgdsg");
HBufC8* finBuffer = HBufC8::NewL(10);
*finBuffer = text_fin;
retval[6] = WcharToHbufc8(Wstr_fin,finBuffer);
for(int i=1; i<=6; i++)
{
if (retval[i]!= 0)
printf("Conversion failed for retval\n",retval[i]);
}
if(!buffer->Compare(finBuffer->Des()))
{
printf("\n\nintegration_test_scenario26 case passed");
}
else
{
printf("\n\nintegration_test_scenario26 case failed");
assert_failed = true;
}
delete buffer;
delete[] temp;
delete[] myChar;
delete[] Wstr_fin;
delete finBuffer;
}
__UHEAP_MARKEND;
testResultXml("integration_test_scenario26");
return 0;
}
示例5: VerifyL
// InverseSignLC is replaced by shim. So, VerifyL also can not be used properly, hence excluded from coverage.
EXPORT_C TBool CRSAVerifier::VerifyL(const TDesC8& aInput, const CRSASignature& aSignature) const
{
TBool retval = EFalse;
HBufC8* inverseSign = InverseSignLC(aSignature);
if (inverseSign->Compare(aInput)==0)
{
retval = ETrue;
}
CleanupStack::PopAndDestroy(inverseSign);
return retval;
}
示例6: DrmDownloadL
// -----------------------------------------------------------------------------
// CDownloadUtils::DrmDownloadL
// -----------------------------------------------------------------------------
//
TBool CDownloadUtils::DrmDownloadL( RHttpDownload& aDownload )
{
CLOG_ENTERFN("CDownloadUtils::DrmDownloadL");
TBool isDrmDownload( EFalse );
HBufC8* contentType = HBufC8::NewLC( KMaxContentTypeLength );
TPtr8 temp( contentType->Des() );
User::LeaveIfError( aDownload.GetStringAttribute( EDlAttrContentType, temp ) );
CLOG_WRITE(" EDlAttrContentType got");
if( !contentType->Compare(KOma1DrmMessageContentType) ||
!contentType->Compare(KOma1DcfContentType) ||
!contentType->Compare(KOma2DcfContentType) )
{
isDrmDownload = ETrue;
}
CleanupStack::PopAndDestroy( contentType );
CLOG_WRITE_FORMAT(" ret: %d",isDrmDownload);
CLOG_LEAVEFN("CDownloadUtils::DrmDownloadL");
return isDrmDownload;
}
示例7:
void UT_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_EightyL( )
{
HBufC8* result = iAuthenticator->AuthenticateL(80, *iRFC2202_Test7_Key_640bits,
*iRFC2202_Test7_Data_73bits,
KNullDesC8);
CleanupStack::PushL(result);
EUNIT_ASSERT( result->Compare(*iRFC2202_Test7_Tag_80bits) == 0);
CleanupStack::Pop(result);
delete result;
}
示例8: VerifyL
void CRSAVerifierImpl::VerifyL(const TDesC8& aInput, const CCryptoParams& aSignature, TBool& aVerificationResult)
{
HBufC8* output = NULL;
InverseSignL(output, aSignature);
CleanupStack::PushL(output);
// is the original hash the same as the hash extracted from the signature
aVerificationResult = EFalse;
if (!output->Compare(aInput))
{
aVerificationResult = ETrue;
}
CleanupStack::PopAndDestroy(output);
}
示例9: ConfigKeyTestL
void CMceVideoCodecTest::ConfigKeyTestL()
{
CMceComVideoCodec* flatData =
static_cast<CMceComVideoCodec*>( iVideoCodec->iFlatData );
MCE_DELETE( flatData->iConfigKey );
HBufC8* configKey = iVideoCodec->ConfigKeyL();
EUNIT_ASSERT( configKey == NULL );
flatData->iConfigKey = KMceTestConfigKeyData().AllocL();
configKey = iVideoCodec->ConfigKeyL();
CleanupStack::PushL( configKey );
EUNIT_ASSERT_EQUALS( 0, configKey->Compare( KMceTestConfigKeyData ) );
CleanupStack::PopAndDestroy( configKey );
}
示例10: CheckConversionL
TBool RTestStepConvertAudio::CheckConversionL()
{
RFile outputFile; //output file
RFile refFile; //reference file
//open the files
User::LeaveIfError(outputFile.Open(iFs, iToFileName, EFileRead|EFileShareAny));
CleanupClosePushL(outputFile);
User::LeaveIfError(refFile.Open(iFs, iToFileName, EFileRead|EFileShareAny)); // this is changed because of fix for DEF145347 (TSW id : ESLM-844Q3G). As file size is changing everytime, we should compare with output file always
CleanupClosePushL(refFile);
TInt err = KErrNone;
//read contents of output file using file stream
RFileReadStream outputFileStream(outputFile, 0);
CleanupClosePushL(outputFileStream);
HBufC8* outputFileBuf = HBufC8::NewLC(KNumBytesToCompare);
TPtr8 outputData = outputFileBuf->Des();
TRAP(err, outputFileStream.ReadL(outputData));
if ((err != KErrNone) && (err != KErrEof))
{
User::Leave(err);
}
//read contents of reference file using file stream
RFileReadStream refFileStream(refFile, 0);
CleanupClosePushL(refFileStream);
HBufC8* refFileBuf = HBufC8::NewLC(KNumBytesToCompare);
TPtr8 refData = refFileBuf->Des();
TRAP(err, refFileStream.ReadL(refData))
if ((err != KErrNone) && (err != KErrEof))
{
User::Leave(err);
}
TInt result = refFileBuf->Compare(*outputFileBuf);
INFO_PRINTF2(_L("Result = %d"), result);
CleanupStack::PopAndDestroy(6, &outputFile);
return (result == 0);
}
示例11: DoDeleteObjectL
void CDmAdEngine::DoDeleteObjectL(const TDesC8& aUri, const TDesC8& aLuid, TInt aStatusRef)
{
TRACE("CDmAdEngine::DoDeleteObjectL");
if (aLuid.Length() == 0)
{
if (iDdfApi->IsNodeRtNodeL(aUri))
{
iCallBack->SetStatusL(aStatusRef, KErrNotFound);
return;
}
iDdfApi->NotRtNodeDeleteObjectL(aUri, aLuid, aStatusRef);
return;
}
/*
if (IsLeaf(aUri))
{
DMADERR(DmAdErr::Printf(_L("*** CDmAdEngine::DoDeleteObjectL: %d (line=%d)\n"), KDmAdErr1, __LINE__));
User::Leave(KErrGeneral);
}
*/
if (!iDdfApi->IsTopLevelRtNode(aUri))
{
HBufC8* parentRtNodeLuid = ParentRtNodeLuidForRtNodeLC(aUri);
if (parentRtNodeLuid->Compare(aLuid) == 0)
{
DEBUG_LOG(_L("Not found 1"));
User::Leave(KErrNotFound);
}
DEBUG_LOG(_L("Not found 2"));
User::Leave(KErrNotFound);
CleanupStack::PopAndDestroy(); //parentRtNodeLuid
}
iStoreApi->DeleteRtNodeL(aLuid, aUri);
iCallBack->SetStatusL(aStatusRef, KErrNone);
}
示例12: CompareFilesL
TVerdict CTestStepConvertOpen::CompareFilesL(const TDesC& aCreatedFilename, const TDesC& aExpectedFilename, TInt aLength)
{
TVerdict verdict = EPass;
TInt position = 0;
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
TInt err = KErrNone;
RFile file;
User::LeaveIfError(file.Open(fs, aCreatedFilename, EFileRead|EFileShareAny));
CleanupClosePushL(file);
TInt fileSize=0;
err = file.Size(fileSize);
if (err != KErrNone) User::LeaveIfError(err);
RFileReadStream fileReadStream(file, position);
CleanupClosePushL(fileReadStream);
//read data from created file into descriptor
HBufC8* createdBuffer = HBufC8::NewL(aLength);
CleanupStack::PushL(createdBuffer);
TPtr8 createdBufferPtr = createdBuffer->Des();
TRAP(err, fileReadStream.ReadL(createdBufferPtr));
if ((err != KErrNone) && (err != KErrEof)) User::LeaveIfError(err); //EOF not an error ?
RFile file2;
User::LeaveIfError(file2.Open(fs, aExpectedFilename, EFileRead|EFileShareAny));
CleanupClosePushL(file2);
TInt file2Size;
err = file2.Size(file2Size);
if (err != KErrNone) User::LeaveIfError(err);
if(fileSize != file2Size)
{
INFO_PRINTF3(_L("Resulting file sizes do not match %d != %d"), fileSize, file2Size);
verdict = EFail;
}
else
{
//check contents
RFileReadStream fileReadStream2(file2, position);
CleanupClosePushL(fileReadStream2);
//read data from expected file into descriptor
HBufC8* expectedBuffer = HBufC8::NewL(aLength);
CleanupStack::PushL(expectedBuffer);
TPtr8 expectedBufferPtr = expectedBuffer->Des();
TRAP(err, fileReadStream2.ReadL(expectedBufferPtr));
if ((err != KErrNone) && (err != KErrEof)) User::LeaveIfError(err); //EOF not an error ?
//compare expected buffer with the newly create buffer
TInt result = expectedBuffer->Compare(*createdBuffer);
if (result != 0)
{
INFO_PRINTF1(_L("Resulting file contents do not match"));
verdict = EFail;
}
}
CleanupStack::PopAndDestroy(7); //file, fs, fileReadStream, createdBuffer, file2, fileReadStream2, expectedBuffer
return verdict;
}
示例13: CertStatusL
//.........这里部分代码省略.........
//intermediate certificate level 2
HBufC* issuerName=CertIssuerNameL(*certData);
CleanupStack::PushL(issuerName);
subjectNameString=To8BitL(*issuerName);
CleanupStack::PopAndDestroy(issuerName);
CleanupStack::PopAndDestroy(certData);
certData=NULL;
certData = HBufC8::NewL(KExpectedMaxCertSize);
CleanupStack::PushL(certData);
certDataPtr = certData->Des();
CleanupStack::PushL(subjectNameString);
aPkiService.ReadCertificateL(KEmptyString, *subjectNameString, aRfc822NameFqdn, EPKICACertificate,
aPrivKeyLength, EPKIRSA, certDataPtr,
&opContext, status);
User::WaitForRequest(status);
aPkiService.Finalize(opContext);
if (status.Int() == KErrNone)
{
certStatus = PkiUtil::CertStatusL(*certData, aCertRenewalThreshold);
}
else
{
certStatus = ECertNotFound;
CleanupStack::PopAndDestroy(subjectNameString);
CleanupStack::PopAndDestroy(certData);
return certStatus;
}
if ( subjectNameString->Compare(aTrustedCaDn) !=0 ) //checking if issuer is reached
{
//intermediate certificate level 1
certStatus = ECertNotFound;
CleanupStack::PopAndDestroy(subjectNameString);
HBufC* issuerName=CertIssuerNameL(*certData);
CleanupStack::PushL(issuerName);
subjectNameString=To8BitL(*issuerName);
CleanupStack::PopAndDestroy(issuerName);
CleanupStack::PopAndDestroy(certData);
certData = HBufC8::NewL(KExpectedMaxCertSize);
CleanupStack::PushL(certData);
certDataPtr = certData->Des();
CleanupStack::PushL(subjectNameString);
aPkiService.ReadCertificateL(KEmptyString, *subjectNameString, aRfc822NameFqdn, EPKICACertificate,
aPrivKeyLength, EPKIRSA, certDataPtr,
&opContext, status);
User::WaitForRequest(status);
aPkiService.Finalize(opContext);
if (status.Int() == KErrNone)
{
certStatus = PkiUtil::CertStatusL(*certData, aCertRenewalThreshold);
}
else
{
certStatus = ECertNotFound;
示例14: ParseData
// -----------------------------------------------------------------------------
// parse passed data
// ID + RETURN or LEAVE has to be found
// -----------------------------------------------------------------------------
//
TBool CConfigurationHandler::ParseData( TDesC8& aData,
CONFIGURATION_ITEM& aItem )
{
// get value for ID=
HBufC8* id = GetTokenValue(aData, KId);
if( !id )
{
RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData ID= not found") );
delete id;
return EFalse;
}
// store index to action array
aItem.iActionIndex = FindActionIndex(*id);
delete id;
// get value for TYPE=
HBufC8* type = GetTokenValue(aData, KType);
if( !type )
{
RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData TYPE= not found") );
delete type;
return EFalse;
}
// todo is numeric check when needed
// get value for RETURN=
aItem.iIsLeaveValue = EFalse;
HBufC8* strvalue = GetTokenValue(aData, KReturn);
if( !strvalue )
{
delete strvalue; strvalue = NULL;
// get value for LEAVE= as return value was not found
strvalue = GetTokenValue(aData, KLeave);
aItem.iIsLeaveValue = ETrue;
}
if( !strvalue )
{
RDebug::Print(_L("[TESTPLUGIN] CConfigurationHandler::ParseData: No RETURN= or LEAVE= found") );
return EFalse;
}
// optional parameter
HBufC8* persistant = GetTokenValue(aData, KPersistant );
if( persistant )
{
TBool b;
TLex8 l(*persistant);
l.Val(b);
aItem.iIsPersistant = b;
}
else
{
aItem.iIsPersistant = EFalse;
}
delete persistant;
if( type->Compare(_L8("TInt"))==KErrNone )
{
TInt v = 0;
TLex8 lex(*strvalue);
lex.Val(v);
aItem.iValuePtr = new TInt(v);
}
else if( type->Compare(_L8("TUint"))==KErrNone )
{
TUint v = 0;
TLex8 lex(*strvalue);
lex.Val(v);
aItem.iValuePtr = new TUint(v);
}
else if( type->Compare(_L8("TUid"))==KErrNone )
{
TInt v = 0;
TLex8 lex(*strvalue);
lex.Val(v);
TUid u;
u.iUid = v;
aItem.iValuePtr = new TUid(u);
}
else if( type->Compare(_L8("TBool"))==KErrNone )
{
TBool b;
TLex8 l(*strvalue);
l.Val(b);
aItem.iValuePtr = new TBool(b);
}
else if( type->Compare(_L8("TDesC8"))==KErrNone )
{
HBufC8* buf = HBufC8::NewL(strvalue->Length());
//.........这里部分代码省略.........
示例15: TestStepResult
// Step 3 Content
TVerdict CTPKCS7ContentTest::doTestStepL()
{
if (TestStepResult() != EPass)
{
return TestStepResult();
}
TBool checkType;
TBool checkLength;
TBool checkContent;
TInt expectedType;
TInt expectedLength;
TPtrC expectedString;
HBufC8 * expectedContent = NULL;
checkType = GetIntFromConfig (ConfigSection(),_L("ContentType"), expectedType);
checkLength = GetIntFromConfig (ConfigSection(),_L("ContentLength"), expectedLength);
checkContent = GetStringFromConfig(ConfigSection(),_L("ContentString"), expectedString);
if (checkContent)
{
if (expectedString.Length() & 1)
{
SetTestStepResult(ETestSuiteError);
INFO_PRINTF1(_L("ContentString is not a multiple of 2 long"));
checkContent = EFalse;
}
else
{
// workaround to parse the expectedstring
expectedContent = HBufC8::NewLC (expectedString.Length()/2);
TPtr8 des = expectedContent->Des ();
for (TInt i = 0; i < expectedString.Length()/2; i++)
{
TInt top = expectedString[2*i];
TInt low = expectedString[2*i+1];
if (top >= 0x61) top -= (0x61-10);
else top -= 0x30;
if (low >= 0x61) low -= (0x61-10);
else low -= 0x30;
des.Append (top*16+low);
}
}
}
TInt err;
CPKCS7ContentInfo * contentInfo = NULL;
TRAP (err, contentInfo = CPKCS7ContentInfo::NewL(iRawData->Des()));
if(err == KErrNone)
{
CPKCS7SignedObject * p7 = NULL;
if( contentInfo->ContentType() == 2)
{
TRAPD (err, p7 = CPKCS7SignedObject::NewL(*contentInfo));
if (err != KErrNone)
{
SetTestStepResult(EFail);
INFO_PRINTF2(_L("Got %d building PKCS7 object"), err);
}
else
{
CleanupStack::PushL (p7);
const CPKCS7ContentInfo& p7info = p7->ContentInfo ();
if (checkType)
{
if (p7info.ContentType() != expectedType)
{
SetTestStepResult(EFail);
INFO_PRINTF3(_L("Expected ContentType %d, got %d"), expectedType, p7info.ContentType());
}
}
const TDesC8& content = p7info.ContentData();
if (checkLength)
{
if (content.Length() != expectedLength)
{
SetTestStepResult(EFail);
INFO_PRINTF3(_L("Expected ContentLength %d, got %d"), expectedLength, content.Length());
}
}
if (checkContent)
{
if (content.Length() != expectedContent->Length())
{
SetTestStepResult(EFail);
INFO_PRINTF3(_L("Expected ContentString length %d does not correspond to PKCS7 data length %d"),
expectedContent->Length(), content.Length());
}
else
{
if (expectedContent->Compare(content) != 0)
{
SetTestStepResult(EFail);
INFO_PRINTF1(_L("Expected ContentString does not match PKCS7 content"));
}
}
}
//.........这里部分代码省略.........