void Resource::readViews(uint16 roomNum) { Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", roomNum); Common::File *dataFile = openDataFile(fileName, MKTAG('R', 'O', 'M', '4')); RoomData *curRoom = &_vm->_rooms[roomNum]; curRoom->_roomMsg = readString(dataFile); readView(dataFile, curRoom->_view[kDirectionNorth]); readView(dataFile, curRoom->_view[kDirectionSouth]); readView(dataFile, curRoom->_view[kDirectionEast]); readView(dataFile, curRoom->_view[kDirectionWest]); readRule(dataFile, curRoom->_rules); delete dataFile; }
void OsmAnd::ObfMapSectionReader_P::readRules( const std::unique_ptr<ObfReader_P>& reader, const std::shared_ptr<ObfMapSectionInfo_P::Rules>& rules) { auto cis = reader->_codedInputStream.get(); uint32_t defaultId = 1; for(;;) { gpb::uint32 tag = cis->ReadTag(); switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: { auto free = rules->_decodingRules.size() * 2 + 1; rules->_coastlineBrokenEncodingType = free++; createRule(rules, 0, rules->_coastlineBrokenEncodingType, QString::fromLatin1("natural"), QString::fromLatin1("coastline_broken")); if(rules->_landEncodingType == -1) { rules->_landEncodingType = free++; createRule(rules, 0, rules->_landEncodingType, QString::fromLatin1("natural"), QString::fromLatin1("land")); } } return; case OBF::OsmAndMapIndex::kRulesFieldNumber: { gpb::uint32 length; cis->ReadVarint32(&length); auto oldLimit = cis->PushLimit(length); readRule(reader, defaultId++, rules); cis->PopLimit(oldLimit); } break; default: ObfReaderUtilities::skipUnknownField(cis, tag); break; } } }
AggregatorBaseCfg::AggregatorBaseCfg(XMLElement* elem) : CfgBase(elem), pollInterval(0) { if (!elem) return; rules = new Rules; htableBits = HT_DEFAULT_BITSIZE; baseTCP = NULL; XMLNode::XMLSet<XMLElement*> set = elem->getElementChildren(); for (XMLNode::XMLSet<XMLElement*>::iterator it = set.begin(); it != set.end(); it++) { XMLElement* e = *it; if (e->matches("rule")) { Rule* r = readRule(e); if (r) rules->rule[rules->count++] = r; } else if (e->matches("DosDefense")) { baseTCP = readDos(e); } else if (e->matches("expiration")) { // get the time values or set them to '0' if they are not specified maxBufferTime = getTimeInUnit("activeTimeout", SEC, 0, e); minBufferTime = getTimeInUnit("inactiveTimeout", SEC, 0, e); if (!maxBufferTime) THROWEXCEPTION("active timeout not set in configuration for aggregator"); if (!minBufferTime) THROWEXCEPTION("inactive timeout not set in configuration for aggregator"); } else if (e->matches("pollInterval")) { pollInterval = getTimeInUnit("pollInterval", mSEC, AGG_DEFAULT_POLLING_TIME); } else if (e->matches("hashtableBits")) { htableBits = getInt("hashtableBits", HT_DEFAULT_BITSIZE); } else if (e->matches("next")) { // ignore next } else { msg(MSG_FATAL, "Unkown Aggregator config entry %s\n", e->getName().c_str()); } } }