当前位置: 首页>>代码示例>>C++>>正文


C++ TUriParser8::IsPresent方法代码示例

本文整理汇总了C++中TUriParser8::IsPresent方法的典型用法代码示例。如果您正苦于以下问题:C++ TUriParser8::IsPresent方法的具体用法?C++ TUriParser8::IsPresent怎么用?C++ TUriParser8::IsPresent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TUriParser8的用法示例。


在下文中一共展示了TUriParser8::IsPresent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IdentifySchemeL

COCSPTransportDefault::TTransportScheme COCSPTransportDefault::IdentifySchemeL(const TDesC8& aURI)
	{
	TTransportScheme ret = ETransportSchemeNotSupported;
	
	TUriParser8 uri;
	TInt error = uri.Parse(aURI);
	if (error != KErrNone || !uri.IsPresent(EUriScheme))
		{
		return ret;
		}
	const TPtrC8 scheme = uri.Extract(EUriScheme);
			
	RStringPool stringPool;
	stringPool.OpenL();
	CleanupClosePushL(stringPool);

	RStringF schemeF = stringPool.OpenFStringL(scheme);
	CleanupClosePushL(schemeF);
	RStringF httpF = stringPool.OpenFStringL(KHttpString);
	CleanupClosePushL(httpF);

	if (schemeF == httpF)
		{
		ret = ETransportSchemeHTTP;
		}

	CleanupStack::PopAndDestroy(3); // close httpF, schemeF, stringPool

	return ret;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:30,代码来源:transportdefault.cpp

示例2: ValidateUri

/**
	Checks whether a uri is valid or not. Will check whether the uri contains
	scheme, host and path.
	
	@param aUri [in] URI to validate. Only scheme and host presence is validated.
	
	@return TBool ETrue if the URI is successfully validated else EFalse.
 */	
TBool CTestWebBrowser::ValidateUri ( const TDesC8& aUri )
	{
	TUriParser8 uriParser;
	if ( uriParser.Parse ( aUri ) != KErrNone )
		{
		return EFalse;			
		}
	
	// check for scheme
	if ( !uriParser.IsPresent ( EUriScheme ) )
		{
		return EFalse;				
		}
	
	// check for host
	if ( !uriParser.IsPresent ( EUriHost) )
		{
		return EFalse;			
		}
	return ETrue;				
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:29,代码来源:testwebbrowser.cpp

示例3:

/**
	Converts a 16-bit format uri into its internet form. Any Unicode characters 
	are converted into Utf8 representation and then any excluded characters are 
	escape encoded.  Reserved characters specified in RFC2396 will not be escape 
	encoded however, these include ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",". 
	For example http://localhost will not be encoded to http%3A%2F%2Flocalhost.
	
	@since			6.0
	@deprecated	 Deprecated in 9.1
	@leave			KUriUtilsCannotConvert. When the input data cannot be converted.
	@leave			KUriUtilsErr16BitChar. When the input data has a 16-Bit character to be escape encoded.
	@param			aUri	The 16-bit format uri.
	@return			A pointer to a newly created 8-bit uri.
 */
EXPORT_C CUri8* UriUtils::ConvertToInternetFormL(const TUriC16& aUri)
	{
	// Need to convert to utf8
	HBufC8* utf8Buf = EscapeUtils::ConvertFromUnicodeToUtf8L(aUri.UriDes());
	CleanupStack::PushL(utf8Buf);

	// Ok need to parse for the uri without the fragment
	TUriParser8 parser;
	parser.Parse(*utf8Buf);
	TPtrC8 uriNoFragment;
	parser.UriWithoutFragment(uriNoFragment);

	// Now escape encode the uri without the fragment
	HBufC8* escapedBuf = EscapeUtils::EscapeEncodeL(uriNoFragment, EscapeUtils::EEscapeNormal);
	CleanupStack::PushL(escapedBuf);

	// Now escape encode the fragment if there is one...
	HBufC8* escapedFragmentBuf = NULL;
	if( parser.IsPresent(EUriFragment) )
		{
		escapedFragmentBuf = EscapeUtils::EscapeEncodeL(parser.Extract(EUriFragment), EscapeUtils::EEscapeNormal);
		CleanupStack::PushL(escapedFragmentBuf);
		}

	// Parse and then create the CUri8 object
	parser.Parse(*escapedBuf);
	CUri8* netForm = CUri8::NewL(parser);

	// Set the fragment if there was one...
	if( escapedFragmentBuf != NULL )
		{
		CleanupStack::PushL(netForm);
		netForm->SetComponentL(*escapedFragmentBuf, EUriFragment);
		CleanupStack::Pop(netForm);
		CleanupStack::PopAndDestroy(escapedFragmentBuf);
		}

	// Cleanup and return
	CleanupStack::PopAndDestroy(2, utf8Buf);	// utf8Buf, escapedBuf
	return netForm;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:UriUtils.cpp


注:本文中的TUriParser8::IsPresent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。