New cpp folder structure

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-17 22:35:52 +03:00
committed by Konstantin Pastbin
parent c9cbb64f12
commit 76ffc99abd
2390 changed files with 345 additions and 339 deletions

View File

@@ -0,0 +1,29 @@
#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