KItinerary

countrydb.h
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kitinerary_export.h"
10#include "alphaid.h"
11
12#include <QMetaType>
13
14#include <cstdint>
15
16
17namespace KItinerary {
18namespace KnowledgeDb {
19 KITINERARY_EXPORT Q_NAMESPACE
20
21/** ISO 3166-1 alpha 2 country identifier. */
23
24/** Driving side. */
25enum class DrivingSide : uint8_t {
26 Unknown,
27 Left,
28 Right,
29};
30Q_ENUM_NS(DrivingSide)
31
32/** Power plug types.
33 * @note This cannot be an enum class due to QTBUG-47652.
34 */
35enum PowerPlugType : uint16_t {
36 Unknown = 0,
37 TypeA = 1 << 0, ///< US two-pin plugs
38 TypeB = 1 << 1, ///< US three-pin plugs
39 TypeC = 1 << 2, ///< Europlug
40 TypeD = 1 << 3, ///< Type D
41 TypeE = 1 << 4, ///< French plug
42 TypeF = 1 << 5, ///< Schuko plug
43 TypeG = 1 << 6, ///< UK plug
44 TypeH = 1 << 7, ///< Israel plug
45 TypeI = 1 << 8, ///< Australian plug
46 TypeJ = 1 << 9, ///< Swiss plug
47 TypeK = 1 << 10, ///< Danish plug
48 TypeL = 1 << 11, ///< Type L
49 TypeM = 1 << 12, ///< Type M
50 TypeN = 1 << 13, ///< Type N (Brasilian)
51};
52
53Q_DECLARE_FLAGS(PowerPlugTypes, PowerPlugType)
54Q_DECLARE_OPERATORS_FOR_FLAGS(PowerPlugTypes)
55Q_FLAG_NS(PowerPlugTypes)
56
57/** Returns the power plugs out of @p plugs that won't fit into @p sockets. */
58KITINERARY_EXPORT PowerPlugTypes incompatiblePowerPlugs(PowerPlugTypes plugs, PowerPlugTypes sockets);
59/** Returns the power sockets out pf @p sockets that are unable to receive plugs
60 * out of @p plugs, excluding those in @p plugs.
61 */
62KITINERARY_EXPORT PowerPlugTypes incompatiblePowerSockets(PowerPlugTypes plugs, PowerPlugTypes sockets);
63
64/** Country information. */
65struct Country
66{
67 CountryId id;
68 DrivingSide drivingSide;
69 PowerPlugTypes powerPlugTypes;
70 // TODO voltage/frequency
71};
72
73
74/** Look up country information by id. */
75KITINERARY_EXPORT Country countryForId(CountryId id);
76
77/** Look up country ISO code from a UIC country code. */
78KITINERARY_EXPORT CountryId countryIdForUicCode(uint16_t uicCountryCode);
79
80}
81}
82
85
PowerPlugTypes incompatiblePowerSockets(PowerPlugTypes plugs, PowerPlugTypes sockets)
Returns the power sockets out pf sockets that are unable to receive plugs out of plugs,...
Definition countrydb.cpp:68
Country countryForId(CountryId id)
Look up country information by id.
Definition countrydb.cpp:21
CountryId countryIdForUicCode(uint16_t uicCountryCode)
Look up country ISO code from a UIC country code.
Definition countrydb.cpp:82
DrivingSide
Driving side.
Definition countrydb.h:25
PowerPlugType
Power plug types.
Definition countrydb.h:35
@ TypeF
Schuko plug.
Definition countrydb.h:42
@ TypeI
Australian plug.
Definition countrydb.h:45
@ TypeE
French plug.
Definition countrydb.h:41
@ TypeH
Israel plug.
Definition countrydb.h:44
@ TypeK
Danish plug.
Definition countrydb.h:47
@ TypeN
Type N (Brasilian)
Definition countrydb.h:50
@ TypeB
US three-pin plugs.
Definition countrydb.h:38
@ TypeA
US two-pin plugs.
Definition countrydb.h:37
PowerPlugTypes incompatiblePowerPlugs(PowerPlugTypes plugs, PowerPlugTypes sockets)
Returns the power plugs out of plugs that won't fit into sockets.
Definition countrydb.cpp:54
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
Country information.
Definition countrydb.h:66
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:49 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.