本文整理汇总了C++中TDesC16::Locate方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16::Locate方法的具体用法?C++ TDesC16::Locate怎么用?C++ TDesC16::Locate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC16
的用法示例。
在下文中一共展示了TDesC16::Locate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TBool TUriShortcutParser16::HasScheme( const TDesC16& aUri )
{
int posSchemeComponentDelimiter = aUri.Locate( KSchemeComponentDelimiter );
if ( posSchemeComponentDelimiter > 0 )
{
int posOpeningSquareBracket = aUri.Locate( KOpeningSquareBracket );
if ( posOpeningSquareBracket == KErrNotFound || posOpeningSquareBracket > posSchemeComponentDelimiter )
{
//scheme present
return ETrue;
}
}
return EFalse;
}
示例2: prefix
/** Gets a matching scheme for the prefix contained in the URI.
@param aUri descriptor to URI
@return Scheme
@panic KErrBadName URI should contain a '.'
*/
const TPtrC16 TUriShortcutParser16::MatchingScheme( const TDesC16& aUri ) const
{
TInt pos = aUri.Locate( KSeparatorDot );
//make sure it contains at least one '.'
__ASSERT_DEBUG( pos > 0 ,User::Panic( KPanicDescriptor,KErrBadName ) );
TPtrC16 prefix( aUri.Left( pos ) );
TPtrC16 scheme ( DefaultScheme() );
if ( KWww().CompareF( prefix ) == 0 )
{
scheme.Set( KHttp() );
}
else if ( KFtp().CompareF( prefix ) == 0 )
{
scheme.Set( KFtp() );
}
else if( CheckUncommonSchemes() )
{
if ( KGopher().CompareF( prefix ) == 0 )
{
scheme.Set( KGopher() );
}
else if ( KTelnet().CompareF( prefix ) == 0 )
{
scheme.Set( KTelnet() );
}
else if ( KWais().CompareF( prefix ) == 0 )
{
scheme.Set( KWais() );
}
else if ( KProspero().CompareF( prefix ) == 0 )
{
scheme.Set( KProspero() );
}
else if ( KNews().CompareF( prefix ) == 0 || KNntp().CompareF( prefix ) == 0 )
{
scheme.Set( KNntp() );
}
}
return scheme;
}