当前位置: 首页>>代码示例>>C++>>正文


C++ ItemList类代码示例

本文整理汇总了C++中ItemList的典型用法代码示例。如果您正苦于以下问题:C++ ItemList类的具体用法?C++ ItemList怎么用?C++ ItemList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ItemList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createLoot

bool MonsterType::createChildLoot(Container* parent, const LootBlock& lootBlock)
{
	LootItems::const_iterator it = lootBlock.childLoot.begin();
	if(it == lootBlock.childLoot.end())
		return true;

	ItemList items;
	for(; it != lootBlock.childLoot.end() && !parent->full(); ++it)
	{
		items = createLoot(*it);
		if(items.empty())
			continue;

		for(ItemList::iterator iit = items.begin(); iit != items.end(); ++iit)
		{
			Item* tmpItem = *iit;
			if(Container* container = tmpItem->getContainer())
			{
				if(createChildLoot(container, *it))
					parent->__internalAddThing(tmpItem);
				else
					delete container;
			}
			else
				parent->__internalAddThing(tmpItem);
		}
	}

	return !parent->empty();
}
开发者ID:milbradt,项目名称:TFS,代码行数:30,代码来源:monsters.cpp

示例2: transferToDepot

bool House::transferToDepot(Player* player)
{
	if (townid == 0 || houseOwner == 0) {
		return false;
	}

	ItemList moveItemList;
	for (HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it) {
		if (const TileItemVector* items = (*it)->getItemList()) {
			for (ItemVector::const_iterator iit = items->begin(), iend = items->end(); iit != iend; ++iit) {
				Item* item = *iit;
				if (item->isPickupable()) {
					moveItemList.push_back(item);
				} else {
					Container* container = item->getContainer();
					if (container) {
						for (ItemDeque::const_iterator cit = container->getItems(); cit != container->getEnd(); ++cit) {
							moveItemList.push_back(*cit);
						}
					}
				}
			}
		}
	}

	for (ItemList::iterator it = moveItemList.begin(); it != moveItemList.end(); ++it) {
		Item* item = *it;
		g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER,
		                        item, item->getItemCount(), NULL, FLAG_NOLIMIT);
	}

	return true;
}
开发者ID:nclx,项目名称:forgottenserver,代码行数:33,代码来源:house.cpp

示例3: READ_STRING

std::auto_ptr<OfflineJob> qmimap4::CopyOfflineJob::create(qs::InputStream* pStream)
{
	wstring_ptr wstrFolderFrom;
	READ_STRING(WSTRING, wstrFolderFrom);
	if (!wstrFolderFrom.get())
		return std::auto_ptr<OfflineJob>(0);
	
	wstring_ptr wstrFolderTo;
	READ_STRING(WSTRING, wstrFolderTo);
	if (!wstrFolderTo.get())
		return std::auto_ptr<OfflineJob>(0);
	
	unsigned int nSize = 0;
	READ(&nSize, sizeof(nSize));
	if (nSize == 0)
		return std::auto_ptr<OfflineJob>(0);
	UidList listUidFrom;
	listUidFrom.resize(nSize);
	ItemList listItemTo;
	listItemTo.resize(nSize);
	READ(&listUidFrom[0], nSize*sizeof(UidList::value_type));
	READ(&listItemTo[0], nSize*sizeof(ItemList::value_type));
	
	bool bMove = false;
	READ(&bMove, sizeof(bMove));
	
	return std::auto_ptr<OfflineJob>(new CopyOfflineJob(wstrFolderFrom.get(),
		wstrFolderTo.get(), listUidFrom, listItemTo, bMove));
}
开发者ID:snakamura,项目名称:q3,代码行数:29,代码来源:offlinejob.cpp

示例4: setupBodies

bool KSIImpl::setupBodies()
{
    if(TRACE_FUNCTIONS){
        cout << "KSIImpl::setupBodies()" << endl;
    }
    
    mainFrameRate = 0;
    bodyUnits.clear();
    
    WorldItemPtr worldItem = self->findOwnerItem<WorldItem>();
    if(worldItem){
        ItemList<BodyItem> bodyItems = worldItem->getBodyItems();
        for(size_t i=0; i < bodyItems.size(); ++i){
            BodyUnit unit;
            if(unit.initialize(bodyItems[i])){
                bodyUnits.push_back(unit);
                if(unit.frameRate > mainFrameRate){
                    mainFrameRate = unit.frameRate;
                }
            }
        }
    }

    return (!bodyUnits.empty() && mainFrameRate > 0);
}
开发者ID:SeishoIrie,项目名称:choreonoid-deb,代码行数:25,代码来源:KinematicsSimulatorItem.cpp

示例5: qWarning

void AbstractSortingStrategy::check(AbstractGroupableItem *itemToCheck)
{
    AbstractGroupableItem *item;
    if (!itemToCheck) {
        item = dynamic_cast<AbstractGroupableItem *>(sender());
    } else {
        item = itemToCheck;
    }

    if (!item) {
        qWarning() << "invalid item" << itemToCheck;
        return;
    }
    //qDebug() << item->name();

    if (item->itemType() == TaskItemType) {
        if (!(qobject_cast<TaskItem*>(item))->task()) { //ignore startup tasks
            return;
        }
    }

    if (!item->parentGroup()) {
        //qDebug() << "No parent group";
        return;
    }

    ItemList sortedList = item->parentGroup()->members();
    sortItems(sortedList);

    int oldIndex = item->parentGroup()->members().indexOf(item);
    int newIndex = sortedList.indexOf(item);
    if (oldIndex != newIndex) {
        item->parentGroup()->moveItem(oldIndex, newIndex);
    }
}
开发者ID:cmacq2,项目名称:plasma-workspace,代码行数:35,代码来源:abstractsortingstrategy.cpp

示例6: Listing

bool EditableSceneBodyImpl::storeProperties(Archive& archive)
{
    ListingPtr states = new Listing();

    ItemList<BodyItem> bodyItems;
    bodyItems.extractChildItems(RootItem::instance());
    
    for(size_t i=0; i < bodyItems.size(); ++i){
        BodyItem* bodyItem = bodyItems[i];
        EditableSceneBody* sceneBody = bodyItem->existingSceneBody();
        if(sceneBody){
            ValueNodePtr id = archive.getItemId(bodyItem);
            if(id){
                EditableSceneBodyImpl* impl = sceneBody->impl;
                MappingPtr state = new Mapping();
                state->insert("bodyItem", id);
                state->write("showCenterOfMass", impl->isCmVisible);
                state->write("showZmp", impl->isZmpVisible);
                states->append(state);
            }
        }
    }
    if(!states->empty()){
        archive.insert("editableSceneBodies", states);
        return true;
    }
    return false;
}
开发者ID:orikuma,项目名称:choreonoid,代码行数:28,代码来源:EditableSceneBody.cpp

示例7: executeCheckedScriptItems

void ScriptBar::executeCheckedScriptItems()
{
    ItemList<ScriptItem> scripts = ItemTreeView::mainInstance()->checkedItems<ScriptItem>();
    for(int i=0; i < scripts.size(); ++i){
        scripts[i]->execute();
    }
}
开发者ID:kayusawa,项目名称:choreonoid,代码行数:7,代码来源:ScriptBar.cpp

示例8: transferToDepot

bool House::transferToDepot(Player* player) const
{
	if (townid == 0 || owner == 0) {
		return false;
	}

	ItemList moveItemList;
	for (HouseTile* tile : houseTiles) {
		if (const TileItemVector* items = tile->getItemList()) {
			for (Item* item : *items) {
				if (item->isPickupable()) {
					moveItemList.push_back(item);
				} else {
					Container* container = item->getContainer();
					if (container) {
						for (Item* containerItem : container->getItemList()) {
							moveItemList.push_back(containerItem);
						}
					}
				}
			}
		}
	}

	for (Item* item : moveItemList) {
		g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER, item, item->getItemCount(), nullptr, FLAG_NOLIMIT);
	}
	return true;
}
开发者ID:HeavenIsLost,项目名称:ChronusServer,代码行数:29,代码来源:house.cpp

示例9: foreach

    /**
     * Calculate prefix paths that end with a node that has the given ItemID.
     * These nodes can be retrieved very quickly using the FPTree's itemPaths.
     * A prefix path is a list of Items that reflects a path from the bottom
     * of the tree to the root (but excluding the root), following along the
     * path of an FPNode that has the ItemID itemID. Because it is a list of
     * Items, it also includes both the ItemID and the SupportCount. The
     * original SupportCount of the Item encapsulated by the FPNode is erased
     * and replaced by the SupportCount of the FPNode we started from, i.e. a
     * node that has the ItemID itemID, because we're looking at only the
     * paths that include this node.
     * Exclude the leaf node itself, as it will no longer be needed.
     */
    QList<ItemList> FPTree::calculatePrefixPaths(ItemID itemID) const {
        QList<ItemList> prefixPaths;
        ItemList prefixPath;
        FPNode<SupportCount> * node;
        SupportCount supportCount;
        Item item;

        QList<FPNode<SupportCount> *> leafNodes = this->getItemPath(itemID);
        foreach (FPNode<SupportCount> * leafNode, leafNodes) {
            // Build the prefix path starting from the given leaf node, by
            // traversing up the tree (but do not include the leaf node's item
            // in the prefix path).
            // Don't copy the item's original count, but the count of the leaf
            // node instead, because we're looking at only the paths that
            // include this leaf node.
            node = leafNode;
            supportCount = leafNode->getValue();
            while ((node = node->getParent()) != NULL && node->getItemID() != ROOT_ITEMID) {
                item.id = node->getItemID();
                item.supportCount = supportCount;
                prefixPath.prepend(item);
            }

            // Store the built prefix path & clear it, so we can calculate the
            // next. Of course only if there *is* a prefix path, which is not
            // the case if the given itemID is at the root level.
            if (prefixPath.size() > 0) {
                prefixPaths.append(prefixPath);
                prefixPath.clear();
            }
        }
开发者ID:AlbertBaggios,项目名称:wpoanalytics,代码行数:44,代码来源:FPTree.cpp

示例10: FindItem

  /**
   * Find an existing item by its FLARM id.  This is a simple linear
   * search that doesn't scale well with a large list.
   */
  gcc_pure
  ItemList::iterator FindItem(FlarmId id) {
    assert(id.IsDefined());

    return std::find_if(items.begin(), items.end(),
                        [id](const Item &item) { return item.id == id; });
  }
开发者ID:henrik1g,项目名称:XCSoar,代码行数:11,代码来源:TrafficList.cpp

示例11: updatePartList

void GraphViewBaseImpl::updatePartList()
{
    treeWidget.clear();

    int numParts = 0;
    if(!itemInfos.empty()){
        ItemList<Item> items;
        for(list<ItemInfo>::iterator p = itemInfos.begin(); p != itemInfos.end(); ++p){
            items.push_back(p->item.get());
        }
        numParts = self->currentNumParts(items);
    }
    
    for(int i=0; i < numParts; ++i){
        PartItem* partItem = new PartItem();
        partItem->setText(0, QString::number(i));
        partItem->setTextAlignment(0, Qt::AlignHCenter);
        partItem->index = i;
        treeWidget.addTopLevelItem(partItem);
    }

    treeWidget.header()->updateGeometry();
    treeWidget.updateGeometry();

    updateSelections();
}
开发者ID:arntanguy,项目名称:choreonoid,代码行数:26,代码来源:GraphViewBase.cpp

示例12: sortItems

void DesktopSortingStrategy::sortItems(ItemList &items)
{
    GroupManager *gm = qobject_cast<GroupManager *>(parent());
    qStableSort(items.begin(), items.end(), (gm && gm->separateLaunchers()) ?
                DesktopSortingStrategy::lessThanSeperateLaunchers :
                DesktopSortingStrategy::lessThan);
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:7,代码来源:desktopsortingstrategy.cpp

示例13:

// LinkItems - This function is the main entry point into linking. It takes a
// list of LinkItem which indicates the order the files should be linked and
// how each file should be treated (plain file or with library search). The
// function only links bitcode and produces a result list of items that are
// native objects. 
bool
Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
  // Clear the NativeItems just in case
  NativeItems.clear();

  // For each linkage item ...
  for (ItemList::const_iterator I = Items.begin(), E = Items.end();
       I != E; ++I) {
    if (I->second) {
      // Link in the library suggested.
      bool is_native = false;
      if (LinkInLibrary(I->first, is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    } else {
      // Link in the file suggested
      bool is_native = false;
      if (LinkInFile(sys::Path(I->first), is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    }
  }

  return false;
}
开发者ID:32bitmicro,项目名称:llvm,代码行数:32,代码来源:LinkItems.cpp

示例14: raiseZ

void ItemDocument::raiseZ(const ItemList & itemList) {
	if (m_zOrder.empty()) slotUpdateZOrdering();

	if (m_zOrder.empty()) return;

	IntItemMap::iterator begin = m_zOrder.begin();
	IntItemMap::iterator previous = m_zOrder.end();
	IntItemMap::iterator it = --m_zOrder.end();

	do {
		Item *previousData = (previous == m_zOrder.end()) ? 0 : previous->second;
		Item *currentData = it->second;

		if (currentData && previousData && itemList.contains(currentData) && !itemList.contains(previousData)) {
			previous->second = currentData;
			it->second = previousData;
		}

		previous = it;

		--it;
	} while (previous != begin);

	slotUpdateZOrdering();
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:25,代码来源:itemdocument.cpp

示例15: readCollisionData

void CollisionSeq::readCollisionData(int nFrames, const Listing& values)
{
    /*
    WorldItem* worldItem = collisionSeqItem_->findOwnerItem<WorldItem>();
    if(!worldItem)
        return;
    */
    WorldItem* worldItem = 0;
    RootItem* rootItem = RootItem::instance();
    ItemList<WorldItem> worldItems;
    if(worldItems.extractChildItems(rootItem)){
        worldItem = worldItems.front();
    }
    if(!worldItem)
        return;

    for(int i=0; i < nFrames; ++i){
        const Mapping& frameNode = *values[i].toMapping();
        const Listing& linkPairs = *frameNode.findListing("LinkPairs");
        Frame f = frame(i);
        f[0] = std::make_shared<CollisionLinkPairList>();
        for(int j=0; j<linkPairs.size(); j++){
            CollisionLinkPairPtr destLinkPair = std::make_shared<CollisionLinkPair>();
            const Mapping& linkPair = *linkPairs[j].toMapping();
            string body0name = linkPair["body0"].toString();
            string body1name = linkPair["body1"].toString();
            string link0name = linkPair["link0"].toString();
            string link1name = linkPair["link1"].toString();
            BodyItem* body0Item = worldItem->findChildItem<BodyItem>(body0name);
            Body* body0=0;
            Body* body1=0;
            Link* link0=0;
            Link* link1=0;
            if(body0Item){
                body0 = body0Item->body();
                link0 = body0->link(link0name);
            }
            BodyItem* body1Item = worldItem->findChildItem<BodyItem>(body1name);
            if(body1Item){
                body1 = body1Item->body();
                link1 = body1->link(link1name);
            }
            destLinkPair->body[0] = body0;
            destLinkPair->link[0] = link0;
            destLinkPair->body[1] = body1;
            destLinkPair->link[1] = link1;
            const Listing& collisions = *linkPair.findListing("Collisions");
            for(int k=0; k<collisions.size(); k++){
                destLinkPair->collisions.push_back(Collision());
                Collision& destCol = destLinkPair->collisions.back();
                const Listing& collision = *collisions[k].toListing();
                destCol.point = Vector3(collision[0].toDouble(), collision[1].toDouble(), collision[2].toDouble());
                destCol.normal = Vector3(collision[3].toDouble(), collision[4].toDouble(), collision[5].toDouble());
                destCol.depth = collision[6].toDouble();
            }
            f[0]->push_back(destLinkPair);
        }
    }
}
开发者ID:s-nakaoka,项目名称:choreonoid,代码行数:59,代码来源:CollisionSeq.cpp


注:本文中的ItemList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。