本文整理汇总了C++中HBufC::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC::Compare方法的具体用法?C++ HBufC::Compare怎么用?C++ HBufC::Compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC
的用法示例。
在下文中一共展示了HBufC::Compare方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestPhoneCurrentValueTextLC
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestPhoneCurrentValueTextLC
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestPhoneCurrentValueTextLC( CStifItemParser& /*aItem*/ )
{
CAknQueryValuePhone* valuePhone = CAknQueryValuePhone::NewLC();
STIF_ASSERT_NOT_NULL( valuePhone );
CAknQueryValuePhoneArray* array = CAknQueryValuePhoneArray::NewLC();
STIF_ASSERT_NOT_NULL( array );
CDesCArray* textArray = new (ELeave) CDesCArrayFlat( 1 );
CleanupStack::PushL( textArray );
_LIT( KValue, "123456" );
textArray->AppendL( KValue );
array->SetArray( *textArray );
valuePhone->SetArrayL( array );
valuePhone->SetCurrentValueIndex( 0 );
HBufC* value = valuePhone->CurrentValueTextLC();
STIF_ASSERT_TRUE( value->Compare( KValue ) == 0 );
CleanupStack::PopAndDestroy( value );
CleanupStack::PopAndDestroy( textArray );
CleanupStack::PopAndDestroy( array );
CleanupStack::PopAndDestroy( valuePhone );
return KErrNone;
}
示例2: FLOG
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::RefreshL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::RefreshL( TBool aPreserveSelectedItem,
TBool& aSelectedItemChanged, TInt aMoreRefreshesExpected )
{
FLOG( "CAppMngr2ListContainer::RefreshL( %d )", aPreserveSelectedItem );
// Record the item text of the current item if selection must be preserved in
// the current item. The item text is used to identify the item later, so that
// it can be selected again.
HBufC* itemText = NULL;
TInt currentItemIndex = iListBox->CurrentItemIndex();
if( aPreserveSelectedItem && currentItemIndex >= 0 )
{
itemText = (*iItemArray)[ currentItemIndex ].AllocL();
CleanupStack::PushL( itemText );
}
SetEmptyTextL( aMoreRefreshesExpected ); // defines empty text in first refresh
CreateItemArrayL(); // resets the item array
PopulateItemArrayL(); // fills in new items
iListBox->HandleItemAdditionL(); // re-calculates size and scrollbar
// If selection must be preserved, search the item in new item array
// and select it again. Make sure to delete itemText if it was allocated.
TBool currentItemSet = EFalse;
TInt itemCount = iItemArray->Count();
if( itemText )
{
for( TInt index = 0; index < itemCount && !currentItemSet; index++ )
{
if( itemText->Compare( (*iItemArray)[ index ] ) == 0 )
{
iListBox->SetCurrentItemIndex( index );
currentItemSet = ETrue;
}
}
CleanupStack::PopAndDestroy( itemText );
}
// If item is not found (it may have been deleted), then tell to the
// caller that the selected item was changed and select another item
// from the same row number than the previously selected item.
aSelectedItemChanged = !currentItemSet;
if( aSelectedItemChanged )
{
if( currentItemIndex >= itemCount )
{
currentItemIndex = itemCount - 1;
}
if( currentItemIndex < 0 )
{
currentItemIndex = 0;
}
if( currentItemIndex != iListBox->CurrentItemIndex() )
{
iListBox->SetCurrentItemIndex( currentItemIndex );
}
}
}
示例3: ExecuteActionL
void CMtfTestActionVerifyAttachmentInfo::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionVerifyAttachmentInfo);
CMsvAttachment* attachmentInfo = ObtainParameterReferenceL<CMsvAttachment>(TestCase(),ActionParameters().Parameter(0));
HBufC* paramFileName = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(1));
TInt paramFileSize = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
HBufC* paramMimeType = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3));
TestCase().INFO_PRINTF1(_L("VerifyAttachmentInfo....."));
TestCase().INFO_PRINTF2(_L("Attachment Name - %S"), &attachmentInfo->AttachmentName());
TestCase().INFO_PRINTF2(_L("Size - %d"), attachmentInfo->Size());
TBuf<KMimeTypeLength> mimeType;
mimeType.Copy(attachmentInfo->MimeType());
TestCase().INFO_PRINTF2(_L("MimeType - %S"), &mimeType);
TestCase().INFO_PRINTF1(_L("With.."));
TestCase().INFO_PRINTF2(_L("Attachment Name - %S"), paramFileName);
TestCase().INFO_PRINTF2(_L("Size - %d"), paramFileSize);
TestCase().INFO_PRINTF2(_L("MimeType - %S"), paramMimeType);
if (
(paramFileName->Compare(attachmentInfo->AttachmentName()) == 0) &&
(paramMimeType->Compare(mimeType) == 0) &&
(paramFileSize == attachmentInfo->Size())
)
{
}
else
{
User::Leave(KErrGeneral);
}
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionVerifyAttachmentInfo);
TestCase().ActionCompletedL(*this);
}
示例4:
// -----------------------------------------------------------------------------
// CSTSMidletInfo::DomainOIDL
// Getter for domain OID value
// -----------------------------------------------------------------------------
const TDesC& CSTSMidletInfo::DomainOID()
{
TBufC16<KSTSDomNameLength> buf1(KDom);
HBufC* domain = buf1.AllocLC();
if (domain->Compare(iDomain->Des()))
{
TBufC<KSTSDomainOperatorLength> buf2(KSTSDomainOperator);
HBufC* tmp = buf2.AllocL();
delete iDomainOID;
iDomainOID = tmp;
}
else
{
//at this point this is not needed, because oid value is not
//specified anywhere
}
return *iDomainOID;
}
示例5: TestCase
void CMtfTestActionCreatePop3Service::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreatePop3Service);
// need to create an account in the central repository and make it the default account
HBufC* paramAccountName = ObtainParameterReferenceL<HBufC>( TestCase(),ActionParameters().Parameter(6) );
HBufC* settingsFile = ObtainParameterReferenceL<HBufC>( TestCase(),ActionParameters().Parameter(7) );
CEmailAccounts *emailAccounts = CEmailAccounts::NewLC();
CImIAPPreferences *smtpPrefs = CImIAPPreferences::NewLC();
CImSmtpSettings *smtpSettings = new (ELeave) CImSmtpSettings;
CleanupStack::PushL(smtpSettings);
CImIAPPreferences *popPrefs = CImIAPPreferences::NewLC();
CImPop3Settings *popSettings = new (ELeave) CImPop3Settings;
CleanupStack::PushL(popSettings);
emailAccounts->PopulateDefaultPopSettingsL(*popSettings, *popPrefs);
emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpPrefs );
if( settingsFile->Compare( _L("none") ) != 0 )
{
CMtfTestActionUtilsPopScripts::ReadPopSettingsFromConfigurationFileL(
TestCase(), settingsFile->Des(), *popSettings, *popPrefs, *smtpSettings, *smtpPrefs);
}
TPopAccount popAccount = emailAccounts->CreatePopAccountL(paramAccountName->Des(), *popSettings, *popPrefs, EFalse);
TSmtpAccount smtpAccount = emailAccounts->CreateSmtpAccountL(popAccount, *smtpSettings, *smtpPrefs, EFalse);
emailAccounts->SetDefaultSmtpAccountL(smtpAccount);
// need to obtain the service id from the account details and save this as the service id
TMsvId paramServiceId = popAccount.iPopService;
CleanupStack::PopAndDestroy(5, emailAccounts); // popSettings, popPrefs, smtpSettings, smtpPrefs, emailAccounts
StoreParameterL<TMsvId>( TestCase(),paramServiceId, ActionParameters().Parameter(8) );
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreatePop3Service);
TestCase().ActionCompletedL(*this);
}
示例6: ParseUriTests16BitL
void ParseUriTests16BitL()
{
test.Next(_L("Parsing 16 bit URIs"));
gFullUri16.Copy(KUri0);
CUri8* uri = UriUtils::CreateUriL(gFullUri16);
CleanupStack::PushL(uri);
gUriComponent16.Copy(KScheme0);
HBufC* text = uri->Uri().DisplayFormL(EUriScheme);
TInt result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentScheme;
delete text;
User::LeaveIfError(result);
gUriComponent16.Copy(KUserInfo0);
text = uri->Uri().DisplayFormL(EUriUserinfo);
result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentUserInfo;
delete text;
User::LeaveIfError(result);
gUriComponent16.Copy(KHost0);
text = uri->Uri().DisplayFormL(EUriHost);
result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentHost;
delete text;
User::LeaveIfError(result);
gUriComponent16.Copy(KPort0);
text = uri->Uri().DisplayFormL(EUriPort);
result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentPort;
delete text;
User::LeaveIfError(result);
gUriComponent16.Copy(KParams0);
text = uri->Uri().DisplayFormL(EUriPath);
result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentPath;
delete text;
User::LeaveIfError(result);
gUriComponent16.Copy(KHeaders0);
text = uri->Uri().DisplayFormL(EUriQuery);
result = text->Compare(gUriComponent16) == 0? KErrNone : KUriUtilsErrDifferentQuery;
delete text;
User::LeaveIfError(result);
CleanupStack::PopAndDestroy(uri);
}
示例7: HandleChildElement
void CHandleOutSearch::HandleChildElement(TiXmlNode* aElement)
{
TInt index=iPointArray.Count()-1;
TInt itemIndex=iPointArray[index]->GetItemCount()-1;
if(itemIndex<0)
{
iPointArray[index]->CreatNewItem();
itemIndex=0;
}
if(aElement->NoChildren())
{
if(iFlag)
{
HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->Value()));
CleanupStack::PushL(buf);
if(buf->Compare(_L("br"))==0)
{
if(!iPointArray[index]->GetItem(itemIndex).IsNull())
iPointArray[index]->CreatNewItem();
}
if(buf->Compare(_L("br"))!=0&&buf->Compare(_L("img"))!=0&&buf->Compare(_L("input"))!=0&&buf->Compare(_L("|"))!=0)
{
if(buf->Left(2).Compare(_L("--"))==0)
{
TInt f=0;
for(TInt i=0;i<buf->Length();i++)
{
if(buf->Mid(i,1).Compare(_L("-"))!=0)
{
f=1;
break;
}
}
if(f==0)
{
iFlag=EFalse;
}
}
if(iFlag)
iPointArray[index]->GetItem(itemIndex).SetName(*buf);
else
{
if(!iPointArray[index]->GetItem(itemIndex).IsNull())
iPointArray[index]->CreatNewItem();
}
}
iMainEngine.WriteLog16(*buf);
CleanupStack::PopAndDestroy(1);
}
}
else
{
HBufC8* tag=TPtrC8((const TUint8*)aElement->Value()).Alloc();
CleanupStack::PushL(tag);
TInt value=CheckTag(*tag);
CleanupStack::PopAndDestroy(1);
if(value>0)
{
switch(value)
{
case 1: //P±êÇ©
{
TiXmlNode* element=aElement->FirstChild();
while(element!=0)
{
HandleChildElement(element);
element=element->NextSibling();
}
}
break;
case 2: //Á¬½Ó±êÇ©
{
HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc();
CleanupStack::PushL(bufUrl);
TInt urlFlag=CheckUrl(*bufUrl);
if(urlFlag>0)
{
iPointArray[index]->GetItem(itemIndex).SetUrl(*bufUrl);
}
CleanupStack::PopAndDestroy(1);
if(urlFlag==1||urlFlag==2)
{
HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value()));
CleanupStack::PushL(buf);
iPointArray[index]->GetItem(itemIndex).SetName(*buf);
iMainEngine.WriteLog16(*buf);
CleanupStack::PopAndDestroy(1);
iPointArray[index]->GetItem(itemIndex).SetIsLink(ETrue);
iPointArray[index]->CreatNewItem();
}
else
//.........这里部分代码省略.........
示例8: StringCompare
TInt StringCompare(const HBufC& aLeft, const HBufC& aRight)
{
return aLeft.Compare(aRight);
}
示例9: StoreFileL
// -----------------------------------------------------------------------------
// StoreFile()
// save file info into database
// -----------------------------------------------------------------------------
//
void CDcfRepSrv::StoreFileL(const TDesC& aFile , TInt aType)
{
#ifdef _DRM_TESTING
WriteL(_L8("StoreFileL"));
#endif
RFile f;
User::LeaveIfError(f.Open(iFs,aFile,EFileRead|EFileShareReadersOrWriters));
CleanupClosePushL(f);
TInt i = 0;
TInt setTtid = -1;
HBufC16* cid = NULL;
HBufC16* ttid = NULL;
HBufC16* group = NULL;
if (aType == EOma1Dcf)
{
COma1Dcf* d = COma1Dcf::NewL(f);
CleanupStack::PushL(d);
User::LeaveIfError( From8To16( *(d->iContentID) , cid ) );
CleanupStack::PopAndDestroy(d);
CleanupStack::PushL(cid);
ttid = HBufC::NewMaxLC(16);
*ttid = KNullDesC16;
UpdateDatabaseL(aFile , KStartPosition , *cid , KNullDesC() , *ttid);
if (iCidList)
{
for (i = 0; i<iCidList->Count(); i++)
{
HBufC* temp = NULL;
User::LeaveIfError( From8To16(*((*iCidList)[i]) , temp ) );
CleanupStack::PushL(temp);
if (!temp->Compare(*cid))
{
delete (*iCidList)[i];
iCidList->Remove(i);
CleanupStack::PopAndDestroy(temp);
break;
}
CleanupStack::PopAndDestroy(temp); //temp
}
if (iCidList->Count()<=0)
{
CompleteScanning(KErrNone);
}
}
CleanupStack::PopAndDestroy(2); //cid,ttid
}
else if (aType == EOma2Dcf)
{
COma2Dcf* d = COma2Dcf::NewL(f);
CleanupStack::PushL(d);
// Set group ID and content ID for this entry
if (d->iGroupId)
{
User::LeaveIfError( From8To16( *(d->iGroupId) , group ) );
// replace the content ID for this entry with a placeholder to prevent
// that the file is listed wrongly under the group ID
cid = KGroupIdReplacement().AllocL();
}
else
{
User::LeaveIfError( From8To16( *(d->iContentID) , cid ) );
group = HBufC::NewMaxL(16);
*group = KNullDesC16;
}
CleanupStack::PushL(cid);
CleanupStack::PushL(group);
if (iState == EStateSetTtid)
{
for (i = 0; iPairList && i<iPairList->Count() && !ttid; i++)
{
HBufC* temp = NULL;
User::LeaveIfError( From8To16(*((*iPairList)[i]->iCid) , temp ) );
CleanupStack::PushL(temp);
if (!temp->Compare(*cid))
{
User::LeaveIfError( From8To16(*((*iPairList)[i]->iTtid) , ttid ) );
// EFileWrite is needed for this case
// So we cannot do it here. we must close the file
setTtid = i;
}
CleanupStack::PopAndDestroy(temp); //temp
}
}
if (!ttid)
{
if (d->iTransactionTracking)
{
User::LeaveIfError( From8To16( *(d->iTransactionTracking) , ttid ) );
}
//.........这里部分代码省略.........