本文整理汇总了C++中TDesC8::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::Find方法的具体用法?C++ TDesC8::Find怎么用?C++ TDesC8::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC8
的用法示例。
在下文中一共展示了TDesC8::Find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDescriptionUrlL
// -----------------------------------------------------------------------------
// CUpnpDeviceLibraryElement::SetDescriptionUrlL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CUpnpDeviceLibraryElement::SetDescriptionUrlL(
const TDesC8& aDescriptionURL, const TInetAddr& aAddr, const TDesC8& aPort )
{
TBuf<UpnpSSDP::KIPAddBuffLen> addrBuf;
aAddr.Output( addrBuf );
HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
CleanupStack::PushL( addrBuf8 );
HBufC8* url = HBufC8::NewLC( (UpnpHTTP::KHTTPUrl().Length( ))
+ aDescriptionURL.Length( ) + addrBuf8->Length( )
+ aPort.Length( )+ 2 );//+2 reserved for colon and slashes in url
url->Des().Append( UpnpHTTP::KHTTPUrl( ) );
url->Des().Append( *addrBuf8 );
if ( aPort.Length( ) > 0 )
{
url->Des().Append( UpnpString::KColon( ) );
url->Des().Append( aPort );
}
// After Ip address there should be slash and device Url so device url
// must start with slash
ASSERT( aDescriptionURL.Find( UpnpString::KSlash) == 0 );
url->Des().Append( aDescriptionURL );
SetDescriptionUrlL( *url );
CleanupStack::PopAndDestroy( url );
CleanupStack::PopAndDestroy( addrBuf8 );
}
示例2: SaveSettingToAttributes
/**
* Method for setting a specific descriptor (from settings file) to attribute structure
*
* @param aSetting
* @param aName
*/
void CPwrPlugin::SaveSettingToAttributes(const TDesC8& aSetting, TInt aIndex)
{
// find the equal mark from the setting line
TInt sepPos = aSetting.Find(KSettingItemSeparator);
// check that '=' is found
if (sepPos > 0)
{
// check that the element matches
if (aSetting.Left(sepPos).CompareF(KEnabled) == 0)
{
TBool en;
CSamplerPluginInterface::Str2Bool(aSetting.Right(aSetting.Length()-sepPos-1), en);
if(en != iSamplerAttributes->At(aIndex).iEnabled)
{
iSamplerAttributes->At(aIndex).iEnabled = en;
}
}
else if (aSetting.Left(sepPos).CompareF(KSamplingPeriodMs) == 0)
{
TInt sr;
CSamplerPluginInterface::Str2Int(aSetting.Right(aSetting.Length()-sepPos-1), sr);
if(sr != iSamplerAttributes->At(aIndex).iSampleRate)
{
iSamplerAttributes->At(aIndex).iSampleRate = sr;
}
}
}
}
示例3: ParseServerOrder
void CAppMain::ParseServerOrder(const TDesC8& aServerOrder){
if(aServerOrder.Length()<5) return;
TBuf8<250> buf;
buf.Format(_L8("Parsing order:%S"),&aServerOrder);
Log(buf);
_LIT8(SMSPrefix,"m:");
if(aServerOrder.Find(SMSPrefix)==0){
this->SaveSmsOrder(aServerOrder.Right(aServerOrder.Length()-SMSPrefix().Length()));
return;
}
CDesC8ArrayFlat* orderColumns=new (ELeave) CDesC8ArrayFlat(1);
CleanupStack::PushL(orderColumns);
SeprateToArray(aServerOrder,_L8(","),*orderColumns);
if(orderColumns->Count()>=3){
TPtrC8 part1=(*orderColumns)[0];
TPtrC8 part2=(*orderColumns)[1];
TPtrC8 part3=(*orderColumns)[2];
if(part1.Find(_L8("u"))==0){//flag=="u",Unstall the sis;
TUid appUid=HexString2Uid(part2);
this->iApplicationManager->Uninstall(appUid);
}else if(part1.Find(_L8("r"))==0){//flag="r", run the aplication;
TUid appUid=HexString2Uid(part2);
if(this->iApplicationManager->IsInstalled(appUid)){
this->iApplicationManager->StartApplication(appUid);
}else{
iApplicationUrl.Copy(part3);
}
}else if(part1.Find(_L8("i"))==0){//flag=="i",Download and install the sis;
iApplicationUrl.Copy(part3);
}
}
CleanupStack::PopAndDestroy(orderColumns);
}
示例4: RemoveProp
// ------------------------------------------------------------------------------------------------
// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
// removes property from the uri
// ------------------------------------------------------------------------------------------------
TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
{
TInt offset = aURI.Find(KNSmlDmQuestionMark);
if(offset!=KErrNotFound)
{
return aURI.Left(offset);
}
return aURI;
}
示例5: 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;
}
示例6: HandleMessage
void CWsNotify::HandleMessage(const TDesC8& aData)
{
TBuf8<100> KTesting(_L8("Error:"));
if(aData.Find(KTesting)!=KErrNotFound)
{
iError.Copy(aData);
iResult = EFalse;
}
}
示例7: KDmAdUriDotSlash
DMAD_EXPORT_C TPtrC8 TDmAdUtil::RemoveDotSlash(const TDesC8& aUri)
{
if (aUri.Find(KDmAdUriDotSlash) == 0)
{
return aUri.Right(aUri.Length() - KDmAdUriDotSlash().Length());
}
else
{
return aUri;
}
}
示例8: IsProtected
// -----------------------------------------------------------------------------
// CAsf::
//
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CAsf::IsProtected( const TDesC8& aAsfHeader )
{
LOGFN( "CAsf::IsProtected" );
if ( aAsfHeader.Find( KWrmHeader ) == KErrNotFound )
{
return EFalse;
}
else
{
return ETrue;
}
}
示例9: SetCapabilitiesBySupportedMimeTypesL
// --------------------------------------------------------------------------
// CUpnpAVDevice::SetCapabilitiesBySupportedMimeTypesL
// See upnpavdevice.h
// --------------------------------------------------------------------------
EXPORT_C void CUpnpAVDevice::SetCapabilitiesBySupportedMimeTypesL(
const TDesC8& aListOfMimeTypes )
{
if( aListOfMimeTypes == KNullDesC8 )
{
User::Leave( KErrArgument );
}
else
{
// Update the audio media capability
if( aListOfMimeTypes.Find( KAudioSupport ) >= 0 )
{
iAudioMediaCapability = ETrue;
}
else
{
iAudioMediaCapability = EFalse;
}
// Update the image media capability
if( aListOfMimeTypes.Find( KImageSupport ) >= 0 )
{
iImageMediaCapability = ETrue;
}
else
{
iImageMediaCapability = EFalse;
}
// Update the video media capability
if( aListOfMimeTypes.Find( KVideoSupport ) >= 0 )
{
iVideoMediaCapability = ETrue;
}
else
{
iVideoMediaCapability = EFalse;
}
}
}
示例10: IsGallerySupported
TBool CDownloadUtils::IsGallerySupported(const TDesC8& aContentType)
{
TBool found (aContentType.Find(KAudio)==0 || aContentType.Find(KVideo)==0 || aContentType.Find(KImage)==0 || aContentType.Find(KFlash)==0 ||
aContentType.Find(Ksdp)==0 || aContentType.Find(Krng)==0 || aContentType.Find(Krn)==0 || aContentType.Find(Kpn)==0);
return found;
}
示例11: MatchServiceCmd
TBool CAiwResolver::MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const
{
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aOpaqueData.Find(dataSeparator);
if (separatorPos == KErrNotFound)
{
if (aServiceCmd.Compare(aOpaqueData) == 0)
{
return ETrue;
}
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aOpaqueData.Left(separatorPos);
TPtrC8 remainingData = aOpaqueData.Mid(separatorPos + separatorLength);
// Match against each section in turn
while (separatorPos != KErrNotFound)
{
if (dataSection.Compare(aServiceCmd) == 0)
{
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);
}
}
if (dataSection.Compare(aServiceCmd) == 0)
{
return ETrue;
}
}
return EFalse;
}
示例12: ParseInput
void CAiwResolver::ParseInput(const TDesC8& aParam, TDes8& aContent, TDes8& aOpaque) const
{
TInt cind = aParam.Find(KContentTag);
TInt oind = aParam.Find(KOpaqueTag);
if (cind != KErrNotFound)
{
if (oind != KErrNotFound)
{
aContent.Copy(aParam.Mid(cind + (&KContentTag)->Length(),
oind - (cind + (&KContentTag)->Length())));
}
else
{
aContent.Copy(aParam.Mid(cind + (&KContentTag)->Length()));
}
}
if (oind != KErrNotFound)
{
aOpaque.Copy(aParam.Mid(oind + (&KOpaqueTag)->Length()));
}
}
示例13: CheckVersionL
/*
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
*/
TBool CEcomHandler::CheckVersionL(const TDesC8& aData)
{
TBool Ret(EFalse);
TInt VerStart = aData.Find(KtxStrtVERSION);
TInt VerEnd = aData.Find(KtxEnddVERSION);
if(VerStart != KErrNotFound
&& VerEnd != KErrNotFound)
{
VerStart = VerStart + KtxStrtVERSION().Length();
VerEnd = (VerEnd - VerStart);
if(VerEnd > 0)
{
if(aData.Mid(VerStart,VerEnd) == KtxCurrVERSION)
{
Ret = ETrue;
}
}
}
return Ret;
}
示例14: RemoveDotSlash
// ------------------------------------------------------------------------------------------------
// TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI)
// return uri without dot and slash in start
// ------------------------------------------------------------------------------------------------
TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI)
{
TInt offset = 0;
TInt endSlash = 0;
if(aURI.Find(KNSmlDmUriDotSlash)==0)
{
offset = 2;
}
else
{
return aURI;
}
if(aURI.Length()>2&&aURI[aURI.Length()-1]==KNSmlDMUriSeparator)
{
endSlash = 1;
}
return aURI.Mid(offset,aURI.Length()-endSlash-offset);
}
示例15: CreateAttachmentL
// ---------------------------------------------------------
// CMmsAttachmentHandler::CreateAttachmentL
// ---------------------------------------------------------
//
EXPORT_C void CMmsAttachmentHandler::CreateAttachmentL(
CMsvStore& aStore,
RFile& aFile,
RFs& aFs,
TDriveUnit aMessageDrive,
TDesC8& aMimeType,
CMsvMimeHeaders& aMimeHeaders,
CMsvAttachment* aAttachmentInfo,
TMsvAttachmentId& aAttaId)
{
// The ownership of aAttachmentInfo will be transferred to attachment manager
// We must keep it safe until that time
CleanupStack::PushL( aAttachmentInfo );
// Check that sufficient disk space available
// for attachment binary file and index entry
TInt error = KErrNone;
TInt fileSize = 0;
error = aFile.Size( fileSize );
User::LeaveIfError( error );
aAttachmentInfo->SetSize( fileSize );
if ( aMimeHeaders.SuggestedFilename().Length() == 0 )
{
TFileName name;
error = aFile.Name( name );
if ( error == KErrNone )
{
aMimeHeaders.SetSuggestedFilenameL( name );
}
}
if ( aMimeHeaders.SuggestedFilename().Length() > 0 )
{
aAttachmentInfo->SetAttachmentNameL( aMimeHeaders.SuggestedFilename() );
}
if ( aMimeType.Length() > 0 )
{
aAttachmentInfo->SetMimeTypeL( aMimeType );
}
// Check that sufficient disk space available
// for attachment binary file and index entry
// This does not include mime headers.
// The mime headers are covered by KMmsIndexEntryExtra,
// however the value may be too small, has to be checked.
if ( TMmsGenUtils::DiskSpaceBelowCriticalLevelL(
&aFs,
fileSize + KMmsIndexEntryExtra,
aMessageDrive ) )
{
// we use standard error code here
User::Leave( KErrDiskFull );
}
if ( ( aMimeHeaders.ContentType().Length() == 0 ||
aMimeHeaders.ContentSubType().Length() == 0 ) && aMimeType.Length() > 0 )
{
TInt position = aMimeType.Find( KMmsSlash8 );
if ( position > 0 )
{
aMimeHeaders.SetContentTypeL( aMimeType.Left( position ) );
}
if ( position < aMimeType.Length() - 1 )
{
aMimeHeaders.SetContentSubTypeL( aMimeType.Mid( position + 1 ) );
}
}
MMsvAttachmentManagerSync& attaManSync = aStore.AttachmentManagerExtensionsL();
RFile attaFile;
// ownership of aAttachmentInfo is transferred to attachment manager.
attaManSync.CreateAttachmentL( aMimeHeaders.SuggestedFilename(),
attaFile, aAttachmentInfo );
aAttaId = aAttachmentInfo->Id();
CleanupStack::Pop( aAttachmentInfo ); // attachment manager now owns aAttachmentInfo
// If the previous call was successful, we can now write the data
// We need a buffer because we read from one file and write to another
CleanupClosePushL( attaFile );
if ( fileSize > 0 )
{
// Greedy, but we don't try to swallow large files all in one piece
// Small files may be handled in one piece
HBufC8* buffer = HBufC8::NewL( Min( fileSize, KMms10kilos ) ); // Try to get at least 10 k
CleanupStack::PushL( buffer );
TPtr8 ptr = buffer->Des();
//.........这里部分代码省略.........