mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +00:00
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
This commit is contained in:
45
indexer/dat_section_header.hpp
Normal file
45
indexer/dat_section_header.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "coding/reader.hpp"
|
||||
|
||||
namespace feature
|
||||
{
|
||||
struct DatSectionHeader
|
||||
{
|
||||
public:
|
||||
enum class Version : uint8_t
|
||||
{
|
||||
V0 = 0,
|
||||
Latest = V0
|
||||
};
|
||||
|
||||
template <typename Sink>
|
||||
void Serialize(Sink & sink) const
|
||||
{
|
||||
CHECK_EQUAL(m_version, Version::V0, ());
|
||||
WriteToSink(sink, static_cast<uint8_t>(m_version));
|
||||
WriteToSink(sink, m_featuresOffset);
|
||||
WriteToSink(sink, m_featuresSize);
|
||||
}
|
||||
|
||||
void Read(Reader & reader)
|
||||
{
|
||||
NonOwningReaderSource source(reader);
|
||||
m_version = static_cast<Version>(ReadPrimitiveFromSource<uint8_t>(source));
|
||||
CHECK_EQUAL(static_cast<uint8_t>(m_version), static_cast<uint8_t>(Version::V0), ());
|
||||
m_featuresOffset = ReadPrimitiveFromSource<uint32_t>(source);
|
||||
m_featuresSize = ReadPrimitiveFromSource<uint32_t>(source);
|
||||
}
|
||||
|
||||
Version m_version = Version::Latest;
|
||||
// All offsets are relative to the start of the section (offset of header is zero).
|
||||
uint32_t m_featuresOffset = 0;
|
||||
uint32_t m_featuresSize = 0;
|
||||
};
|
||||
|
||||
inline std::string DebugPrint(DatSectionHeader::Version v)
|
||||
{
|
||||
CHECK(v == DatSectionHeader::Version::V0, ());
|
||||
return "V0";
|
||||
}
|
||||
} // namespace feature
|
||||
Reference in New Issue
Block a user