本文整理汇总了C++中ItemList::back方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::back方法的具体用法?C++ ItemList::back怎么用?C++ ItemList::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}