File indexing completed on 2024-03-24 03:57:19
0001 /* 0002 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef SPATIAL_INDEX_PROPERTY_P_H 0008 #define SPATIAL_INDEX_PROPERTY_P_H 0009 0010 #include "data/timezone_names_p.h" 0011 #include "isocodes_p.h" 0012 0013 #include <cstdint> 0014 0015 #pragma pack(push) 0016 #pragma pack(1) 0017 0018 /** Entry in the spatial index property table. 0019 * That is, this is a set of properties (timezone, country, country subdivision) 0020 * associated with a tile in the spatial index, optimized for compact storage. 0021 */ 0022 class SpatialIndexProperty 0023 { 0024 public: 0025 template<std::size_t N> 0026 inline constexpr SpatialIndexProperty(Tz tz, const char (&code)[N]) 0027 : m_tz(tz) 0028 , m_subdiv(N == 3 ? (IsoCodes::alpha2CodeToKey(code, 2) << 16) : IsoCodes::subdivisionCodeToKey(code, N - 1)) 0029 { 0030 } 0031 0032 inline constexpr SpatialIndexProperty(Tz tz) 0033 : m_tz(tz) 0034 , m_subdiv(0) 0035 { 0036 } 0037 0038 Tz m_tz; 0039 uint32_t m_subdiv; 0040 }; 0041 0042 #pragma pack(pop) 0043 0044 #endif