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


C++ Memory::Clear方法代码示例

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


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

示例1: get_http_page_threaded

void* get_http_page_threaded( ALLEGRO_THREAD* thread, void* ThreadData )
{
  DOWNLOAD_THREAD_DATA* threadData = (DOWNLOAD_THREAD_DATA*)ThreadData;
	CURL* curl_handle;
	Memory* buffer = new Memory( 0 );
	int cTO = 60;

	curl_handle = curl_easy_init();
	curl_easy_setopt( curl_handle, CURLOPT_URL, threadData->URL->c_str() );
	curl_easy_setopt( curl_handle, CURLOPT_FOLLOWLOCATION, 1L );
  curl_easy_setopt( curl_handle, CURLOPT_NOPROGRESS, 0L );
  curl_easy_setopt( curl_handle, CURLOPT_WRITEFUNCTION, write_data );
	curl_easy_setopt( curl_handle, CURLOPT_WRITEDATA, (void*)buffer );
  curl_easy_setopt( curl_handle, CURLOPT_PROGRESSFUNCTION, download_progress );
	curl_easy_setopt( curl_handle, CURLOPT_PROGRESSDATA, threadData->Information );

	cTO = FRAMEWORK->Settings->GetQuickIntegerValue( "Downloads.TimeOut", 60 ); // Default timeout is 60, but get settings
  curl_easy_setopt( curl_handle, CURLOPT_TIMEOUT, (long)cTO );
	curl_easy_setopt( curl_handle, CURLOPT_NOSIGNAL, 1L );

	if( FRAMEWORK->Settings->GetQuickBooleanValue( "Downloads.ProxyRequired", false ) )
	{
		curl_easy_setopt( curl_handle, CURLOPT_PROXY, FRAMEWORK->Settings->GetQuickStringValue( "Downloads.ProxyServer", "" )->c_str() );
		curl_easy_setopt( curl_handle, CURLOPT_PROXYPORT, FRAMEWORK->Settings->GetQuickInteger64Value( "Downloads.ProxyPort", 8080 ) );
	}

	if( curl_easy_perform( curl_handle ) != 0 )
	{
		buffer->Clear();
	}
	curl_easy_cleanup( curl_handle );

	if( !DownloadManager::AbortDownloads )
  {
    Event* fwEvent = new Event();
    fwEvent->Type = EVENT_DOWNLOAD_COMPLETE;
    fwEvent->Data.Download.URL = new std::string( threadData->URL->c_str() );
    fwEvent->Data.Download.Contents = buffer;
    FRAMEWORK->PushEvent( fwEvent );
  }

	if( thread != 0 )
	{
		al_destroy_thread( thread );
	}

	return 0;
}
开发者ID:pmprog,项目名称:JANE.v4,代码行数:48,代码来源:download.cpp


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