void Document::createTerm() { // 특수 문자 및 개행 문자 등을 제거 한다 std::string clearContents = Utils::RemoveSpecialCharacter(getContents()); // Tokenize std::vector<std::string> keywords = Utils::Tokenize(clearContents); for (int i = 0; i < keywords.size(); i++) { std::string keyword = keywords[i]; auto mapIterator = mTermsMap.find(keyword); if (mapIterator == mTermsMap.end()) { // 새로운 Term 을 생성한다 mTermsMap.insert(std::make_pair(keyword, Term(keyword))); } else { // 이미 존재하는 Term 이므로, 기존의 Term 의 Frequency 값을 1 증가한다. mapIterator->second.increaseFrequency(1); // 위치 정보를 추가 한다. mapIterator->second.addOffset(i); } } }
void NitroFile::enableCache() { iprintf("Caching: "); print(); cached = true; cacheModified = false; cachedContents = getContents(); }
void Container::destroyContents(){ for(Component::Ref childRef : getContents()) { // don't use the children directly, but use this virtual function getContents to work with specialized types. Component::destroy(childRef.get()); } // getGUI().markForRemoval(*it); // this->clear(); }
void post(state *s,int U_Bit,int L_Bit,uint32_t inst){ int I_Bit = bitCheck(inst,25); uint32_t offset = getOp2(s,inst,!I_Bit); uint32_t rd = getRD(inst); uint32_t rn = getRN(inst); uint32_t rnValue = getContents(s,rn); uint32_t rdValue = getContents(s,rd); uint32_t memLoc = getContents(s,rn); uint32_t memValue; if(rn == 15){ memLoc = s-> PC; memLoc += offset; } int type = typeofAddress(memLoc,s->Special_Memory); if(memLoc > 16380 && type == NOT_GPIO){ printf("Error: Out of bounds memory access at address 0x%08x\n",memLoc); return; } if(type != 0 && L_Bit == 0){ handleGPIOTypes(type); return; }else if(type != 0 && L_Bit == 1){ memValue = s->Special_Memory[type-1]; handleGPIOTypes(type); }else{ memValue = (memLoc%4 == 0) ? s-> ARM_mem[memLoc/4] : getUnallignedWord(memLoc,s); } if(U_Bit == 1){ switch(L_Bit){ case(0) : writeMem(s,rdValue,memLoc); add_offset(s,rn,offset); break; case(1) : writeReg(s,rd,memValue); add_offset(s,rn,offset); break; default : perror("Error in post"); break; } }else{ switch(L_Bit){ case(0) : writeMem(s,rdValue,memLoc); subtract_offset(s,rn,offset); break; case(1) : writeReg(s,rd,memValue); add_offset(s,rn,offset); break; default : perror("Error in post"); break; } } }
void fn_mkdir (inode_state& state, const wordvec& words){ DEBUGF ('c', state); DEBUGF ('c', words); if (words.size() <= 0){ cout << "mkdir: missing operand" << endl; return; } //root case? if (words[1] == "/"){ inode_ptr ogcwd = state.getCwd(); auto root = state.getCwd()->getContents()->mkdir(words[1]); root->getContents()->setPath("..", ogcwd); root->getContents()->setPath(".", root); return; } wordvec pathvec = split(words[1], "/"); string dirname = *(pathvec.end()-1); string fullpath = ""; for (auto it = pathvec.begin(); it != pathvec.end()-1; ++it) fullpath += (*it + "/"); inode_ptr res = resolvePath(fullpath,state.getCwd()); if (res == nullptr) return; inode_ptr directory = res->getContents()->getNode(dirname); if (directory != nullptr && res != nullptr) //if filename exists and path exists //dont overwrite anything (ie file or directory) return; inode_ptr dir = res->getContents()->mkdir(dirname); dir->getContents()->setPath("..", res); dir->getContents()->setPath(".",res->getContents()->getNode(dirname)); /*if (state.getCwd()->getContents()->getNode(filename) != nullptr) return; */ /* inode_ptr ogcwd = state.getCwd(); for (auto it = words.begin()+1; it != words.end(); ++it){ auto newDir = state.getCwd()->getContents()->mkdir(*it); newDir->getContents()->setPath("..", ogcwd); newDir->getContents()->setPath(".", newDir); } */ }
unsigned char* FileUtils::getFileData(const std::string& filename, const char* mode, ssize_t *size) { CCASSERT(!filename.empty() && size != nullptr && mode != nullptr, "Invalid parameters."); (void)(mode); // mode is unused, as we do not support text mode any more... Data d; if (getContents(filename, &d) != Status::OK) { *size = 0; return nullptr; } return d.takeBuffer(size); }
void TestRecurrentTransaction::testGetContents() { auto contents = QString("Dinner with friends"); auto numberOfDays = 3; auto amount = .45; auto account = std::make_shared<PublicAccount>("Test account", .0, ""); auto category = std::make_shared<com::chancho::Category>("Sushi", com::chancho::Category::Type::EXPENSE); auto transactionPtr = std::make_shared<com::chancho::Transaction>(account, amount, category); transactionPtr->contents = contents; auto recurrentPtr = std::make_shared<com::chancho::RecurrentTransaction>(transactionPtr, std::make_shared<com::chancho::RecurrentTransaction::Recurrence>(numberOfDays, QDate::currentDate())); auto qmlTransaction = std::make_shared<com::chancho::tests::PublicRecurrentTransaction>(recurrentPtr); QCOMPARE(qmlTransaction->getContents(), contents); }
HTTP::Response Browser::get(string url) { HTTP::Response res; History.push_back(url); log.push_back(url); res = UserAgent::request("GET", url,""); //cout << getContents() << endl; ps = Parser(getContents()); _setlinks(); return res; }
FUNCTION int Q4JX(obj it) { if(containedBy(it) != NULL()) { return(0x01); } if(!thinksItsAtHome(it)) { return(0x01); } int i; int Q56F; int Q5E7; int Q55X = 0x02; int myObjType = getObjType(it); list Q4E5; list Q5JX; obj Q4Q1; loc Q4VS = loc( getLocation(it) ); int Q60E; loc there; getContents(Q4E5, it); if(isInArea("alchemist", Q4VS, 0x00)) { Q5JX = list( 0x0F06, 0x0F07, 0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x0E9B ); } if(isInArea("armorer", Q4VS, 0x00)) { Q5JX = list( 0x13BB, 0x13C0, 0x1413, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B7A, 0x1B7B ); } if(isInArea("artisanguild", Q4VS, 0x00)) { Q5JX = list( 0x0FC1, 0x0FB4, 0x13E3, 0x13E4, 0x0FBB, 0x0FBC, 0x14FB, 0x14FC, 0x14FD, 0x14FE, 0x1EB8, 0x1EB9, 0x1EBA, 0x1EBB, 0x12B3, 0x1224, 0x139A, 0x1225, 0x1226, 0x139B, 0x139C, 0x12CA, 0x12CB, 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C ); } if(isInArea("baker", Q4VS, 0x00)) { Q5JX = list( 0x1043, 0x1039, 0x1045, 0x103B, 0x103C, 0x098C ); } if(isInArea("bard", Q4VS, 0x00)) { Q5JX = list( 0x0EB2, 0x0EB3, 0x0EB4, 0x0E9C, 0x0E9D, 0x0E9E ); } if(isInArea("blacksmith", Q4VS, 0x00)) { Q5JX = list( 0x13E3, 0x13E4, 0x0FBB, 0x0FBC, 0x0FB4, 0x0FB5, 0x1876, 0x1877, 0x1878, 0x1879, 0x0FB6, 0x19B8, 0x19B9, 0x19BA, 0x19B7, 0x1BEF, 0x18C5, 0x0FB2, 0x106D, 0x0FB8 ); } if(isInArea("blacksmith", Q4VS, 0x00)) { Q5JX = list( 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F ); } if(isInArea("butcher", Q4VS, 0x00)) { Q5JX = list( 0x0EC3, 0x0EC2, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608 ); } if((isInArea("carpenter", Q4VS, 0x00)) || (isInArea("woodworker", Q4VS, 0x00))) { Q5JX = list( 0x1026, 0x1029, 0x1028, 0x102A, 0x102B, 0x102C, 0x102D, 0x102E, 0x102F, 0x1030, 0x1031, 0x1032, 0x1033, 0x1034, 0x1035, 0x1BD7, 0x10E4, 0x1BDD, 0x10E5, 0x10E6, 0x10E7 ); } if(isInArea("cemetery", Q4VS, 0x00)) { Q5JX = list( 0x1CDD, 0x1CE5, 0x1CE0, 0x1CE8, 0x1CE1, 0x1CE9, 0x1CEF, 0x1CF0, 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, 0x1B11, 0x1B12, 0x1B13, 0x1B14, 0x1B15, 0x1B16, 0x1B17, 0x1B18, 0x1B19, 0x1B1A, 0x1B1B, 0x1B1C, 0x0ECA, 0x0ED2, 0x0ECB, 0x0ECC, 0x0ECD, 0x0ECE, 0x0ECF, 0x0ED0, 0x0ED1 ); } if((isInArea("clothier", Q4VS, 0x00)) || (isInArea("tailor", Q4VS, 0x00))) { Q5JX = list( 0x0DF9, 0x0DF8, 0x0E1D, 0x0E1E, 0x0E1F, 0x0FA0, 0x1761, 0x1762, 0x1763, 0x1764, 0x0FA9, 0x1068, 0x1067 ); } if(isInArea("cobbler", Q4VS, 0x00)) { Q5JX = list( 0x170B, 0x170F, 0x1710, 0x170D, 0x170E, 0x1711 ); } if(isInArea("customs", Q4VS, 0x00)) { Q5JX = list( 0x00018D45, 0x00018D46, 0x00018D47, 0x00018D48, 0x00018D49, 0x00018D4A, 0x00018D4B, 0x00018D4C, 0x00018D4D, 0x00018D4E, 0x00018D4F, 0x00018D50, 0x00018D51, 0x00018D52, 0x00018D53, 0x00018D54, 0x00018D55, 0x00018D56, 0x00018D57, 0x00018D58, 0x00018D59, 0x00018D5A, 0x00018D5B, 0x00018D5C, 0x00018D5D, 0x00018D5E, 0x00018D5F, 0x00018D60 ); } if(isInArea("docks", Q4VS, 0x00)) { Q5JX = list( 0x0DBF, 0x0DC0, 0x0DD6, 0x0DD7, 0x09CC, 0x09CD, 0x09CE, 0x09CF ); } if(isInArea("farm", Q4VS, 0x00)) { Q5JX = list( 0x1517, 0x152E, 0x1516, 0x1F01, 0x1715, 0x170D, 0x170E, 0x13F8, 0x13F9, 0x0E87, 0x0E88, 0x13F5, 0x13F4, 0x0E76, 0x0DE1, 0x0C70, 0x0C6E, 0x0C61, 0x09D3, 0x0978, 0x1609, 0x0F36, 0x09F0 ); } if(isInArea("fighterguild", Q4VS, 0x00)) { Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x0F3F ); } if((isInArea("guard", Q4VS, 0x00)) || (isInArea("paladin", Q4VS, 0x00))) { Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x0F3F ); } if(isInArea("healer", Q4VS, 0x00)) { Q5JX = list( 0x0EE9, 0x0E9B, 0x0F0C ); } if(isInArea("herbalist", Q4VS, 0x00)) { Q5JX = list( 0x0F84, 0x0F85, 0x0F86, 0x0F90, 0x0C3C, 0x0C3E, 0x0C40, 0x0C42 ); } if(isInArea("inn", Q4VS, 0x00)) { Q5JX = list( 0x0A1D, 0x0F64, 0x0A28 ); } if(isInArea("jeweler", Q4VS, 0x00)) { Q5JX = list( 0x1086, 0x108A, 0x108B, 0x1087, 0x1085, 0x1088, 0x1089, 0x0F0F, 0x0F10, 0x0F11, 0x0F13, 0x0F15, 0x0F16, 0x0F18, 0x0F25, 0x0F26 ); } if(isInArea("library", Q4VS, 0x00)) { Q5JX = list( 0x0FEF, 0x0FF0, 0x0FF1, 0x0FF2 ); } if(isInArea("mag", Q4VS, 0x00)) { Q5JX = list( 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F35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, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA, 0x0EFA ); } if(isInArea("merchant", Q4VS, 0x00)) { Q5JX = list( 0x097E, 0x097D, 0x097C, 0x09B5, 0x09CC, 0x09CD, 0x09CE, 0x09CF, 0x097A, 0x097B, 0x09D0, 0x171F, 0x1720, 0x1721, 0x1722, 0x1723, 0x1724, 0x1725, 0x1726, 0x1727, 0x09D1, 0x1728, 0x1729, 0x172A, 0x172B, 0x172C, 0x172D, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608, 0x0C5C, 0x0C5D, 0x0C61, 0x0C62, 0x0C63, 0x0C64, 0x0C65, 0x0C66, 0x0C67, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C70, 0x0C71, 0x0C72, 0x0C73, 0x0C74, 0x0C75, 0x0C78, 0x0C79, 0x0C7A, 0x0C7B, 0x0C7C, 0x0C7F, 0x0C80, 0x0C81, 0x0C82 ); } if(isInArea("mill", Q4VS, 0x00)) { Q5JX = list( 0x1039 ); } if(isInArea("mine", Q4VS, 0x00)) { Q5JX = list( 0x0E86, 0x0E85, 0x18C5, 0x0FB2, 0x1BEF, 0x106D, 0x0F39, 0x0F3A ); } if(isInArea("observatory", Q4VS, 0x00)) { Q5JX = list( 0x1058, 0x1057, 0x104B, 0x104C, 0x14F5, 0x00018D45, 0x00018D46, 0x00018D47, 0x00018D48, 0x00018D49, 0x00018D4A, 0x00018D4B, 0x00018D4C, 0x00018D4D, 0x00018D4E, 0x00018D4F, 0x00018D50, 0x00018D51, 0x00018D52, 0x00018D53, 0x00018D54, 0x00018D55, 0x00018D56, 0x00018D57, 0x00018D58, 0x00018D59, 0x00018D5A, 0x00018D5B, 0x00018D5C, 0x00018D5D, 0x00018D5E, 0x00018D5F, 0x00018D60 ); } if(isInArea("painter", Q4VS, 0x00)) { Q5JX = list( 0x0FC1, 0x0FBF, 0x0FC0 ); } if(isInArea("provisioner", Q4VS, 0x00)) { Q5JX = list( 0x097E, 0x097D, 0x097C, 0x09B5, 0x09CC, 0x09CD, 0x09CE, 0x09CF, 0x097A, 0x097B, 0x09D0, 0x171F, 0x1720, 0x1721, 0x1722, 0x1723, 0x1724, 0x1725, 0x1726, 0x1727, 0x09D1, 0x1728, 0x1729, 0x172A, 0x172B, 0x172C, 0x172D, 0x0976, 0x0977, 0x0978, 0x0979, 0x097A, 0x097B, 0x09B7, 0x09B8, 0x09B9, 0x09BA, 0x09D3, 0x09C9, 0x1609, 0x160A, 0x09F2, 0x09F1, 0x09C0, 0x09C1, 0x1607, 0x1608, 0x0C5C, 0x0C5D, 0x0C61, 0x0C62, 0x0C63, 0x0C64, 0x0C65, 0x0C66, 0x0C67, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C70, 0x0C71, 0x0C72, 0x0C73, 0x0C74, 0x0C75, 0x0C78, 0x0C79, 0x0C7A, 0x0C7B, 0x0C7C, 0x0C7F, 0x0C80, 0x0C81, 0x0C82 ); } if(isInArea("ranger", Q4VS, 0x00)) { Q5JX = list( 0x171A, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13C7, 0x13D6, 0x1409, 0x1716, 0x171A, 0x153F, 0x1515, 0x13F8, 0x13F9, 0x166E, 0x1711, 0x1712, 0x170B, 0x170C, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x13FD, 0x13FC, 0x0F3F, 0x0F3F, 0x0F3F, 0x0F3F ); } if(isInArea("stables", Q4VS, 0x00)) { Q5JX = list( 0x0C55, 0x0C78 ); } if(isInArea("tanner", Q4VS, 0x00)) { Q5JX = list( 0x171A, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13C7, 0x1068, 0x1067 ); } if(isInArea("tavern", Q4VS, 0x00)) { Q5JX = list( 0x099F, 0x09C7, 0x099B, 0x09C8 ); } if(isInArea("thievesguild", Q4VS, 0x00)) { Q5JX = list( 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C, 0x14FB ); } if(isInArea("tinker", Q4VS, 0x00)) { Q5JX = list( 0x14FB, 0x1011, 0x104C, 0x1050, 0x104F, 0x1051, 0x1052, 0x1054, 0x1053, 0x1056, 0x1055, 0x1025, 0x104B, 0x1058, 0x1057, 0x105A, 0x1059, 0x105C, 0x105B, 0x105E, 0x105D, 0x1EB8, 0x1EB9, 0x1EBA, 0x1EBB, 0x1EBC, 0x100E, 0x100F, 0x1010, 0x1013 ); } if(isInArea("vet", Q4VS, 0x00)) { Q5JX = list( 0x0EE9, 0x0E9B, 0x0F0C, 0x0C55, 0x0C78 ); } if(isInArea("weapon", Q4VS, 0x00)) { Q5JX = list( 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F ); } if((isInArea("dungn", Q4VS, 0x00)) || (isInArea("mountain", Q4VS, 0x00))) { Q5JX = list( 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x0EF3, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F4D, 0x1F4E, 0x1F4F, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, 0x1F58, 0x1F59, 0x1F5A, 0x1F5B, 0x1F5C, 0x1F5D, 0x1F5E, 0x1F5F, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x0F45, 0x0F47, 0x0F43, 0x0F49, 0x0F4B, 0x13FB, 0x13B0, 0x0F4D, 0x1403, 0x0F62, 0x1405, 0x143D, 0x13B4, 0x1407, 0x0F5C, 0x143B, 0x1439, 0x1441, 0x143F, 0x13FF, 0x0F5E, 0x0F61, 0x13B8, 0x13B9, 0x13B6, 0x13F8, 0x0E89, 0x0F51, 0x0F50, 0x1401, 0x13B2, 0x0F4F, 0x13FD, 0x13B2, 0x13B1, 0x0F4F, 0x0F50, 0x0F3F, 0x13DB, 0x13E2, 0x13DA, 0x13E1, 0x13D4, 0x13DC, 0x13D5, 0x13DD, 0x1415, 0x1416, 0x1417, 0x1410, 0x1411, 0x141B, 0x1414, 0x1418, 0x1412, 0x1419, 0x13BF, 0x13C4, 0x13BE, 0x13C5, 0x13CB, 0x13D2, 0x13CC, 0x13D3, 0x13C6, 0x13CE, 0x13EC, 0x13ED, 0x13F0, 0x13F1, 0x13EE, 0x13EF, 0x13EB, 0x13F2, 0x144F, 0x1452, 0x144E, 0x1455, 0x13D6, 0x1413, 0x1409, 0x13C7, 0x13D6, 0x13BB, 0x13C0, 0x13BF, 0x1451, 0x1412, 0x1B72, 0x1B73, 0x1B74, 0x1B75, 0x1B76, 0x1B77, 0x1B78, 0x1B79, 0x1B7A, 0x1B7B, 0x1086, 0x108A, 0x108B, 0x1087, 0x1085, 0x1088, 0x1089, 0x0F0F, 0x0F10, 0x0F11, 0x0F13, 0x0F15, 0x0F16, 0x0F18, 0x0F25, 0x0F26, 0x1CDD, 0x1CE5, 0x1CE0, 0x1CE8, 0x1CE1, 0x1CE9, 0x1CEF, 0x1CF0, 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, 0x1B11, 0x1B12, 0x1B13, 0x1B14, 0x1B15, 0x1B16, 0x1B17, 0x1B18, 0x1B19, 0x1B1A, 0x1B1B, 0x1B1C, 0x0ECA, 0x0ED2, 0x0ECB, 0x0ECC, 0x0ECD, 0x0ECE, 0x0ECF, 0x0ED0, 0x0ED1, 0x0F06, 0x0F07, 0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x1545, 0x1547, 0x1F0B, 0x1F0C, 0x154B, 0x1549, 0x1F0B, 0x1F0C ); } if(numInList(Q5JX) < 0x01) { return(0x00); } getContents(Q4E5, it); if(numInList(Q4E5) <= Q55X) { Q56F = random(0x00, ((Q55X - numInList(Q4E5)) + 0x01) * 0x02); for(i = 0x00; i < Q56F; i ++) { Q5E7 = random(0x00, numInList(Q5JX) - 0x01); Q60E = Q5JX[Q5E7]; if(Q60E > 0x000186A0) { Q60E = Q60E - 0x000186A0; there = loc( getLocation(it) ); Q4Q1 = requestCreateNPCAt(Q60E, there, 0x32); if(Q4Q1 != NULL()) { Q60E = putObjContainer(Q4Q1, it); } } else { Q4Q1 = requestCreateObjectIn(Q5JX[Q5E7], it); } } } list Q5DB = list( 0x09AC, 0x09B1, 0x0E76, 0x0E77, 0x0E7F ); if(isInList(Q5DB, getObjType(it))) { return(0x01); } int Q53L = getValue(it) / 0x05; if(Q53L > 0xFA) { Q53L = 0xFA; } if(Q53L < 0x64) { if(random(0x00, 0x0A) < 0x03) { return(0x00); } } setObjVar(it, "isLocked", Q53L); attachScript(it, "locked"); return(0x00); }
//! ---o void Container::clearContents(){ for(Component::Ref childRef : getContents()) { // don't use the children directly, but use this virtual function getContents to work with specialized types. removeContent(childRef.get()); } }
Data FileUtils::getDataFromFile(const std::string& filename) { Data d; getContents(filename, &d); return d; }
std::string FileUtils::getStringFromFile(const std::string& filename) { std::string s; getContents(filename, &s); return s; }
void LocalBackEnd::updateTileRepresentation(const IVec2& coords, ClientArea* currentArea) { if(_cursorEnabled && _cursorLocation == coords) { _mapSource->setData(coords.x, coords.y, 'X', A_BLINK | COLOR_PAIR(BLUE_ON_BLACK)); _mapPanel->setCenter(coords); return; } auto tile = currentArea->getTile(coords); if(!tile) { _mapSource->setData(coords.x, coords.y, ' ', A_NORMAL); return; } const set<BObjectID>& contents = tile->getContents(); if(contents.find(_characterID) != contents.end()) { _mapSource->setData(coords.x, coords.y, '@', A_BOLD | COLOR_PAIR(RED_ON_BLACK)); _lastPlayerLocation = coords; if(!_cursorEnabled) { _mapPanel->setCenter(coords); updateInfoPanel(); } return; } chtype c; if(contents.size() > 0) { set<const ProtoBObject*> protos; for(auto obj : contents) { auto objectStub = _objects.find(obj); if(objectStub == _objects.end()) { continue; } const ProtoBObject* proto = _raw.getObject(objectStub->second.prototype); if(proto) { protos.insert(proto); } else { Debug("No prototype found for " << objectStub->second.prototype); } } c = _objectRepresentation.get(protos); } else { // Generate a symbol by terrain TileType tileType = tile->getType(); if(tileType == TileType::Wall) { short wallBits = 0; for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { if(i == j && i == 0) { continue; } IVec2 local = coords + IVec2(i, j); TileBase* tile = 0; if(local.x < 0 || local.x >= currentArea->getSize().x || local.y < 0 || local.y >= currentArea->getSize().y || !(tile = currentArea->getTile(local)) || tile->getType() == TileType::Wall) { wallBits |= MARCHING_SQUARES_BIT(i, j); } } } c = getMarchingSquaresRepresentation(wallBits); } else if(tileType == TileType::Ground) { c = '.'; } else { c = '?'; } } _mapSource->setData(coords.x, coords.y, c, currentArea->isTileShrouded(coords) ? A_NORMAL : A_BOLD); }
/** * Copies the contents of fromMsg to the contents of toMsg. Both must be * instances of LinkMessage. The toLink object must be an instance of Link. * It's filled in if the contents of fromMsg are a Link. Returns KNI_TRUE if * successful, otherwise KNI_FALSE. */ static jboolean copy(jobject fromMsg, jobject toMsg, jobject toLink) { jboolean retval; KNI_StartHandles(6); KNI_DeclareHandle(byteArrayClass); KNI_DeclareHandle(stringClass); KNI_DeclareHandle(linkClass); KNI_DeclareHandle(fromContents); KNI_DeclareHandle(newString); KNI_DeclareHandle(newByteArray); KNI_FindClass("[B", byteArrayClass); KNI_FindClass("java/lang/String", stringClass); KNI_FindClass("com/sun/midp/links/Link", linkClass); getContents(fromMsg, fromContents); if (KNI_IsInstanceOf(fromContents, byteArrayClass)) { /* do a byte array copy */ jint fromOffset; jint fromLength; getRange(fromMsg, &fromOffset, &fromLength); SNI_NewArray(SNI_BYTE_ARRAY, fromLength, newByteArray); if (KNI_IsNullHandle(newByteArray)) { retval = KNI_FALSE; } else { KNI_GetRawArrayRegion(fromContents, fromOffset, fromLength, SNI_GetRawArrayPointer(newByteArray)); setContents(toMsg, newByteArray); setRange(toMsg, 0, fromLength); retval = KNI_TRUE; } } else if (KNI_IsInstanceOf(fromContents, stringClass)) { /* do a string copy */ jchar *buf; jsize slen = KNI_GetStringLength(fromContents); SNI_NewArray(SNI_BYTE_ARRAY, slen*sizeof(jchar), newByteArray); if (KNI_IsNullHandle(newByteArray)) { retval = KNI_FALSE; } else { buf = SNI_GetRawArrayPointer(newByteArray); KNI_GetStringRegion(fromContents, 0, slen, buf); KNI_NewString(buf, slen, newString); setContents(toMsg, newString); retval = KNI_TRUE; } } else if (KNI_IsInstanceOf(fromContents, linkClass)) { /* copy the link */ rendezvous *rp = getNativePointer(fromContents); setNativePointer(toLink, rp); rp_incref(rp); setContents(toMsg, toLink); retval = KNI_TRUE; } else { retval = KNI_FALSE; } KNI_EndHandles(); return retval; }