本文整理汇总了C++中QueueItemPtr::getTTH方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItemPtr::getTTH方法的具体用法?C++ QueueItemPtr::getTTH怎么用?C++ QueueItemPtr::getTTH使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItemPtr
的用法示例。
在下文中一共展示了QueueItemPtr::getTTH方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on
void ViewFileManager::on(QueueManagerListener::ItemStatusUpdated, const QueueItemPtr& aQI) noexcept {
if (!isViewedItem(aQI)) {
return;
}
auto file = getFile(aQI->getTTH());
if (file) {
file->onProgress(aQI->getTarget(), aQI->getDownloadedBytes());
}
}
示例2:
pair<QueueItem::StringMap::const_iterator, bool> FileQueue::add(QueueItemPtr& qi) noexcept {
dcassert(queueSize >= 0);
auto ret = queue.emplace(const_cast<string*>(&qi->getTarget()), qi);
if (ret.second) {
tthIndex.emplace(const_cast<TTHValue*>(&qi->getTTH()), qi);
if (!qi->isSet(QueueItem::FLAG_USER_LIST) && !qi->isSet(QueueItem::FLAG_CLIENT_VIEW) && !qi->isSet(QueueItem::FLAG_FINISHED)) {
dcassert(qi->getSize() >= 0);
queueSize += qi->getSize();
}
}
return ret;
}
示例3: getStringInfo
std::string QueueFileUtils::getStringInfo(const QueueItemPtr& aItem, int aPropertyName) noexcept {
switch (aPropertyName) {
case PROP_NAME: return getDisplayName(aItem);
case PROP_TARGET: return aItem->getTarget();
case PROP_TYPE: return Format::formatFileType(aItem->getTarget());
case PROP_STATUS: return formatDisplayStatus(aItem);
case PROP_PRIORITY: return AirUtil::getPrioText(aItem->getPriority());
case PROP_SOURCES: return formatFileSources(aItem);
case PROP_TTH: return aItem->getTTH().toBase32();
default: dcassert(0); return Util::emptyString;
}
}
示例4: remove
void FileQueue::remove(QueueItemPtr& qi) noexcept {
//TargetMap
auto f = queue.find(const_cast<string*>(&qi->getTarget()));
if (f != queue.end()) {
queue.erase(f);
if (!qi->isSet(QueueItem::FLAG_USER_LIST) && (!qi->isSet(QueueItem::FLAG_FINISHED) || !qi->getBundle()) && !qi->isSet(QueueItem::FLAG_CLIENT_VIEW)) {
dcassert(qi->getSize() >= 0);
queueSize -= qi->getSize();
}
}
dcassert(queueSize >= 0);
//TTHIndex
auto s = tthIndex.equal_range(const_cast<TTHValue*>(&qi->getTTH()));
dcassert(s.first != s.second);
auto k = find(s | map_values, qi);
if (k.base() != s.second) {
tthIndex.erase(k.base());
}
}
示例5: on
void FinishedManager::on(QueueManagerListener::Finished, const QueueItemPtr& qi, const string&, const DownloadPtr& p_download) noexcept
{
if (!ClientManager::isShutdown())
{
const bool isFile = !qi->isAnySet(QueueItem::FLAG_USER_LIST | QueueItem::FLAG_DCLST_LIST | QueueItem::FLAG_USER_GET_IP);
if (isFile)
{
PLAY_SOUND(SOUND_FINISHFILE);
}
if (isFile || (qi->isAnySet(QueueItem::FLAG_USER_LIST | QueueItem::FLAG_DCLST_LIST) && BOOLSETTING(LOG_FILELIST_TRANSFERS)))
{
auto item = std::make_shared<FinishedItem>(qi->getTarget(), p_download->getHintedUser(),
qi->getSize(), p_download->getRunningAverage(),
GET_TIME(), qi->getTTH(), p_download->getActual(), p_download->getUser()->getIPAsString());
if (SETTING(DB_LOG_FINISHED_DOWNLOADS))
{
CFlylinkDBManager::getInstance()->save_transfer_history(false, e_TransferDownload, item);
}
rotation_items(item, e_Download);
fly_fire2(FinishedManagerListener::AddedDl(), item, false);
log(p_download->getUser()->getCID(), qi->getTarget(), STRING(FINISHED_DOWNLOAD));
}
}
}
示例6: on
void FinishedManager::on(QueueManagerListener::Finished, const QueueItemPtr& qi, const string&, const HintedUser& aUser, int64_t aSpeed) noexcept {
if(!qi->isSet(QueueItem::FLAG_USER_LIST) || SETTING(LOG_FILELIST_TRANSFERS)) {
FinishedItemPtr item = new FinishedItem(qi->getTarget(), aUser, qi->getSize(), static_cast<int64_t>(aSpeed), GET_TIME(), qi->getTTH().toBase32());
{
Lock l(cs);
downloads.push_back(item);
}
fire(FinishedManagerListener::AddedDl(), item);
if(SETTING(SYSTEM_SHOW_DOWNLOADS)) {
size_t BUF_SIZE = STRING(FINISHED_DOWNLOAD).size() + UNC_MAX_PATH + 128;
char* buf = new char[BUF_SIZE];
snprintf(buf, BUF_SIZE, CSTRING(FINISHED_DOWNLOAD), Util::getFileName(qi->getTarget()).c_str(),
Util::toString(ClientManager::getInstance()->getNicks(aUser)).c_str());
LogManager::getInstance()->message(buf, LogManager::LOG_INFO);
delete[] buf;
}
}
}