本文整理汇总了C++中HBufC8::CompareF方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC8::CompareF方法的具体用法?C++ HBufC8::CompareF怎么用?C++ HBufC8::CompareF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC8
的用法示例。
在下文中一共展示了HBufC8::CompareF方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HasHeaderValueL
// -----------------------------------------------------------------------------
// MceSip::HasHeaderValueL
// -----------------------------------------------------------------------------
//
TBool MceSip::HasHeaderValueL( const RPointerArray<CSIPHeaderBase>& aHeaders,
TInt aHeaderName,
const TDesC8& aHeaderValue )
{
TBool found = EFalse;
CSIPHeaderBase* header = NULL;
for ( TInt i=0; i < aHeaders.Count() && !found; i++ )
{
header = aHeaders[i];
if ( header->Name() == SIPStrings::StringF( aHeaderName ) )
{
HBufC8* value = header->ToTextValueL();
if ( value->CompareF( aHeaderValue ) == 0 )
{
found = ETrue;
}
delete value;
}
if ( !found )
{
header = NULL;
}
}
return found;
}
示例2: testDate
void CConvertToRfc1123FormTest::DoTestsL()
{
TInt ii;
for (ii=0; ii< KInvalidTimeNumTests; ++ii)
{
TInternetDate date;
TRAPD( error, date.SetDateL(KInvalidTimeTestCases[ii]));
if (error && error != KErrCorrupt)
{
User::LeaveIfError(error);
}
}
for (ii=0; ii < KNumberDEF126191TestCases; ++ii)
{
TInternetDate internetDate;
_LIT(KTest, "Test for fix DEF126191 - Case: ");
TInternetDateOffsetTestCase tc = KDEF126191TestCases[ii];
TBuf<512> testName;
testName.Append(KTest);
TPtrC8 testDate( tc.iTextInput );
TBuf<150> bufTestDate;
bufTestDate.Copy(testDate);
testName.Append(bufTestDate);
_LIT(KTestExpected, "\n \t \t \t \t And Expected Result is: ");
testName.Append(KTestExpected);
TPtrC8 expectedTestDate( tc.iExpectedOutput );
TBuf<150> bufExpectedTestDate;
bufExpectedTestDate.Copy(expectedTestDate);
testName.Append(bufExpectedTestDate);
iTestHarness->StartTestL(testName);
TInt err = 0;
internetDate.SetDateL(tc.iTextInput);
TDateTime parsedDate = internetDate.DateTime();
TInternetDate ConvertparsedDate(parsedDate);
HBufC8* textDate = ConvertparsedDate.InternetDateTimeL(TInternetDate::ERfc1123Format);
CleanupStack::PushL(textDate);
TBuf8 <50> KExpcted;
KExpcted.Copy(tc.iExpectedOutput);
if(textDate->CompareF(KExpcted) != 0)
{
err = KErrBadDescriptor;
}
CleanupStack::PopAndDestroy(textDate);
iTestHarness->EndTest(err);
}
for (ii=0; ii< KNumberRfc1123GMTTzTestCases; ++ii)
{
TInternetDateTestCase tc = KRfc1123GMTTzTestCases[ii];
TDateTime time(tc.iYear, tc.iMonth, tc.iDay, tc.iHour, tc.iMin, tc.iSecond, 0);
TPtrC8 expected(tc.iTextFormat);
ConvertTestL(time, expected);
}
for (ii=0; ii< KNumberINC090613TestCases; ++ii)
{
TInternetDate date;
_LIT(KTest, "Test for fix INC090613 - Case: ");
TBuf<256> testname;
testname.Append(KTest);
TPtrC8 testdate(KINC090613TestCases[ii]);
TBuf<150> buftestdate;
buftestdate.Copy(testdate);
testname.Append(buftestdate);
iTestHarness->StartTestL(testname);
TRAPD(err,date.SetDateL(KINC090613TestCases[ii]));
iTestHarness->EndTest(err);
User::LeaveIfError(err);
}
for (ii=0; ii< KNumberINC107382TestCases; ++ii)
{
TInternetDate date;
_LIT(KTest, "Test for fix INC107382 - Case: ");
TBuf<256> testname;
testname.Append(KTest);
TPtrC8 testdate(KINC107382TestCases[ii]);
TBuf<150> buftestdate;
buftestdate.Copy(testdate);
testname.Append(buftestdate);
iTestHarness->StartTestL(testname);
TRAPD(err,date.SetDateL(KINC107382TestCases[ii]));
iTestHarness->EndTest(err);
User::LeaveIfError(err);
}
for (ii=0; ii< KInvalidDescriptorToIntTests; ++ii)
{
_LIT(KTest, "Test for fix DEF138868 - Case: ");
TBuf<256> testname;
testname.Append(KTest);
TPtrC8 testInput(KInvalidDesToIntTestCases[ii]);
TBuf<150> buftestInput;
//.........这里部分代码省略.........
示例3: IsAssigmentAcceptableL
void CPolicyManager::IsAssigmentAcceptableL( CElementBase * aParentElement, CElementBase * aElement, TBool aNewElement)
{
RDEBUG("CPolicyManager::IsAssigmentAcceptableL");
using namespace PolicyLanguage::Constants;
using namespace AttributeContainerHelper;
using namespace PolicyLanguage::NativeLanguage::AttributeValues;
//return if policy check is not needed
NO_POLICY_CHECK_RETURN;
RDEBUG_3("CPolicyManager: Parent element (%d) element (%d)", aParentElement->GetId(), aElement->GetId());
HBufC8* extId = aParentElement->ExternalId();
TInt match = extId->CompareF( PolicyLanguage::Constants::RolesMappingPolicy );
if( (match == 0) && aNewElement )
{
RDEBUG("CPolicyManager: Parent element is RolesMappingPolicy. Adding trust for server");
TInt rolesElements = aParentElement->GetChildElementCountL();
RDEBUG_2("CPolicyManager: rolesElements count (%d)", rolesElements);
if( rolesElements >= 1 )
{
RDEBUG("CPolicyManager: Trust already exists");
iMsg = ManagementErrors::AccessDenied;
User::Leave( KErrPolicyManager);
}
RDEBUG("CPolicyManager: No trust created yet");
}
//setup request context
iPolicyProcessor->ResetRequestContext();
iPolicyProcessor->SetTargetElement( aElement);
iPolicyProcessor->SetSessionTrust( iTrustedSession);
//attribute list for request attributes
RAttributeContainer attributes;
CleanupClosePushL( attributes);
//action attributes for meta_policy_Set
if ( aNewElement)
{
attributes.AppendL( EActionAttributes, CAttribute::NewL( PolicyEngineXACML::KActionId, AddPolicy, StringDataType));
}
else
{
attributes.AppendL( EActionAttributes, CAttribute::NewL( PolicyEngineXACML::KActionId, ReplacePolicy, StringDataType));
}
//Trusted subject is either trustedsubject of session or trustedsubject used in element to be added.
//In a cases where new element contains trustedsubject, it is used. Other cases sessions trustedsubject
//Get new element subjectmatch-elements
RElementArray subjectMatches;
CleanupClosePushL( subjectMatches);
aElement->FindAttributesL( ESubjectMatch, subjectMatches);
//util variables
TPtrC8 trustedSubject( KNullDesC8);
TBool oneTrustedSubject = EFalse;
//add trusted subject from target element
for ( TInt i(0); i < subjectMatches.Count(); i++)
{
CMatchObject* subjectMatch = (CMatchObject*) subjectMatches[i];
//check attribute id (Certificate id is also trusted subject!)
TPtrC8 attributeId = subjectMatch->AttributeDesignator()->GetAttributeid();
if ( attributeId == PolicyEngineXACML::KTrustedSubject || attributeId == PolicyEngineXACML::KCertificate )
{
//Only one target policy is valid
if ( oneTrustedSubject && trustedSubject.Compare( subjectMatch->AttributeValue()->Data()->Value()) != 0)
{
iMsg = ParserErrors::InvalidElement;
User::Leave( KErrPolicyManager);
}
oneTrustedSubject = ETrue;
//add trusted subject to attribute list
trustedSubject.Set( subjectMatch->AttributeValue()->Data()->Value());
//certificates have to be transformed to CASN form
if ( attributeId == PolicyEngineXACML::KCertificate)
{
//create CSubject info
CCertificateMaps::CSubjectInfo* info = new (ELeave) CCertificateMaps::CSubjectInfo();
CleanupStack::PushL( info);
//parse CASN info from certificate and add TargetTrustedSubject attribute with CASN value
CCertificateMaps::CreateSubjectInfoL( info, trustedSubject);
attributes.AppendL( ESubjectAttributes, CAttribute::NewL( TargetTrustedSubject, *info->iCASN, StringDataType));
CleanupStack::PopAndDestroy( info);
}
else
{
attributes.AppendL( ESubjectAttributes, CAttribute::NewL( TargetTrustedSubject, trustedSubject, StringDataType));
}
}
}
CleanupStack::PopAndDestroy( &subjectMatches); //subjectMatches
//.........这里部分代码省略.........