本文整理汇总了C++中QueueItemPtr::isSet方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItemPtr::isSet方法的具体用法?C++ QueueItemPtr::isSet怎么用?C++ QueueItemPtr::isSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItemPtr
的用法示例。
在下文中一共展示了QueueItemPtr::isSet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on
void DirectoryListingManager::on(QueueManagerListener::ItemRemoved, const QueueItemPtr& qi, bool aFinished) noexcept {
if (!qi->isSet(QueueItem::FLAG_USER_LIST))
return;
auto u = qi->getSources()[0].getUser();
if (qi->isSet(QueueItem::FLAG_DIRECTORY_DOWNLOAD) && !aFinished)
removeDirectoryDownload(u, qi->getTempTarget(), qi->isSet(QueueItem::FLAG_PARTIAL_LIST));
if (qi->isSet(QueueItem::FLAG_CLIENT_VIEW)) {
DirectoryListingPtr dl = nullptr;
{
RLock l(cs);
auto p = viewedLists.find(u);
if (p == viewedLists.end()) {
dcassert(0);
return;
}
dl = p->second;
}
dl->onListRemovedQueue(qi->getTarget(), qi->getTempTarget(), aFinished);
bool closing = (dl->getClosing() || !dl->hasCompletedDownloads());
if (!aFinished && !dl->hasDownloads() && closing) {
removeList(u);
}
}
}
示例2: add
void FileQueue::add(QueueItemPtr& qi) noexcept {
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();
}
dcassert(queueSize >= 0);
queue.emplace(const_cast<string*>(&qi->getTarget()), qi);
tthIndex.emplace(const_cast<TTHValue*>(&qi->getTTH()), qi);
}
示例3:
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;
}
示例4: serializeFileProperty
json QueueFileUtils::serializeFileProperty(const QueueItemPtr& aFile, int aPropertyName) noexcept {
switch (aPropertyName) {
case PROP_SOURCES:
{
auto c = QueueManager::getInstance()->getSourceCount(aFile);
return Serializer::serializeSourceCount(c);
}
case PROP_STATUS:
{
return {
{ "finished", aFile->isSet(QueueItem::FLAG_FINISHED) },
{ "str", formatDisplayStatus(aFile) },
};
}
case PROP_PRIORITY: {
return Serializer::serializePriority(*aFile.get());
}
case PROP_TYPE:
{
return Serializer::serializeFileType(aFile->getTarget());
}
}
dcassert(0);
return nullptr;
}
示例5: on
void ViewFileManager::on(QueueManagerListener::ItemAdded, const QueueItemPtr& aQI) noexcept {
if (!isViewedItem(aQI)) {
return;
}
auto file = createFile(aQI->getTarget(), aQI->getTTH(), aQI->isSet(QueueItem::FLAG_TEXT), false);
if (file) {
file->onAddedQueue(aQI->getTarget(), aQI->getSize());
}
}
示例6: 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());
}
}
示例7: formatDisplayStatus
std::string QueueFileUtils::formatDisplayStatus(const QueueItemPtr& aItem) noexcept {
if (aItem->isSet(QueueItem::FLAG_FINISHED)) {
return STRING(FINISHED);
}
auto percentage = aItem->getPercentage(QueueManager::getInstance()->getDownloadedBytes(aItem));
if (aItem->isPausedPrio()) {
return STRING_F(PAUSED_PCT, percentage);
} else if (QueueManager::getInstance()->isWaiting(aItem)) {
return STRING_F(WAITING_PCT, percentage);
} else {
return STRING_F(RUNNING_PCT, percentage);
}
}
示例8: 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;
}
}
}
示例9: isViewedItem
bool ViewFileManager::isViewedItem(const QueueItemPtr& aQI) noexcept {
return aQI->isSet(QueueItem::FLAG_CLIENT_VIEW) && !aQI->isSet(QueueItem::FLAG_USER_LIST) && !aQI->isSet(QueueItem::FLAG_OPEN);
}