本文整理汇总了C++中Items类的典型用法代码示例。如果您正苦于以下问题:C++ Items类的具体用法?C++ Items怎么用?C++ Items使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Items类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: headPosFromItems
int
Bchart::
headPosFromItems(Item* lhs, Items& rhs)
{
int ansPriority = 9999;
ECString lhsString(lhs->term()->name());
if(lhsString == "") lhsString = "S1";
int pos = -1;
int ans = -1;
Items::iterator ii = rhs.begin();
Item *subi;
for( ; ii != rhs.end() ; ii++ )
{
subi = (*ii);
pos++;
const Term* trm = subi->term();
int nextPriority = 12;
if(trm)
{
ECString rhsString(subi->term()->name());
if(subi->term() == Term::stopTerm) continue;
nextPriority = headPriority(lhsString, rhsString, ansPriority);
}
if(nextPriority <= ansPriority)
{
ans = pos;
ansPriority = nextPriority;
}
}
return ans;
}
示例2: 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);
}
}
示例3: main
int main()
{
string commandLine = "start";
while (commandLine != "exit")
{
cout << "$ ";
getline(cin ,commandLine);
if(commandLine != "exit")
{
string temp;
for (istringstream tString1(commandLine); tString1 >> temp; )
{
int type = 0;
bool detectCon = false;
vector<string> arr;
detectCon = add_com(arr, temp, type);
while (!detectCon && !tString1.eof())
{
tString1 >> temp;
detectCon = add_com(arr, temp, type);
}
Items* complCom = new Command();
Items* complCon;
complCom->set_command(arr);
if (type == 0 || type == -1) {complCon = new Always();}
else if (type == 2) {complCon = new Failure();}
else if (type == 1) {complCon = new Success();}
complCon->set_before(complCom);
}
}
示例4: WriteItems
QStringList ShopTemplateManager::WriteItems(const Items &items, bool includeBuyoutTag, bool includeNoBuyouts) {
Items sorted = items;
QStringList result;
// Sort to ensure that the template matches even if the item order is different.
std::sort(sorted.begin(), sorted.end(), [](const std::shared_ptr<Item> &first, const std::shared_ptr<Item> &second) -> bool {
return first->PrettyName() > second->PrettyName();
});
for (auto &item : sorted) {
if (item->location().socketed())
continue;
if (parent_->buyout_manager().Exists(*item)) {
Buyout bo = parent_->buyout_manager().Get(*item);
QString temp = QString::fromStdString(item->location().GetForumCode(parent_->league()));
if (includeBuyoutTag)
temp += BuyoutManager::Generate(bo);
result << temp;
}
else if (includeNoBuyouts) {
result << QString::fromStdString(item->location().GetForumCode(parent_->league()));
}
}
return result;
}
示例5: 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;
}
示例6: MergeFrom
void Items::MergeFrom(const Items& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from._has_bit(0)) {
set_ret(from.ret());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: mapitems
DFhackCExport command_result mapitems (Core * c, vector <string> & parameters)
{
c->Suspend();
vector <df_item *> vec_items;
Gui * g = c-> getGui();
Maps* m = c->getMaps();
Items* it = c->getItems();
if(!m->Start())
{
c->con.printerr("No map to probe\n");
return CR_FAILURE;
}
if(!it->Start() || !it->readItemVector(vec_items))
{
c->con.printerr("Failed to get items\n");
return CR_FAILURE;
}
int32_t cx,cy,cz;
g->getCursorCoords(cx,cy,cz);
if(cx != -30000)
{
df_block * b = m->getBlock(cx/16,cy/16,cz);
if(b)
{
c->con.print("Item IDs present in block:\n");
auto iter_b = b->items.begin();
while (iter_b != b->items.end())
{
df_item * itmz = it->findItemByID(*iter_b);
string s;
itmz->getItemDescription(&s);
c->con.print("%d = %s\n",*iter_b, s.c_str());
iter_b++;
}
c->con.print("Items under cursor:\n");
auto iter_it = vec_items.begin();
while (iter_it != vec_items.end())
{
df_item * itm = *iter_it;
if(itm->x == cx && itm->y == cy && itm->z == cz)
{
string s;
itm->getItemDescription(&s,0);
c->con.print("%d = %s\n",itm->id, s.c_str());
}
iter_it ++;
}
}
}
c->Resume();
return CR_OK;
}
示例12: 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;
}
示例13: SetNode
void ItemsList::SetNode(Items* argu){
if(nCount==0){
Items* inow;
inow = argu;
inow->SetPrev(pStart);
inow->SetNext(pEnd);
pStart->SetNext(inow);
pEnd->SetPrev(inow);
}
else{
Items* inow;
pListPrev = pStart;
inow = pStart->GetNext();
while(inow->GetNext()!=NULL){
pListPrev = inow;
inow = inow->GetNext();
}
inow = argu;
inow->SetPrev(pListPrev);
pListPrev->SetNext(inow);
inow->SetNext(pEnd);
pEnd->SetPrev(inow);
pEnd->SetNext(NULL);
}
nCount++;
}
示例14: free_chart_items
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;
}
}
示例15: UpdateItemCounts
void Search::UpdateItemCounts(const Items &items) {
unfiltered_item_count_ = items.size();
filtered_item_count_total_ = 0;
for (auto &item : items_)
filtered_item_count_total_ += item->count();
}