本文整理汇总了C++中HBufC8::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC8::Find方法的具体用法?C++ HBufC8::Find怎么用?C++ HBufC8::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC8
的用法示例。
在下文中一共展示了HBufC8::Find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resolvedByContentIdL
//---------------------------------------------------------------
// CNativeMmsUtility::resolvedByContentIdL
// @see header
//---------------------------------------------------------------
TBool CNativeMmsUtility::resolvedByContentIdL(const TPtrC8& contentidptr,
const CUri16& targeturi)
{
#ifdef _DEBUG_TRACES_
qDebug() << " Enter CNativeMmsUtility::resolvedByContentIdL";
#endif
TBool result = EFalse;
TUriParser8 parser;
CUri16* contIdUri = NULL;
HBufC8* contentId = NULL;
//get content-id uri
if (contentidptr.Length())
{
//Copy string to 8-bit descriptor
contentId = HBufC8::NewLC(contentidptr.Length());
if (contentId->Find(KCidLeftAngle) == 0
&& contentId->Find(KCidRightAngle) == contentId->Length() - 1)
{
// When comparing against cid, remove "<" and ">"
contentId->Des().Copy(contentidptr.Mid(1, contentidptr.Length() - 2));
}
else
{
contentId->Des().Copy(contentidptr);
}
parser.Parse(*contentId);
contIdUri = UriUtils::ConvertToDisplayFormL(parser);
CleanupStack::PushL(contIdUri);
}
//compare content-id against the target uri
if ( (contentidptr.Length())
&& (targeturi.Uri().UriDes().CompareF(contIdUri->Uri().UriDes())
== 0))
{
#ifdef _DEBUG_TRACES_
qDebug() << " Exit CNativeMmsUtility::resolvedByContentIdL";
#endif
result = ETrue;
}
//do some cleanup
if (contentId)
{
CleanupStack::PopAndDestroy(2, contentId); // contentId, contIdUri
}
#ifdef _DEBUG_TRACES_
qDebug() << " Exit CNativeMmsUtility::resolvedByContentIdL";
#endif
return result;
}
示例2: IsContentTypeSupportedL
// -----------------------------------------------------------------------------
// CDownloadUtils::IsContentTypeSupportedL
// -----------------------------------------------------------------------------
//
TBool CDownloadUtils::IsContentTypeSupportedL( RHttpDownload& aDownload )
{
TBool supported = EFalse;
HBufC8* contentType = ContentTypeL( aDownload, ETrue );
CleanupStack::PushL( contentType );
// if we get content-type that appears to be SIS (not SISx) type, may be due to
// misconfigured server: change content-type to octet-stream to allow
// app installer to make decision if supported or not
if( contentType->Find( KSisFileMimeType ) != KErrNotFound )
{
contentType->Des().Copy( KOctetStreamMimeType );
}
supported = IsContentTypeSupportedL( aDownload, *contentType );
CleanupStack::PopAndDestroy( contentType );
return supported;
}
示例3: GetByUrlL
// ---------------------------------------------------------
// CUniObjectList::GetByUrlL
//
// GetByUrlL.
// ---------------------------------------------------------
//
EXPORT_C CUniObject* CUniObjectList::GetByUrlL( const TDesC& aUrl )
{
CUniObject* att = NULL;
TBool found = EFalse;
HBufC8* url8bit = HBufC8::NewLC( aUrl.Length() );
CUri16* decodedUri = NULL;
TUriParser8 parser;
if( !url8bit )
{
return NULL;
}
if( aUrl.MatchF( KContentIdString ) == 0 )
{
//Remove "cid:" from the beginning
url8bit->Des().Copy( aUrl.Right( aUrl.Length() - KContentIdString().Length() + 1 ) );
parser.Parse( *url8bit );
}
else
{
url8bit->Des().Copy( aUrl );
parser.Parse( *url8bit );
}
decodedUri = UriUtils::ConvertToDisplayFormL( parser );
CleanupStack::PushL( decodedUri );
TInt count = iObjectArray->Count();
for ( TInt i = 0; i < count && !found ; ++i )
{
TPtrC contentLocation = iObjectArray->At( i )->MimeInfo()->ContentLocation();
TPtrC8 contentIdPtr = iObjectArray->At( i )->MimeInfo()->ContentId();
CUri16* contLocUri = NULL;
CUri16* contIdUri = NULL;
HBufC8* contentLoc = NULL;
HBufC8* contentId = NULL;
// Convert content location as well.
if ( contentIdPtr.Length() )
{
//Copy string to 8-bit descriptor
contentId = HBufC8::NewLC( contentIdPtr.Length() );
if ( contentId->Find( KCidLeftAngle ) == 0 &&
contentId->Find( KCidRightAngle ) == contentId->Length() - 1 )
{
// When comparing against cid, remove "<" and ">"
contentId->Des().Copy( contentIdPtr.Mid( 1, contentIdPtr.Length() - 2 ) );
}
else
{
contentId->Des().Copy( contentIdPtr );
}
parser.Parse( *contentId );
contIdUri = UriUtils::ConvertToDisplayFormL( parser );
CleanupStack::PushL( contIdUri );
}
if ( contentLocation.Length() )
{
//Copy string to 8-bit descriptor
contentLoc = HBufC8::NewLC( contentLocation.Length() );
contentLoc->Des().Copy( contentLocation );
parser.Parse( *contentLoc );
contLocUri = UriUtils::ConvertToDisplayFormL( parser );
CleanupStack::PushL( contLocUri );
}
if (
( ( contentLocation.Length() ) && (decodedUri->Uri().UriDes().CompareF( contLocUri->Uri().UriDes() ) == 0 ) ) ||
( ( contentIdPtr.Length() ) && (decodedUri->Uri().UriDes().CompareF( contIdUri->Uri().UriDes() ) == 0 ) ) )
{
att = iObjectArray->At( i );
}
if ( contentLoc )
{
CleanupStack::PopAndDestroy( 2, contentLoc ); // contentLoc, contLocUri
}
if ( contentId )
{
CleanupStack::PopAndDestroy( 2, contentId ); // contentId, contIdUri
}
}
CleanupStack::PopAndDestroy( 2, url8bit ); // decodedUri, url8bit
return att;
}
示例4: ExtractDomainKeyElements
// -----------------------------------------------------------------------------
// CRoapParser::ExtractDomainKeyElements
// -----------------------------------------------------------------------------
//
TInt CRoapParser::ExtractDomainKeyElements(
const TDesC8& aMessage, RPointerArray<HBufC8>& aDomainKeyElements ) const
{
LOG( _L("CRoapParser::ExtractDomainKeyElements") );
TPtrC8 temp(KNullDesC8);
TPtrC8 elementPtr(KNullDesC8);
TInt pos = 0;
HBufC8* element = NULL;
TInt err = KErrNone;
TPtr8 ptr(0, 0);
TInt macStart = 0;
TInt macEnd = 0;
// extract DomainKey elements to aDomainKeyElements array
while (true)
{
elementPtr.Set( ExtractElement( aMessage, KDomainKey(), pos ) );
if( pos < 0 )
{
// no more DomainKeys present
if(aDomainKeyElements.Count())
{
return KErrNone;
}
else
{
aDomainKeyElements.ResetAndDestroy();
return KErrRoapServerFatal;
}
}
element = elementPtr.Alloc();
if(!element)
{
return KErrNoMemory;
}
// remove mac element from found DomainKeyElement
macStart = element->Find( KMac );
temp.Set(element->Left(macStart));
macStart = temp.LocateReverse('<');
macEnd = element->Find( KMacEnd ) + KMacEnd().Length();
if ( macStart < 0 || macEnd < 0 )
{
aDomainKeyElements.ResetAndDestroy();
return KErrRoapServerFatal;
}
ptr.Set( element->Des() );
ptr.Replace( macStart, macEnd - macStart, KNullDesC8 );
err = aDomainKeyElements.Append(element);
if(err)
{
delete element;
element = NULL;
aDomainKeyElements.ResetAndDestroy();
return err;
}
}
}