Project::Item Project::Item::findItemForFile (const File& file) const { if (getFile() == file) return *this; if (isGroup()) { for (int i = getNumChildren(); --i >= 0;) { Item found (getChild(i).findItemForFile (file)); if (found.isValid()) return found; } } return Item (project, ValueTree::invalid); }
QList<JabberSearchManager::Item> JabberSearchManager::FromStandardItems (const QDomElement& items) { QList<Item> result; QDomElement item = items.firstChildElement ("item"); while (!item.isNull ()) { result << Item (item.attribute ("jid"), item.firstChildElement ("first").text (), item.firstChildElement ("last").text (), item.firstChildElement ("nick").text (), item.firstChildElement ("email").text ()); item = item.nextSiblingElement ("item"); } return result; }
void XmlToQtScript::FilterQtInternalsPostProcessor::process(Item* iterator, QList<Item>* in) { if(m_internalClasses.contains(iterator->targetClass)) { // qDebug() << Q_FUNC_INFO << "Skipping" << iterator->target << iterator->targetClass << iterator->method << iterator->parameters; *iterator = Item(); if(in->first().method == "msec") { in->takeFirst(); } } /* else if(!iterator->target.isNull()) { qDebug() << Q_FUNC_INFO << "Keeping" << iterator->target << iterator->targetClass; } */ }
Project::Item Project::Item::findItemWithID (const String& targetId) const { if (state [Ids::ID] == targetId) return *this; if (isGroup()) { for (int i = getNumChildren(); --i >= 0;) { Item found (getChild(i).findItemWithID (targetId)); if (found.isValid()) return found; } } return Item (project, ValueTree(), false); }
void luCameraObjProperty::RefreshChildren() { if ( !GetChildCount() ) return; const luCameraObjProps& obj = luCameraObjPropsRefFromVariant(m_value); Item(PROP_CLIPSTART)->SetValue(double(obj.props.m_clipstart)); Item(PROP_CLIPEND)->SetValue(double(obj.props.m_clipend)); Item(PROP_FOV)->SetValue(double(obj.props.m_fov)); Item(PROP_ORTHOSCALE)->SetValue(double(obj.props.m_orthoscale)); Item(PROP_START)->SetValue(obj.props.m_start); Item(PROP_TYPE)->SetValue(obj.props.m_type); }
void HiRes1Engine::initGameState() { _state.vars.resize(IDI_HR1_NUM_VARS); StreamPtr stream(_files->createReadStream(IDS_HR1_EXE_1)); // Load room data from executable _roomDesc.clear(); stream->seek(IDI_HR1_OFS_ROOMS); for (uint i = 0; i < IDI_HR1_NUM_ROOMS; ++i) { Room room; stream->readByte(); _roomDesc.push_back(stream->readByte()); for (uint j = 0; j < 6; ++j) room.connections[j] = stream->readByte(); room.picture = stream->readByte(); room.curPicture = stream->readByte(); _state.rooms.push_back(room); } // Load item data from executable stream->seek(IDI_HR1_OFS_ITEMS); byte id; while ((id = stream->readByte()) != 0xff) { Item item = Item(); item.id = id; item.noun = stream->readByte(); item.room = stream->readByte(); item.picture = stream->readByte(); item.isLineArt = stream->readByte(); item.position.x = stream->readByte(); item.position.y = stream->readByte(); item.state = stream->readByte(); item.description = stream->readByte(); stream->readByte(); byte size = stream->readByte(); for (uint i = 0; i < size; ++i) item.roomPictures.push_back(stream->readByte()); _state.items.push_back(item); } }
BSTR cADOCE::Name(long Col) { ////////////////////////////////////////////////////////////// // Return the Name of a Field ////////////////////////////////////////////////////////////// BSTR bstrData; IADOCEField* TargetField; // Get the Field. TargetField = Item(Col); if(TargetField) hr = TargetField->get_Name(&bstrData); // Return the NAME of the field return bstrData; }
void RelinkingModel::addPath(RelinkablePath const& path) { QString const normalized_path(path.normalizedPath()); std::pair<std::set<QString>::iterator, bool> const ins( m_origPathSet.insert(path.normalizedPath()) ); if (!ins.second) { // Not inserted because identical path is already there. return; } beginInsertRows(QModelIndex(), m_items.size(), m_items.size()); m_items.push_back(Item(path)); endInsertRows(); requestStatusUpdate(index(m_items.size() - 1)); }
unsigned int CRsltVariable::GetNoUsedID() { int count=Count(); for(unsigned int ii=1;ii<1000;ii++) { bool bNoUse=true; for(int jj=0;jj<count;jj++) { if(Item(jj)->GetID()==ii) { bNoUse=false; break; } } if(bNoUse) return ii; } return 0; }
void GridWindow::update(const std::vector<Item>& items) { unsigned int x,y; x=y=0; items_in_grid.clear(); for(auto it : items) { grid.appendItem(x,y,it.gid, 0); grid.appendItem(x,y,710,1); items_in_grid.push_back(Item(x,y,it.gid, it.id)); if(x < grid.getSize().x) ++x; if(x == grid.getSize().x) { x=0; ++y; } } }
void cPlayer::FinishEating(void) { // Reset the timer: m_EatingFinishTick = -1; // Send the packets: m_ClientHandle->SendEntityStatus(*this, esPlayerEatingAccepted); m_World->BroadcastEntityMetadata(*this); // consume the item: cItem Item(GetEquippedItem()); Item.m_ItemCount = 1; cItemHandler * ItemHandler = cItemHandler::GetItemHandler(Item.m_ItemType); if (!ItemHandler->EatItem(this, &Item)) { return; } ItemHandler->OnFoodEaten(m_World, this, &Item); }
void Parser::expand_symbol_into_itemset(ItemSet* is, std::string symbol, std::set<std::string>* encountered_terminals) { if (Parser::symbol_is_token(symbol)) { std::cout << "=== expand symbol into itemset: token " << symbol << std::endl; return; } else { // if new symbol was inserted if (encountered_terminals->insert(symbol).second) { std::cout << "=== expand symbol into itemset: new nonterminal " << symbol << std::endl; for (Production* p : this->nonterminals.at(symbol)) { std::cout << "\t"; Parser::debug_production(p); is->additionals.insert(Item(p, 0)); this->expand_symbol_into_itemset(is, p->symbols.front(), encountered_terminals); } } else { std::cout << "=== expand symbol into itemset: existing nonterminal " << symbol << std::endl; } } }
bool CPageAntispamSink::OnClicked(CItemBase* pItem) { FolderInfo_t * pFolder = NULL; sswitch(pItem->m_strItemId.c_str()) scase("CS_Browse") pFolder = &m_ser->CertainSpamRule.FolderForAction; sbreak; scase("PS_Browse") pFolder = &m_ser->PossibleSpamRule.FolderForAction; sbreak; scase("Link") _Module.ShowAntiSpamSettings(); sbreak send if( pFolder ) { UpdateData(false); if(CBrowseForFolder(m_arrLocalFolders, pFolder, m_hTreeImageList).DoModal(Item(), "OutlookPlugun.Antispam.Browse") == DLG_ACTION_OK) { UpdateData(true); } } return TBaseDlg::OnClicked(pItem); }
void ParserContext::msgReady(uint64_t id, McMsgRef msg) { TimePoint now = Clock::now(); evictOldItems(now); std::string invKey; if (id != 0) { auto pairMsgIt = msgs_.find(id); if (pairMsgIt != msgs_.end()) { invKey = std::move(pairMsgIt->second.key); msgs_.erase(pairMsgIt->first); } if (msg->key.len > 0) { auto msgIt = msgs_.emplace( id, Item(id, to<std::string>(msg->key), now)); evictionQueue_.push_back(msgIt.first->second); } } callback_(id, std::move(msg), std::move(invKey), fromAddress_, toAddress_); }
COleVariant cADOCE::GetValue(long Col) { ///////////////////////////////////// // Return the value of a field ///////////////////////////////////// COleVariant vData; IADOCEField* TargetField; // Get the Field. TargetField = Item(Col); // Retrieve the field Value if(TargetField) hr = TargetField->get_Value(&vData); // Return the value return vData; }
STDMETHODIMP CompositeOverlayImpl<B>::get_Overlays(LPSAFEARRAY *pVal) { short count; Count(&count); SAFEARRAY *pArray = ::SafeArrayCreateVector(VT_DISPATCH, 0, count); IOverlay *pOverlay; long indices[1]; for (int i=0; i<count; i++) { indices[0] = i; Item(CComVariant(i), &pOverlay); ::SafeArrayPutElement(pArray, indices, pOverlay); pOverlay->Release(); } *pVal = pArray; return S_OK; }
void CProcMonSniffDlg::OnEvent(tDWORD nEventId, cSerializable * pData) { if( nEventId == cCalcSecurityRatingProgress::eIID && pData && pData->isBasedOn(cCalcSecurityRatingProgress::eIID) ) { cCalcSecurityRatingProgress *srp = (cCalcSecurityRatingProgress *)pData; if( srp->m_nActionId == cCalcSecurityRatingProgress::eCloseNotification ) { Close(); return; } if( m_info.m_nPID == srp->m_nPID ) { m_info = *srp; Item()->UpdateData(true); return; } return; } CDialogSink::OnEvent(nEventId, pData); }
STDMETHODIMP CompositeOverlayImpl<B>::clone(IOverlay **pRet) { SimpleOverlayImpl2<B>::clone(pRet); B **pB = (B**)pRet; short count = 0; Count(&count); for (int i=0; i<count; i++) { IOverlay *pItem; Item(CComVariant(i), &pItem); IOverlay *pClone; pItem->clone(&pClone); (*pB)->Add(pClone); pItem->Release(); } return S_OK; }
void Furnace::consumeFuel() { // Check that we have fuel if(slots()[SLOT_FUEL].count == 0) return; // Increment the fuel burning time based on fuel type // http://www.minecraftwiki.net/wiki/Furnace#Fuel_efficiency Item *fuelSlot = &slots()[SLOT_FUEL]; uint16_t fuelTime = 0; switch(fuelSlot->type) { case ITEM_COAL: fuelTime = 80; break; case BLOCK_PLANK: fuelTime = 15; break; case ITEM_STICK: fuelTime = 5; break; case BLOCK_WOOD: fuelTime = 15; break; case BLOCK_WORKBENCH: fuelTime = 15; break; case BLOCK_CHEST: fuelTime = 15; break; case BLOCK_BOOKSHELF: fuelTime = 15; break; case BLOCK_JUKEBOX: fuelTime = 15; break; case BLOCK_FENCE: fuelTime = 15; break; case BLOCK_WOODEN_STAIRS: fuelTime = 15; break; case ITEM_LAVA_BUCKET: fuelTime = 1000; break; default: break; } if(fuelTime > 0) { data->burnTime += fuelTime; // Now decrement the fuel & reset fuelSlot->count--; if (fuelSlot->count == 0) { *fuelSlot = Item(); } } // Update our block type if need be updateBlock(); }
void Game::doFill() { if (object != verb) { Item toFill = player->getItem(object); if (toFill.first != "NOITEM") { if (checkAction(toFill, FILL)) { cout << "What do you want to fill the " << object << " with?" << endl; cout << ">"; getline(cin, object); Item result = room_list[current_room]->getItem(object); if (checkAction(result, FILL)) { room_list[current_room]->changeState(toFill.first); cout << "You filled the " << toFill.first << " with " << object << endl; if (toFill.first.compare("bottle") == 0) { player->removeItem("bottle"); player->pickItem(Item("water", { PUT })); } } else { cout << "You can't fill the " << toFill.first << " with a " << object << endl; return; } } else cout << "You can't fill a " << toFill.first << endl; } else cout << "You don't have a " << object << endl; } else { cout << "What do you want to fill?" << endl; cout << ">"; getline(cin, object); doFill(); } }
bool Texture::load( const std::string& filaname ) { Ref ref; // Reference to the Item we'll be working on. // We only need to reset if we're referencing a texture. if( key.size() ) { reset(); } key = filaname; ref = get_ref(); // If this Item already exists, and is loaded, we're all set. if( ref != -1u && ref < registery.size() && registery[ref].refCount++ != 0 ) return true; // Otherwise, make it. registery.push_back( Item(key,0,1) ); ref = registery.size() - 1; glGenTextures( 1, ®istery[ref].glHandle ); // Use SDL to lead the image for simplicity. SDL_Surface* sdlSurface = SDL_LoadBMP( filaname.c_str() ); if( sdlSurface ) { gen_texture( registery[ref].glHandle, sdlSurface ); SDL_FreeSurface( sdlSurface ); ok = true; } else { ok = false; } return ok; }
void Furnace::smelt() { // Check if we're cooking if (isCooking()) { // Convert where applicable Item* inputSlot = &slots()[SLOT_INPUT]; Item* fuelSlot = &slots()[SLOT_FUEL]; Item* outputSlot = &slots()[SLOT_OUTPUT]; int32_t creationID = createList[inputSlot->getType()].output; // Update other params if we actually converted if (creationID != -1 && outputSlot->getCount() != 64) { // Check if the outputSlot is empty if (outputSlot->getType() == -1) { outputSlot->setType(creationID); outputSlot->setCount(1); outputSlot->setHealth(createList[inputSlot->getType()].meta); inputSlot->setCount(inputSlot->getCount() - 1); m_data->cookTime = 0; } // Ok - now check if the current output slot contains the same stuff if (outputSlot->getType() == creationID && m_data->cookTime != 0) { // Increment output and decrememnt the input source outputSlot->setCount(outputSlot->getCount() + createList[inputSlot->getType()].count); inputSlot->setCount(inputSlot->getCount() - 1); outputSlot->setHealth(createList[inputSlot->getType()].meta); m_data->cookTime = 0; if (inputSlot->getCount() == 0) { *inputSlot = Item(); } } } } }
void Game::doPut() { if (object != verb) { Item toPut = player->getItem(object); if (toPut.first != "NOITEM") { if (checkAction(toPut, PUT)) { cout << "Where do you want to put the " << object << " in?" << endl; cout << ">"; getline(cin, object); Item result = room_list[current_room]->getItem(object); if (checkAction(result, PUT)) { room_list[current_room]->changeState(toPut.first); cout << "You put the " << toPut.first << " in the " << object << endl; if (toPut.first.compare("water") == 0) { player->removeItem("water"); player->pickItem(Item("bottle", { PICK, DROP, FILL })); } } else { cout << "You can't put the " << toPut.first << " in the " << object << endl; return; } } else cout << "You can't put a " << toPut.first << endl; } else cout << "You don't have a " << object << endl; } else { cout << "What do you want to put?" << endl; cout << ">"; getline(cin, object); doPut(); } }
/* 函 数 名 称 GetNoUsedID 所 属 类 CResultS 功 能 说 明 取得在当前对象集合中所有直接子对象未用的最小ID号,ID号从1开始。当前集合中的一直接子对象被删除后,它同时释放它所占用的ID号,即在同一个集合中所有的直接子对象的ID号是唯一的,但ID号可以被复用。 参 数 参数名称 类 型 参数说明 tInt TIntStruct 存放着所要寻找的对象位置的结构 bSelFirstStat bool 是否在寻找所指位置对象的第一个叶对象 返 回 值 返回当前集合中所有直接子对象未用的最小ID号 */ unsigned int CResultS::GetNoUsedID() { int count=Count(); for(unsigned int ii=1;ii<1000;ii++) //yzmModify 取序号应该从1开始 { bool bNoUse=true; for(int jj=0;jj<count;jj++) { CResult* pResult=Item(jj); unsigned int id=pResult->GetID(); if(id==ii) { bNoUse=false; break; } } if(bNoUse) return ii; } return 0; }
// マップでのメニューを担当する(ここの返り値が0ならメニューが表示されていない1なら表示されている。) // ここを最初に読み込むMainMenu()が先じゃないぞ int Menu( Character_t *Character, Map_t Map, int *FieldNumber ){ if(CheckHitKey2( KEY_INPUT_C )==1)if(MapMenu[0].Flag==0)MapMenu[0].Flag=1; if( MapMenu[0].Flag==1 )MainMenu(); // メニューが開いた時の処理,ここで選択 if( MapMenu[1].Flag==1 )Search(); // 調べるの動作 if( MapMenu[2].Flag==1 )Item(); // アイテムの動作 if( MapMenu[3].Flag==1 )Magic( Map, FieldNumber); // 呪文の動作 if( MapMenu[4].Flag==1 )StatusMenu( Character ); // ステータス画面の描画 //削除の処理はここ if( CheckHitKey2( KEY_INPUT_X )== 1 && MapMenu[1].Flag!=1 )for( int i=0;i<5;i++)MapMenu[i].Flag=0; //メニューが表示されているときは勇者を動かさないということ //なぜMapMenu[0]だけかというとこれがトップ画面なのでずっと出っ放し。 //必ずメニューを描画しているときはこのフラグは1 if(MapMenu[0].Flag==1)return 1; return 0; }
void CMailWasherDlg::OnProcessMsg(tDWORD nEventId, cPOP3Message *pMsg) { if(!pMsg) { ((CDialogItem *)Item())->Activate(); if(m_Progressbar) m_Progressbar->Show(false); if(m_Toolbar) m_Toolbar->Enable(true); UpdateState(); m_bCanClose = cTRUE; return; } if(m_Progress) m_Progress->SetInt(++m_nOperationsCompleted * 100 / m_nOperationsNeed); switch(nEventId) { case pm_MESSAGE_FOUND: OnNewMessage(pMsg); break; case pm_MESSAGE_DELETED: OnDeleteMessage(pMsg); break; } UpdateState(); }
/** * Find the Canonical set for the grammar. */ void Parser::findCanonicalSet() { std::set<char> symbols; auto current_item = Item(getStartProduction(), START_POS); auto current_closure = findClosure({current_item}); _canon.insert(LRSet(current_closure, 0, '\0')); symbols = setUnion(_terminals, _non_terminals); int counter = 1; bool changed; do { changed = false; for (auto item : _canon) { for (auto symbol : symbols) { auto new_set = findGoto(item.data, symbol); if (!new_set.empty() && !isIn(_canon, new_set)) { _canon.insert({new_set, counter, symbol}); changed = true; ++counter; } } } } while (changed); }
void DBObjTable::DeleteField(DBObjTableField *delField) { DBInt i, recID, fieldID; DBObjRecord *record; DBObjTableField *field; unsigned char *data; for (fieldID = 0; fieldID < FieldPTR->ItemNum(); ++fieldID) { field = FieldPTR->Item(fieldID); if (field->StartByte() > delField->StartByte()) field->StartByte(field->StartByte() - delField->Length()); } for (recID = 0; recID < ItemNum(); ++recID) { record = Item(recID); data = (unsigned char *) record->Data() + delField->StartByte(); for (i = 0; i < RecordLengthVAR - delField->StartByte() - delField->Length(); ++i) data[i] = data[i + delField->Length()]; record->Realloc(RecordLengthVAR - delField->Length()); } FieldPTR->Remove(delField); RecordLengthVAR -= delField->Length(); delete delField; }
CRsltVariable* CResult::GetFirstItem() { if(Count()<=0) return NULL; CRsltVariable* pVariable=Item(0); switch(pVariable->GetType()) { case RSLT_VARIABLE: //结果类型-变量结果 return pVariable->GetFirstItem(); break; case RSLT_ELEMENTTEXT: //结果类型-基元素文本结果 case RSLT_ELEMENTTABLE: //结果类型-基元素表结果 case RSLT_ELEMENTPLOT: //结果类型-基元素图结果 return (CRsltVariable*)pVariable; break; default: return NULL; } return NULL; }
CRsltVariable* CRsltVariable::GetFirstItem() { if(Count()<=0) return (CRsltVariable*)this; CRsltVariable* pEle=Item(0); switch(pEle->GetType()) { case RSLT_VARIABLE: return ((CRsltVariable*)pEle)->GetFirstItem(); break; case RSLT_ELEMENTTEXT: case RSLT_ELEMENTTABLE: case RSLT_ELEMENTPLOT: return pEle; break; default: return NULL; } return NULL; }