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/*!
19 * Entry in the spatial index property table.
20 * That is, this is a set of properties (timezone, country, country subdivision)
21 * associated with a tile in the spatial index, optimized for compact storage.
22 *
23 * \internal
24 */
25class SpatialIndexProperty
26{
27public:
28 template<std::size_t N>
29 inline constexpr SpatialIndexProperty(Tz tz, const char (&code)[N])
30 : m_tz(tz)
31 , m_subdiv(N == 3 ? (IsoCodes::alpha2CodeToKey(code, 2) << 16) : IsoCodes::subdivisionCodeToKey(code, N - 1))
32 {
33 }
34
35 inline constexpr SpatialIndexProperty(Tz tz)
36 : m_tz(tz)
37 , m_subdiv(0)
38 {
39 }
40
41 Tz m_tz;
42 uint32_t m_subdiv;
43};
44
45#pragma pack(pop)
46
47#endif
48

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