Files
comaps/transit/transit_version.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

30 lines
718 B
C++

#include "transit/transit_version.hpp"
#include "base/logging.hpp"
#include <cstdint>
#include <exception>
#include <limits>
namespace transit
{
TransitVersion GetVersion(Reader & reader)
{
try
{
NonOwningReaderSource src(reader);
uint16_t headerVersion = std::numeric_limits<uint16_t>::max();
ReadPrimitiveFromSource(src, headerVersion);
CHECK_LESS(headerVersion, static_cast<uint16_t>(TransitVersion::Counter),
("Invalid transit header version."));
return static_cast<TransitVersion>(headerVersion);
}
catch (std::exception const & ex)
{
LOG(LERROR, ("Error reading header version from transit mwm section.", ex.what()));
throw;
}
}
} // namespace transit