1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef SPATIAL_INDEX_PROPERTY_P_H
8#define SPATIAL_INDEX_PROPERTY_P_H
9
10#include "data/timezone_names_p.h"
11#include "isocodes_p.h"
12
13#include <cstdint>
14
15#pragma pack(push)
16#pragma pack(1)
17
18/** Entry in the spatial index property table.
19 * That is, this is a set of properties (timezone, country, country subdivision)
20 * associated with a tile in the spatial index, optimized for compact storage.
21 */
22class SpatialIndexProperty
23{
24public:
25 template<std::size_t N>
26 inline constexpr SpatialIndexProperty(Tz tz, const char (&code)[N])
27 : m_tz(tz)
28 , m_subdiv(N == 3 ? (IsoCodes::alpha2CodeToKey(code, 2) << 16) : IsoCodes::subdivisionCodeToKey(code, N - 1))
29 {
30 }
31
32 inline constexpr SpatialIndexProperty(Tz tz)
33 : m_tz(tz)
34 , m_subdiv(0)
35 {
36 }
37
38 Tz m_tz;
39 uint32_t m_subdiv;
40};
41
42#pragma pack(pop)
43
44#endif
45

source code of ki18n/src/localedata/spatial_index_property_p.h