本文整理汇总了C++中TDesC8::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::Compare方法的具体用法?C++ TDesC8::Compare怎么用?C++ TDesC8::Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC8
的用法示例。
在下文中一共展示了TDesC8::Compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsContentTypeSupportedL
// -----------------------------------------------------------------------------
// CDownloadUtils::IsContentTypeSupportedL
// -----------------------------------------------------------------------------
//
TBool CDownloadUtils::IsContentTypeSupportedL( RHttpDownload& aDownload, const TDesC8& aContentType )
{
if ( aContentType.Length() == 0 )
{
return EFalse;
}
#ifdef BRDO_WML_DISABLED_FF
else if ( !aContentType.Compare(KWmlType1()) || !aContentType.Compare(KWmlType2())
|| !aContentType.Compare(KWmlType3()) || !aContentType.Compare(KWmlType4()) )
{
return EFalse;
}
#endif
else
{
TBool canOpen( EFalse );
CDocumentHandler* docHandler = CDocumentHandler::NewLC();
TRAPD( err, canOpen = docHandler->CanOpenL( TDataType( aContentType ) ) );
if ( err == KMimeNotSupported )
{
TUint8* contentTypeString = NULL;
FindContentTypeFromFileL(aDownload, contentTypeString);
if (contentTypeString != NULL)
{
TRAPD( err1, canOpen = docHandler->CanOpenL( TDataType( TPtrC8(contentTypeString) ) ) );
if ( err1 == KMimeNotSupported )
{
canOpen = EFalse;
delete contentTypeString;
}
else if (err1 == KErrNone)
{
// Setting Download Content type to a recognized one
aDownload.SetStringAttribute( EDlAttrContentType, TPtrC8(contentTypeString) );
delete contentTypeString;
canOpen = ETrue;
}
else
{
delete contentTypeString;
User::Leave( err );
}
}
}
else
{
if (err != KErrNone )
{
User::Leave( err );
}
}
CleanupStack::PopAndDestroy(docHandler ); // docHandler
return canOpen;
}
}
示例2: CheckTag
TInt CHandleOutSearch::CheckTag(const TDesC8& aTagData)
{
iMainEngine.WriteLog8(aTagData);
TInt rValue=0;
if(aTagData.Compare(KXMLP)==0)
rValue= 1;
else if(aTagData.Compare(KXMLA)==0)
rValue= 2;
else if(aTagData.Compare(KXMLBR)==0)
rValue= 4;
else if(aTagData.Compare(KXMLEM)==0)
rValue= 3;
else if(aTagData.Compare(KXMLB)==0)
rValue= 3;
else if(aTagData.Compare(KXMLSTRONG)==0)
rValue= 3;
else if(aTagData.Compare(KXMLU)==0)
rValue= 3;
else if(aTagData.Compare(KXMLBIG)==0)
rValue= 3;
else if(aTagData.Compare(KXMLSMALL)==0)
rValue= 3;
return rValue;
}
示例3: GenerateInternalKey
TInt CConfigImpl::GenerateInternalKey(const TDesC8& aSection,TBuf8<15>& aKeyName)
{
TPtrC8 lastKey;
TInt ret=GetKeyCount(aSection,lastKey);
if (ret<0)
{
return ret;
}
//either "mediaX" or "X"
//TInt key=ret;
if(aSection.Compare(KPrimaryFilterSection)== 0 )
{
TInt lastKeyValue=0;
if(lastKey.Length())
{
TLex8 lex(lastKey);
TInt err = lex.Val(lastKeyValue);
if(err != KErrNone)
return err;
}
aKeyName.Format(_L8("%03d"),++lastKeyValue);
}
else if(aSection.Compare(KSecondaryFilterSection) == 0)
{
TInt lastKeyValue=0;
if(lastKey.Length())
{
TLex8 lex(lastKey);
TInt err = lex.Val(lastKeyValue);
if(err != KErrNone)
return err;
}
aKeyName.Format(_L8("%04d"),++lastKeyValue);
}
else
{
TInt lastKeyValue=0;
if(lastKey.Length())
{
TLex8 lex(lastKey);
TInt err = lex.Val(lastKeyValue);
if(err != KErrNone)
return err;
}
aKeyName.Format(_L8("%d"),++lastKeyValue);
}
return KErrNone;
}
示例4: PubsubSubscription
TXmppPubsubSubscription CXmppEnumerationConverter::PubsubSubscription(const TDesC8& aPubsubSubscription) {
TXmppPubsubSubscription aSubscription = EPubsubSubscriptionNone;
if(aPubsubSubscription.Compare(KPubsubSubscriptionSubscribed) == 0) {
aSubscription = EPubsubSubscriptionSubscribed;
}
else if(aPubsubSubscription.Compare(KPubsubSubscriptionPending) == 0) {
aSubscription = EPubsubSubscriptionPending;
}
else if(aPubsubSubscription.Compare(KPubsubSubscriptionUnconfigured) == 0) {
aSubscription = EPubsubSubscriptionUnconfigured;
}
return aSubscription;
}
示例5: DeleteServiceL
TBool CUPnPRootDeviceInfoContainer::DeleteServiceL ( const TDesC8& aScpdUrl, CUPnPDevice* aDevice )
{
RStringPool& sp = iStringPoolMgr->StringPool( );
const CUPnPServiceInfo* serviceInfo = NULL;
TPtrC8 urlPtr ( NULL, 0 );
for ( TInt i = 0; i < aDevice->CountOfServiceInfoTable( ); i++ )
{
serviceInfo = aDevice->AtServiceInfoTable( i );
urlPtr.Set ( serviceInfo->Property( sp.String ( UPNPDESCRIPTIONXMLTAGS::EScpdUrl,iStringPoolMgr->GetUPnPTable() ) ).Mid (1) );
if ( aScpdUrl.Compare ( urlPtr ) == 0 )
{
aDevice->DeleteServiceInfoAtIndexL( i );
return ETrue;
}
}
for ( TInt i=0; i < aDevice->CountOfEmbeddedDeviceInfoTable( ); i++ )
{
if ( DeleteServiceL ( aScpdUrl, aDevice->AtEmbeddedDeviceInfoTable( i ) ) == 1 )
return ETrue;
}
return EFalse;
}
示例6: SetKeyInfoL
// ---------------------------------------------------------------------------
// Add <KeyName> element to <KeyInfo> node and set the value of it.
// ---------------------------------------------------------------------------
//
void XmlSecTemplate::SetKeyInfoL(RXmlEngDocument& aTemplate, const TDesC8& aKeyName)
{
if(!aKeyName.Compare(KNullDesC8))
{
User::Leave(KErrWrongParameter);
}
if(aTemplate.IsNull())
{
User::Leave(KErrTemplate);
}
xmlNodePtr keyInfo = NULL;
TXmlEngNode tmpNode = aTemplate.DocumentElement();
xmlNodePtr root = INTERNAL_NODEPTR(tmpNode);
keyInfo = xmlSecFindNode(root,xmlSecNodeKeyInfo, xmlSecDSigNs);
if(!keyInfo)
{
User::Leave(KErrTemplate);
}
TXmlEngElement(keyInfo).RemoveChildren();
char* name = XmlEngXmlCharFromDes8L(aKeyName);
root = xmlSecTmplKeyInfoAddKeyName(keyInfo,(unsigned char*)name);
delete name;
if(!root)
{
User::Leave(KErrNoMemory);
}
}
示例7: ConstructL
void CRtpSourceEntry::ConstructL(const TDesC8& aCNAME)
{
if(0 != aCNAME.Compare(KNullDesC8))
{
iCNAME = aCNAME.AllocL();
}
}
示例8: DoTestStepL
TVerdict RTestStepVideoResolverUtils::DoTestStepL()
{
INFO_PRINTF1(_L("Tests the video resolver utility "));
_LIT8(KText, "<m>Manufacturer<p>320,200<l>100,20,4000");
TBufC8<50> data(KText);
TPtr8 ptrData = data.Des();
CCodecApiVideoOpaqueData* codecApiVideoOpaqueData = CCodecApiVideoOpaqueData::NewLC(ptrData);
// verify the picture size
TSize picSize = codecApiVideoOpaqueData->MaxPictureSize();
if (picSize.iWidth != KPicSizeX &&
picSize.iHeight != KPicSizeY)
{
INFO_PRINTF1(_L("Incorrect picture size"));
return EFail;
}
RArray<TPictureRateAndSize> pictureRateAndSize = codecApiVideoOpaqueData->MaxPictureRates();
TUint arraySize = pictureRateAndSize.Count();
if (arraySize == 0)
{
INFO_PRINTF1(_L("No picture rate and size extracted from the opaque data"));
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EFail;
}
INFO_PRINTF2(_L("No picture rate and size extracted from the opaque data, %d"), pictureRateAndSize[0].iPictureRate);
if (pictureRateAndSize[0].iPictureRate != KPicRate)
{
INFO_PRINTF1(_L("Incorrect picture rate"));
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EFail;
}
if (pictureRateAndSize[0].iPictureSize.iWidth != KPicWidth)
{
INFO_PRINTF1(_L("Incorrect picture width"));
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EFail;
}
if (pictureRateAndSize[0].iPictureSize.iHeight != KPicHeight)
{
INFO_PRINTF1(_L("Incorrect picture heigh"));
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EFail;
}
TDesC8 manufacturer = codecApiVideoOpaqueData->Manufacturer();
if(manufacturer.Compare(KTextManufactor) == 0)
{
INFO_PRINTF1(_L("Incorrect manufacturer"));
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EFail;
}
CleanupStack::PopAndDestroy(codecApiVideoOpaqueData);
return EPass;
}
示例9: PresenceSubscription
TPresenceSubscription CXmppEnumerationConverter::PresenceSubscription(const TDesC8& aPresenceSubscription) {
TPresenceSubscription aSubscription = EPresenceSubscriptionNone;
if(aPresenceSubscription.Compare(KPresenceSubscriptionBoth) == 0) {
aSubscription = EPresenceSubscriptionBoth;
}
else if(aPresenceSubscription.Compare(KPresenceSubscriptionFrom) == 0) {
aSubscription = EPresenceSubscriptionFrom;
}
else if(aPresenceSubscription.Compare(KPresenceSubscriptionTo) == 0) {
aSubscription = EPresenceSubscriptionTo;
}
else if(aPresenceSubscription.Compare(KPresenceSubscriptionRemove) == 0) {
aSubscription = EPresenceSubscriptionRemove;
}
return aSubscription;
}
示例10: PubsubAccessModel
TXmppPubsubAccessModel CXmppEnumerationConverter::PubsubAccessModel(const TDesC8& aPubsubAccessModel) {
TXmppPubsubAccessModel aAccessModel = EPubsubAccessWhitelist;
if(aPubsubAccessModel.Compare(KPubsubAccessModelOpen) == 0) {
aAccessModel = EPubsubAccessOpen;
}
return aAccessModel;
}
示例11: Match
TBool CExampleResolver::Match(const TDesC8& aImplementationType,
const TDesC8& aMatchType,
TBool aUseWildcards) const
{
TInt matchPos = KErrNotFound;
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aImplementationType.Find(dataSeparator);
if(separatorPos == KErrNotFound)
{
// Match against the whole string
if(aUseWildcards)
matchPos = aImplementationType.Match(aMatchType);
else
matchPos = aImplementationType.Compare(aMatchType);
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aImplementationType.Left(separatorPos);
TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
// Match against each section in turn
while(separatorPos != KErrNotFound)
{
// Search this section
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
// If we found it then no need to continue, so return
if(matchPos != KErrNotFound)
return ETrue;
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if(separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
dataSection.Set(remainingData);
}
// Check the final part
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
}
return matchPos != KErrNotFound;
}
示例12: SetInfoL
// ----------------------------------------------------------------------------
// CSdpMediaField::SetInfoL
// ----------------------------------------------------------------------------
//
EXPORT_C void CSdpMediaField::SetInfoL(const TDesC8& aValue)
{
__ASSERT_ALWAYS (aValue.Compare(KNullDesC8) == 0||
SdpUtil::IsByteString(aValue),
User::Leave(KErrSdpCodecMediaInfoField));
HBufC8* tmp = aValue.AllocL();
tmp->Des().Trim();
delete iInfo;
iInfo = tmp;
}
示例13: Compare
TInt CAuthenticationMac::Compare(const TDesC8 &aDigest)
/**
* Finish the digets computation and compare with ICV.
*
* @param aDigest The ICV to match
* @return comparison result (= 0, match, != 0, no match).
*/
{
return aDigest.Compare(iTemp->Des());
}
示例14: CompareBuffers
/**
* Compare Buffers
*
* @param aReferenceBuffer Reference buffer
* @param aDataBuffer Buffer to compare
*
* @return ETrue if buffer contents match
*/
TBool CT_DataVerify::CompareBuffers( const TDesC8& aReferenceBuffer, const TDesC8& aDataBuffer )
{
TBool res = EFalse;
TInt result = aReferenceBuffer.Compare( aDataBuffer );
if( result == 0 )
{
// Buffer contents match
res = ETrue;
}
return res;
}
示例15: ChildURIListL
// ------------------------------------------------------------------------
// CNSmlDmAOAdapter::ChildURIListL
// Fetches child nodes of a node. these may be either all VENDORCONFIG
// nodes or leaf nodes under a VENDORCONFIG node.
// ------------------------------------------------------------------------
void CNSmlDmAOAdapter::ChildURIListL( const TDesC8& aURI,
const TDesC8& aLUID,
const CArrayFix<TSmlDmMappingInfo>&
/*aPreviousURISegmentList*/,
TInt aResultsRef,
TInt aStatusRef )
{
LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: Start" );
LOGSTRING3( "\tChildURIListL URI: %S, LUID: %S ",
&aURI, &aLUID );
CBufBase* resultList = CBufFlat::NewL( KSmlMaxURISegLen );
CleanupStack::PushL( resultList );
// get all leaf nodes below VENDORCONFIG node
if ( !aURI.Compare( KNSmlDmAOAdapterAO ) )
{
CSmlDmAOCommandElement* cmd =
CSmlDmAOCommandElement::NewLC( EFalse,
aStatusRef,
aResultsRef,
CNSmlDmAOAdapter::EGetCmd,
KNullDesC8,
KNullDesC8 );
TInt luid( KDefaultLuid );
if ( aLUID.Length() > 0 )
{
luid = DesToIntL( aLUID );
}
iSettingStore->ExecuteCmdL( *cmd, luid );
LOGSTRING2( "\tCmd executed with status: %d ",
cmd->Status() );
Callback().SetStatusL( aStatusRef, cmd->Status() );
if( cmd->Status() == CSmlDmAdapter::EOk )
{
resultList->InsertL( 0, *cmd->Data() );
Callback().SetResultsL( aResultsRef,
*resultList,
KNullDesC8 );
}
CleanupStack::PopAndDestroy( cmd );
}
CleanupStack::PopAndDestroy( resultList );
LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: End" );
}