本文整理汇总了C++中Items::front方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::front方法的具体用法?C++ Items::front怎么用?C++ Items::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::front方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
ChartBase::
free_chart_items(Items& itms)
{
Item *temp;
while( !itms.empty() )
{
temp = itms.front();
//temp->check();
itms.pop_front();
//if(!temp->term()->terminal_p()) delete temp;
}
}
示例2: FetchFromItemsKey
//.........这里部分代码省略.........
result = FindMatchingItems(pool, firstKey);
if (part != firstKey) {
// supportlightninggems
QString secondKey = part.mid(gemType.length());
result = FindMatchingItems(result, secondKey);
}
}
}
}
}
pool = result;
}
}
// If no items were returned, bail out now!
if (result.size() == 0)
return replacement;
// Only select items from your stash unless specified
if (!options->contains("include.character")) {
result = from(result)
.where([](const std::shared_ptr<Item> item) { return item->location().type() == ItemLocationType::STASH; })
.toVector();
}
// Recheck
if (result.size() == 0)
return replacement;
if (containType == CONTAIN_TYPE_NONE && options->contains("wrap")) containType = CONTAIN_TYPE_WRAP;
if (containType == CONTAIN_TYPE_NONE && options->contains("group")) containType = CONTAIN_TYPE_GROUP;
switch (containType) {
case (CONTAIN_TYPE_WRAP): {
QString header = "Items";
Buyout buyout = {};
if (options->contains("header")) {
header = options->value("header");
}
const std::shared_ptr<Item> first = result.front();
if (parent_->buyout_manager().Exists(*first)) buyout = parent_->buyout_manager().Get(*first);
bool sameBuyout = from(result).all([this, buyout](const std::shared_ptr<Item> item) {
Buyout thisBuyout = {};
if (parent_->buyout_manager().Exists(*item)) thisBuyout = parent_->buyout_manager().Get(*item);
return BuyoutManager::Equal(thisBuyout, buyout);
});
if (sameBuyout) {
header += BuyoutManager::Generate(buyout);
}
QString temp;
WriteItems(result, &temp, !sameBuyout, includeNoBuyouts);
if (temp.isEmpty())
return replacement;
replacement += QString("[spoiler=\"%1\"]").arg(header);
replacement += temp;
replacement += "[/spoiler]";
break;
}
case CONTAIN_TYPE_GROUP: {
QMultiMap<Buyout, std::shared_ptr<Item>> itemsMap;
for (auto &item : result) {
Buyout b = {};
if (parent_->buyout_manager().Exists(*item))
b = parent_->buyout_manager().Get(*item);
itemsMap.insert(b, item);
}
for (Buyout b : itemsMap.uniqueKeys()) {
Items itemList = itemsMap.values(b).toVector().toStdVector();
if (itemList.size() == 0)
continue;
QString header = BuyoutManager::Generate(b);
if (header.isEmpty()) header = "Offers Accepted";
QString temp;
WriteItems(itemList, &temp, false, includeNoBuyouts);
if (temp.isEmpty())
continue;
replacement += QString("[spoiler=\"%1\"]").arg(header);
replacement += temp;
replacement += "[/spoiler]";
}
break;
}
default: {
WriteItems(result, &replacement, true, includeNoBuyouts);
break;
}
}
}
return replacement;
}