void OsmAnd::ObfMapSectionReader_P::read( const ObfReader_P& reader, const std::shared_ptr<ObfMapSectionInfo>& section) { const auto cis = reader.getCodedInputStream().get(); for (;;) { const auto tag = cis->ReadTag(); switch (gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: if (!ObfReaderUtilities::reachedDataEnd(cis)) return; return; case OBF::OsmAndMapIndex::kNameFieldNumber: { ObfReaderUtilities::readQString(cis, section->name); section->isBasemap = section->name.contains(QLatin1String("basemap"), Qt::CaseInsensitive); section->isBasemapWithCoastlines = section->name == QLatin1String("basemap"); break; } case OBF::OsmAndMapIndex::kRulesFieldNumber: ObfReaderUtilities::skipBlockWithLength(cis); break; case OBF::OsmAndMapIndex::kLevelsFieldNumber: { auto length = ObfReaderUtilities::readBigEndianInt(cis); auto offset = cis->CurrentPosition(); auto oldLimit = cis->PushLimit(length); Ref<ObfMapSectionLevel> levelRoot(new ObfMapSectionLevel()); levelRoot->length = length; levelRoot->offset = offset; readMapLevelHeader(reader, levelRoot); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); section->levels.push_back(qMove(levelRoot)); break; } default: ObfReaderUtilities::skipUnknownField(cis, tag); break; } } }
void OsmAnd::ObfMapSectionReader_P::read( const std::unique_ptr<ObfReader_P>& reader, const std::shared_ptr<ObfMapSectionInfo>& section ) { auto cis = reader->_codedInputStream.get(); for(;;) { auto tag = cis->ReadTag(); switch(gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: return; case OBF::OsmAndMapIndex::kNameFieldNumber: { ObfReaderUtilities::readQString(cis, section->_name); section->_isBasemap = (QString::compare(section->_name, QLatin1String("basemap"), Qt::CaseInsensitive) == 0); } break; case OBF::OsmAndMapIndex::kRulesFieldNumber: ObfReaderUtilities::skipUnknownField(cis, tag); break; case OBF::OsmAndMapIndex::kLevelsFieldNumber: { auto length = ObfReaderUtilities::readBigEndianInt(cis); auto offset = cis->CurrentPosition(); auto oldLimit = cis->PushLimit(length); const std::shared_ptr<ObfMapSectionLevel> levelRoot(new ObfMapSectionLevel()); levelRoot->_length = length; levelRoot->_offset = offset; readMapLevelHeader(reader, section, levelRoot); cis->PopLimit(oldLimit); section->_levels.push_back(qMove(levelRoot)); } break; default: ObfReaderUtilities::skipUnknownField(cis, tag); break; } } }