本文整理汇总了C++中ItemList::emplace_back方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::emplace_back方法的具体用法?C++ ItemList::emplace_back怎么用?C++ ItemList::emplace_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::emplace_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: protect
void
TrafficListWidget::UpdateList()
{
assert(filter_widget != nullptr);
items.clear();
last_update.Clear();
const TCHAR *callsign = filter_widget->GetValueString(CALLSIGN);
if (!StringIsEmpty(callsign)) {
FlarmId ids[30];
unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);
for (unsigned i = 0; i < count; ++i)
AddItem(ids[i]);
} else {
/* if no filter was set, show a list of current traffic and known
traffic */
/* add live FLARM traffic */
for (const auto &i : CommonInterface::Basic().flarm.traffic.list) {
AddItem(i.id);
}
/* add FLARM peers that have a user-defined color */
for (const auto &i : traffic_databases->flarm_colors) {
Item &item = AddItem(i.first);
item.color = i.second;
}
/* add FLARM peers that have a user-defined name */
for (const auto &i : traffic_databases->flarm_names) {
AddItem(i.id);
}
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
/* show SkyLines traffic unless this is a FLARM traffic picker
dialog (from dlgTeamCode) */
if (action_listener == nullptr) {
const auto &data = tracking->GetSkyLinesData();
const ScopeLock protect(data.mutex);
for (const auto &i : data.traffic) {
items.emplace_back(i.first, i.second.location);
Item &item = items.back();
if (i.second.location.IsValid() &&
CommonInterface::Basic().location_available)
item.vector = GeoVector(CommonInterface::Basic().location,
i.second.location);
}
}
#endif
}
GetList().SetLength(items.size());
UpdateVolatile();
UpdateButtons();
}
示例2: FindItem
/**
* Add a new item to the list, unless the given FLARM id already
* exists.
*/
Item &AddItem(FlarmId id) {
auto existing = FindItem(id);
if (existing != items.end())
return *existing;
items.emplace_back(id);
return items.back();
}
示例3: TrafficListWidget
TrafficListWidget(ActionListener &_action_listener,
const FlarmId *array, size_t count)
:action_listener(&_action_listener), filter_widget(nullptr),
buttons(nullptr) {
items.reserve(count);
for (unsigned i = 0; i < count; ++i)
items.emplace_back(array[i]);
}
示例4: EditGroup
bool QueueEditor::EditGroup(NzbInfo* nzbInfo, DownloadQueue::EEditAction action, int offset, const char* text)
{
ItemList itemList;
bool allPaused = true;
int id = nzbInfo->GetId();
// collecting files belonging to group
for (FileInfo* fileInfo : nzbInfo->GetFileList())
{
itemList.emplace_back(fileInfo, nullptr, 0);
allPaused &= fileInfo->GetPaused();
}
if (action == DownloadQueue::eaGroupDelete ||
action == DownloadQueue::eaGroupParkDelete ||
action == DownloadQueue::eaGroupDupeDelete ||
action == DownloadQueue::eaGroupFinalDelete)
{
nzbInfo->SetDeleting(true);
nzbInfo->SetParking(action == DownloadQueue::eaGroupParkDelete &&
g_Options->GetKeepHistory() > 0 &&
!nzbInfo->GetUnpackCleanedUpDisk() &&
nzbInfo->GetCurrentSuccessArticles() > 0);
nzbInfo->SetAvoidHistory(action == DownloadQueue::eaGroupFinalDelete);
nzbInfo->SetDeletePaused(allPaused);
if (action == DownloadQueue::eaGroupDupeDelete)
{
nzbInfo->SetDeleteStatus(NzbInfo::dsDupe);
}
nzbInfo->SetCleanupDisk(action != DownloadQueue::eaGroupParkDelete);
}
DownloadQueue::EEditAction GroupToFileMap[] = {
(DownloadQueue::EEditAction)0,
DownloadQueue::eaFileMoveOffset,
DownloadQueue::eaFileMoveTop,
DownloadQueue::eaFileMoveBottom,
DownloadQueue::eaFilePause,
DownloadQueue::eaFileResume,
DownloadQueue::eaFileDelete,
DownloadQueue::eaFilePauseAllPars,
DownloadQueue::eaFilePauseExtraPars,
DownloadQueue::eaFileReorder,
DownloadQueue::eaFileSplit,
DownloadQueue::eaFileMoveOffset,
DownloadQueue::eaFileMoveTop,
DownloadQueue::eaFileMoveBottom,
DownloadQueue::eaFilePause,
DownloadQueue::eaFileResume,
DownloadQueue::eaFileDelete,
DownloadQueue::eaFileDelete,
DownloadQueue::eaFileDelete,
DownloadQueue::eaFileDelete,
DownloadQueue::eaFilePauseAllPars,
DownloadQueue::eaFilePauseExtraPars,
(DownloadQueue::EEditAction)0,
(DownloadQueue::EEditAction)0,
(DownloadQueue::EEditAction)0,
(DownloadQueue::EEditAction)0 };
bool ok = InternEditList(&itemList, nullptr, GroupToFileMap[action], offset, text);
if ((action == DownloadQueue::eaGroupDelete || action == DownloadQueue::eaGroupDupeDelete || action == DownloadQueue::eaGroupFinalDelete) &&
// NZBInfo could have been destroyed already
m_downloadQueue->GetQueue()->Find(id))
{
DownloadQueue::Aspect deleteAspect = { DownloadQueue::eaNzbDeleted, m_downloadQueue, nzbInfo, nullptr };
m_downloadQueue->Notify(&deleteAspect);
}
return ok;
}