本文整理汇总了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;
}
}