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


C++ LLAssetRequest::setType方法代码示例

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


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

示例1: downloadCompleteCallback

void LLAssetStorage::downloadCompleteCallback(
	S32 result,
	const LLUUID& file_id,
	LLAssetType::EType file_type,
	void* user_data, LLExtStat ext_status)
{
	lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
		 << "," << LLAssetType::lookup(file_type) << llendl;
	LLAssetRequest* req = (LLAssetRequest*)user_data;
	if(!req)
	{
		llwarns << "LLAssetStorage::downloadCompleteCallback called without"
			"a valid request." << llendl;
		return;
	}
	if (!gAssetStorage)
	{
		llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl;
		return;
	}

	// Inefficient since we're doing a find through a list that may have thousands of elements.
	// This is due for refactoring; we will probably change mPendingDownloads into a set.
	request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(), 
													   gAssetStorage->mPendingDownloads.end(),
													   req);
	// If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted
	// by _cleanupRequests, or it's a transfer.
	if (download_iter != gAssetStorage->mPendingDownloads.end())
	{
		req->setUUID(file_id);
		req->setType(file_type);
	}

	if (LL_ERR_NOERR == result)
	{
		// we might have gotten a zero-size file
		LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
		if (vfile.getSize() <= 0)
		{
			llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl;
			
			result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
			vfile.remove();
		}
	}
	
	// find and callback ALL pending requests for this UUID
	// SJB: We process the callbacks in reverse order, I do not know if this is important,
	//      but I didn't want to mess with it.
	request_list_t requests;
	for (request_list_t::iterator iter = gAssetStorage->mPendingDownloads.begin();
		 iter != gAssetStorage->mPendingDownloads.end();  )
	{
		request_list_t::iterator curiter = iter++;
		LLAssetRequest* tmp = *curiter;
		if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type))
		{
			requests.push_front(tmp);
			iter = gAssetStorage->mPendingDownloads.erase(curiter);
		}
	}
	for (request_list_t::iterator iter = requests.begin();
		 iter != requests.end();  )
	{
		request_list_t::iterator curiter = iter++;
		LLAssetRequest* tmp = *curiter;
		if (tmp->mDownCallback)
		{
			tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);
		}
		delete tmp;
	}
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:74,代码来源:llassetstorage.cpp


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