本文整理汇总了C++中Items::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::push_back方法的具体用法?C++ Items::push_back怎么用?C++ Items::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void RowCollection<Group,Hash>::getWholeRow(size_t rowId, Items& items, bool separateNull, uint32_t attrId, Items* pNullItems) {
assert(_mode==RowCollectionModeRead);
assert(separateNull || (pNullItems==NULL));
assert(items.empty());
if (pNullItems!=NULL) {
assert(pNullItems->empty());
}
boost::scoped_ptr<MyRowIterator> rowIterator(openRow(rowId));
items.reserve(_counts[rowId]);
TypeId strType = _attributes[attrId].getType();
DoubleFloatOther type = getDoubleFloatOther(strType);
while (!rowIterator->end()) {
vector<Value> item(_attributes.size());
rowIterator->getItem(item);
if (separateNull && isNullOrNan(item[attrId], type)) {
if (pNullItems!=NULL) {
pNullItems->push_back(item);
}
} else {
items.push_back(item);
}
++(*rowIterator);
}
}
示例2: FindMatchingItems
Items ShopTemplateManager::FindMatchingItems(const Items &items, QString keyword) {
Items matched;
for (auto &item : items) {
if (IsMatchingItem(item, keyword)) {
matched.push_back(item);
}
}
return matched;
}
示例3: filter
virtual Items filter(Items items, ISpecification<Product> &spec) override {
Items result;
for (auto &p : items) {
if (spec.is_satisfied(p)) {
result.push_back(p);
}
}
return result;
}
示例4: by_color_and_size
static Items by_color_and_size(Items items, Color color, Size size) {
Items results;
for (auto &i : items) {
if (i->size == size && i->color == color) {
results.push_back(i);
}
}
return results;
}
示例5: by_size
static Items by_size(Items items, Size size) {
Items results;
for (auto &i : items) {
if (i->size == size) {
results.push_back(i);
}
}
return results;
}
示例6: by_color
static Items by_color(Items items, Color color) {
Items results;
for (auto &i : items) {
if (i->color == color) {
results.push_back(i);
}
}
return results;
}
示例7: getSubItems
Items Item::getSubItems() const
{
// TODO Make this better
UsdPrimSiblingRange primChildren = m_prim.GetChildren();
Items children;
for ( const auto &child : primChildren )
{
children.push_back( Item( child ) );
}
return children;
}
示例8: items
StringsView::Items StringsView::items() const
{
Items options;
if ( 0x0 != _model )
{
typedef OptionsItemModel::Values Values;
Values values ( _model->values() );
for ( Values::const_iterator iter = values.begin(); iter != values.end(); ++iter )
{
options.push_back ( *iter );
}
}
return options;
}
示例9: add
void add(const Rectf& rect, const C& c)
{
if (m_depth > 8) // FIXME: max_depth shouldn't be hardcode
{
Object obj;
obj.rect = rect;
obj.data = c;
m_items.push_back(obj);
}
else
{
if (rect.right < m_center.x) // west
{
if (rect.bottom < m_center.y) // north
{
if (!m_nw.get())
{
m_nw.reset(new QuadTreeNode(m_depth+1, Rectf(m_bounding_rect.left, m_bounding_rect.top,
m_center.x, m_center.y)));
}
m_nw->add(rect, c);
}
else if(rect.top > m_center.y) // south
{
if (!m_sw.get())
{
m_sw.reset(new QuadTreeNode(m_depth+1, Rectf(m_bounding_rect.left, m_center.y,
m_center.x, m_bounding_rect.bottom)));
}
m_sw->add(rect, c);
}
else
{
Object obj;
obj.rect = rect;
obj.data = c;
m_items.push_back(obj);
}
}
else if (rect.left > m_center.x) // east
{
if (rect.bottom < m_center.y) // north
{
if (!m_ne.get())
{
m_ne.reset(new QuadTreeNode(m_depth+1, Rectf(m_center.x, m_bounding_rect.top,
m_bounding_rect.right, m_center.y)));
}
m_ne->add(rect, c);
}
else if(rect.top > m_center.y) // south
{
if (!m_se.get())
{
m_se.reset(new QuadTreeNode(m_depth+1, Rectf(m_center.x, m_center.y,
m_bounding_rect.right, m_bounding_rect.bottom)));
}
m_se->add(rect, c);
}
else
{
Object obj;
obj.rect = rect;
obj.data = c;
m_items.push_back(obj);
}
}
else
{
Object obj;
obj.rect = rect;
obj.data = c;
m_items.push_back(obj);
}
}
}
示例10: assert
Item*
Bchart::
edgesFromTree(InputTree* tree)
{
int b, b0;
b0 = tree->num();
const Term* trm = Term::get(tree->term());
assert(trm);
//cerr << "ARI " << *trm << " " << b0 << endl;
if(printDebug() > 1005)
cerr << "EFIE " << trm->name() << " " << b0 << endl;
/* If this is a terminal node, the rhs will be a word; otherwise it
will be a rule expansion consisting of several Item s.
*/
if(trm->terminal_p())
{
ECString tmpW1 = tree->word();
char chars[512];
ECString tmpW = toLower(tmpW1.c_str(), chars);
int wInt = wtoInt(tmpW);
Item* lhs = add_item(b0, trm, tree->start());
lhs->start() = tree->start();
lhs->finish() = tree->finish();
Item* rhs = add_item2(b0, trm, wInt,tmpW);
rhs->finish() = tree->finish();
rhs->start() = tree->start();
if(!lhs && !rhs)
{
return NULL;
}
Items subItems;
subItems.push_back(stops[tree->start()]);
subItems.push_back(rhs);
subItems.push_back(stops[tree->finish()]);
Edge* edg = add_edge(lhs, subItems);
if(!edg)
{
return NULL;
}
edg->prob() = pHst(wInt,trm->toInt());
edg->num() = b0;
if(printDebug() > 5)
cerr << "LHS " << *lhs << " " << tmpW << edg->prob() << endl;
return lhs;
}
else
{
Item* lhs = add_item(b0, trm, -1);
lhs->start() = tree->start();
lhs->finish() = tree->finish();
assert(lhs);
Items subItems;
subItems.push_back(stops[tree->start()]);
InputTreesIter iti = tree->subTrees().begin();
for( ; iti != tree->subTrees().end() ; iti++)
{
InputTree* stree = (*iti);
cerr << "WBA "<< stree->term() << *stree << endl;
Item* itm = edgesFromTree(stree);
if(!itm)
{
return NULL;
}
subItems.push_back(itm);
}
subItems.push_back(stops[tree->finish()]);
Edge* edg = add_edge(lhs, subItems);
if(!edg)
{
return false;
}
edg->num() = b0;
assignRProb(edg);
if (printDebug() > 5)
{
cerr << "Saw edge " << *edg << ": p=" << edg->prob() << endl;
}
//cerr << "endeFE " << *edg << endl;
return lhs;
rPendFactor();
}
}
示例11: if
QList<ShopTemplateManager::ShopTemplateSection> ShopTemplateManager::FetchFromItemsKey(const QString &key, const Items &items, QHash<QString, QString> *options) {
QList<ShopTemplateManager::ShopTemplateSection> result;
if (items.size() > 0){
Items matchingItems;
bool includeNoBuyouts = options->contains("include.ignored");
ShopTemplateContainType containType = CONTAIN_TYPE_NONE;
if (key == "everything") {
matchingItems = items;
}
else if (key.startsWith("stash:")) {
int index = key.indexOf(":");
QString name = (index + 1 >= key.length()) ? "" : key.mid(index + 1);
if (!name.isEmpty()) {
for (const std::shared_ptr<Item> &item : items) {
if (QString::fromStdString(item->location().GetLabel()).compare(name, Qt::CaseInsensitive) == 0) {
matchingItems.push_back(item);
}
}
}
}
else {
Items pool = items;
QStringList keyParts = key.split("+", QString::SkipEmptyParts);
for (QString part : keyParts) {
if (templateMatchers.contains(part)) {
matchingItems = FindMatchingItems(pool, part);
}
else {
// todo(novynn): phase these out? Prefer {Normal+Helmet} over {NormalHelmet}
bool matchedRarity = false;
const QStringList rarities = {"normal", "magic", "rare", "unique"};
for (QString rarity : rarities) {
if (part.startsWith(rarity)) {
QString type = part.mid(rarity.length());
matchingItems = FindMatchingItems(pool, rarity);
matchingItems = FindMatchingItems(matchingItems, type);
matchedRarity = true;
}
}
if (matchedRarity) continue;
if (part.endsWith("gems")) {
if (part == "gems" || part == "allgems") {
matchingItems = FindMatchingItems(pool, "gems");
}
else {
const QStringList gemTypes = {"AoE", "Attack", "Aura", "Bow", "Cast", "Chaining", "Chaos",
"Cold", "Curse", "Duration", "Fire", "Lightning", "Melee", "Mine", "Minion",
"Movement", "Projectile", "Spell", "Totem", "Trap", "Support"};
for (QString gemType : gemTypes) {
if (!part.startsWith(gemType, Qt::CaseInsensitive)) continue;
// This will never just be first key (?)
QString firstKey = gemType.toLower() + "gems";
matchingItems = FindMatchingItems(pool, firstKey);
if (part != firstKey) {
// supportlightninggems
QString secondKey = part.mid(gemType.length());
matchingItems = FindMatchingItems(matchingItems, secondKey);
}
}
}
}
}
pool = matchingItems;
}
}
// Only select items from your stash unless specified
if (!options->contains("include.character")) {
matchingItems = Items::fromStdVector(
from(matchingItems.toStdVector())
.where([](const std::shared_ptr<Item> item) { return item->location().type() == ItemLocationType::STASH; })
.toVector()
);
}
if (matchingItems.size() == 0)
return result;
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 = matchingItems.first();
if (parent_->buyout_manager().Exists(*first)) buyout = parent_->buyout_manager().Get(*first);
//.........这里部分代码省略.........
示例12: easyBlock
//.........这里部分代码省略.........
item->setData(COL_NCALLS_PER_THREAD, Qt::UserRole, per_thread_stats->calls_number);
item->setText(COL_NCALLS_PER_THREAD, QString::number(per_thread_stats->calls_number));
if (_thread)
{
auto percentage_per_thread = ::profiler_gui::percent(per_thread_stats->total_duration, _thread->selfDuration());
item->setData(COL_PERCENT_SUM_PER_THREAD, Qt::UserRole, percentage_per_thread);
item->setText(COL_PERCENT_SUM_PER_THREAD, QString::number(percentage_per_thread));
}
if (per_parent_stats->calls_number > 1 || !EASY_GLOBALS.display_only_relevant_stats)
{
item->setTimeSmart(COL_MIN_PER_PARENT, per_parent_stats->min_duration, "min ");
item->setTimeSmart(COL_MAX_PER_PARENT, per_parent_stats->max_duration, "max ");
item->setTimeSmart(COL_AVERAGE_PER_PARENT, per_parent_stats->average_duration());
item->setTimeSmart(COL_DURATION_SUM_PER_PARENT, per_parent_stats->total_duration);
}
item->setData(COL_NCALLS_PER_PARENT, Qt::UserRole, per_parent_stats->calls_number);
item->setText(COL_NCALLS_PER_PARENT, QString::number(per_parent_stats->calls_number));
if (per_frame_stats->calls_number > 1 || !EASY_GLOBALS.display_only_relevant_stats)
{
item->setTimeSmart(COL_MIN_PER_FRAME, per_frame_stats->min_duration, "min ");
item->setTimeSmart(COL_MAX_PER_FRAME, per_frame_stats->max_duration, "max ");
item->setTimeSmart(COL_AVERAGE_PER_FRAME, per_frame_stats->average_duration());
item->setTimeSmart(COL_DURATION_SUM_PER_FRAME, per_frame_stats->total_duration);
}
item->setData(COL_NCALLS_PER_FRAME, Qt::UserRole, per_frame_stats->calls_number);
item->setText(COL_NCALLS_PER_FRAME, QString::number(per_frame_stats->calls_number));
}
else
{
if (_frame == nullptr && _thread != nullptr)
{
auto percentage_per_thread = ::profiler_gui::percent(duration, _thread->selfDuration());
item->setData(COL_PERCENT_PER_PARENT, Qt::UserRole, percentage_per_thread);
item->setText(COL_PERCENT_PER_PARENT, QString::number(percentage_per_thread));
}
else
{
item->setData(COL_PERCENT_PER_PARENT, Qt::UserRole, 0);
}
item->setData(COL_PERCENT_SUM_PER_PARENT, Qt::UserRole, 0);
item->setData(COL_PERCENT_SUM_PER_THREAD, Qt::UserRole, 0);
}
const auto color = easyDescriptor(child.node->id()).color();
//const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color));
const auto fgColor = ::profiler_gui::textColorForRgb(color);// 0x00ffffff - bgColor;
item->setBackgroundColor(color);
item->setTextColor(fgColor);
auto item_index = static_cast<uint32_t>(_items.size());
_items.push_back(item);
size_t children_items_number = 0;
::profiler::timestamp_t children_duration = 0;
if (!child.children.empty())
{
children_items_number = FillTreeClass<T>::setTreeInternal(_safelocker, _items, _beginTime, child.children, item, _frame ? _frame : item, _thread, _left, _right, _strict, children_duration, _colorizeRows);
if (_safelocker.interrupted())
break;
}
int percentage = 100;
auto self_duration = duration - children_duration;
if (children_duration > 0 && duration > 0)
{
percentage = ::profiler_gui::percent(self_duration, duration);
}
item->setTimeSmart(COL_SELF_DURATION, self_duration);
item->setData(COL_SELF_DURATION_PERCENT, Qt::UserRole, percentage);
item->setText(COL_SELF_DURATION_PERCENT, QString::number(percentage));
if (children_items_number > 0 || !_strict || (startTime >= _left && endTime <= _right))
{
total_items += children_items_number + 1;
gui_block.tree_item = item_index;
if (_colorizeRows)
item->colorize(_colorizeRows);
if (gui_block.expanded)
item->setExpanded(true);
}
else
{
_items.pop_back();
delete item;
}
}
return total_items;
}
示例13: rootname
//.........这里部分代码省略.........
item->setTimeSmart(COL_MAX_PER_PARENT, per_parent_stats->max_duration, "max ");
item->setTimeSmart(COL_AVERAGE_PER_PARENT, per_parent_stats->average_duration());
item->setTimeSmart(COL_DURATION_SUM_PER_PARENT, per_parent_stats->total_duration);
}
item->setData(COL_NCALLS_PER_PARENT, Qt::UserRole, per_parent_stats->calls_number);
item->setText(COL_NCALLS_PER_PARENT, QString::number(per_parent_stats->calls_number));
if (per_frame_stats->calls_number > 1 || !EASY_GLOBALS.display_only_relevant_stats)
{
item->setTimeSmart(COL_MIN_PER_FRAME, per_frame_stats->min_duration, "min ");
item->setTimeSmart(COL_MAX_PER_FRAME, per_frame_stats->max_duration, "max ");
item->setTimeSmart(COL_AVERAGE_PER_FRAME, per_frame_stats->average_duration());
item->setTimeSmart(COL_DURATION_SUM_PER_FRAME, per_frame_stats->total_duration);
}
item->setData(COL_NCALLS_PER_FRAME, Qt::UserRole, per_frame_stats->calls_number);
item->setText(COL_NCALLS_PER_FRAME, QString::number(per_frame_stats->calls_number));
}
else
{
item->setData(COL_PERCENT_SUM_PER_THREAD, Qt::UserRole, 0);
item->setText(COL_PERCENT_SUM_PER_THREAD, "");
}
const auto color = easyDescriptor(gui_block.tree.node->id()).color();
//const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color));
const auto fgColor = ::profiler_gui::textColorForRgb(color);//0x00ffffff - bgColor;
item->setBackgroundColor(color);
item->setTextColor(fgColor);
auto item_index = static_cast<unsigned int>(_items.size());
_items.push_back(item);
size_t children_items_number = 0;
::profiler::timestamp_t children_duration = 0;
if (!gui_block.tree.children.empty())
{
children_items_number = FillTreeClass<T>::setTreeInternal(_safelocker, _items, _beginTime, gui_block.tree.children, item, item, thread_item, _left, _right, _strict, children_duration, _colorizeRows);
if (_safelocker.interrupted())
break;
}
int percentage = 100;
auto self_duration = duration - children_duration;
if (children_duration > 0 && duration > 0)
{
percentage = static_cast<int>(0.5 + 100. * static_cast<double>(self_duration) / static_cast<double>(duration));
}
item->setTimeSmart(COL_SELF_DURATION, self_duration);
item->setData(COL_SELF_DURATION_PERCENT, Qt::UserRole, percentage);
item->setText(COL_SELF_DURATION_PERCENT, QString::number(percentage));
if (children_items_number > 0 || !_strict || (startTime >= _left && endTime <= _right))
{
//total_items += children_items_number + 1;
gui_block.tree_item = item_index;
if (_colorizeRows)
item->colorize(_colorizeRows);
if (gui_block.expanded)
item->setExpanded(true);
示例14: addItems
// adds all items in the Items vector
void PopupMenu::addItems( Items& in, Items& items )
{
for( PopupMenu::Items::iterator i = items.begin();
i != items.end(); ++i )
in.push_back( *i );
}
示例15: addItem
//statics
void PopupMenu::addItem( Items& in, const std::string& name, int id )
{
in.push_back( PopupMenu::Item( name, id ) );
}