KItinerary

countrydb.h
1 /*
2  Copyright (C) 2018 Volker Krause <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This program is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef KITINERARY_COUNTRYDB_H
19 #define KITINERARY_COUNTRYDB_H
20 
21 #include "kitinerary_export.h"
22 #include "alphaid.h"
23 
24 #include <QMetaType>
25 
26 #include <cstdint>
27 
28 class QString;
29 
30 namespace KItinerary {
31 namespace KnowledgeDb {
32  KITINERARY_EXPORT Q_NAMESPACE
33 
38 
40 enum class DrivingSide : uint8_t {
41  Unknown,
42  Left,
43  Right,
44 };
45 Q_ENUM_NS(DrivingSide)
46 
47 
50 enum PowerPlugType : uint16_t {
51  Unknown = 0,
52  TypeA = 1 << 0,
53  TypeB = 1 << 1,
54  TypeC = 1 << 2,
55  TypeD = 1 << 3,
56  TypeE = 1 << 4,
57  TypeF = 1 << 5,
58  TypeG = 1 << 6,
59  TypeH = 1 << 7,
60  TypeI = 1 << 8,
61  TypeJ = 1 << 9,
62  TypeK = 1 << 10,
63  TypeL = 1 << 11,
64  TypeM = 1 << 12,
65  TypeN = 1 << 13,
66 };
67 
68 Q_DECLARE_FLAGS(PowerPlugTypes, PowerPlugType)
69 Q_FLAG_NS(PowerPlugTypes)
70 
72 KITINERARY_EXPORT PowerPlugTypes incompatiblePowerPlugs(PowerPlugTypes plugs, PowerPlugTypes sockets);
77 
79 struct Country
80 {
81  CountryId id;
82  DrivingSide drivingSide;
83  PowerPlugTypes powerPlugTypes;
84  // TODO voltage/frequency
85  // TODO currency
86 };
87 
88 
90 KITINERARY_EXPORT Country countryForId(CountryId id);
91 
93 KITINERARY_EXPORT const Country* countriesBegin();
95 KITINERARY_EXPORT const Country* countriesEnd();
96 
98 KITINERARY_EXPORT CountryId countryIdFromIso3166_1alpha3(CountryId3 iso3Code);
100 KITINERARY_EXPORT CountryId countryIdForUicCode(uint16_t uicCountryCode);
101 
102 }
103 }
104 
105 Q_DECLARE_OPERATORS_FOR_FLAGS(KItinerary::KnowledgeDb::PowerPlugTypes)
106 Q_DECLARE_METATYPE(KItinerary::KnowledgeDb::DrivingSide)
107 Q_DECLARE_METATYPE(KItinerary::KnowledgeDb::PowerPlugTypes)
108 
109 #endif // KITINERARY_COUNTRYDB_H
const Country * countriesEnd()
Iterator access for the country information table.
Definition: countrydb.cpp:47
PowerPlugTypes incompatiblePowerPlugs(PowerPlugTypes plugs, PowerPlugTypes sockets)
Returns the power plugs out of plugs that wont fit into sockets.
Definition: countrydb.cpp:74
Classes for reservation/travel data models, data extraction and data augmentation.
CountryId countryIdFromIso3166_1alpha3(CountryId3 iso3Code)
Look up country ISO 3166-1 alpha 2 code from an ISO 3166-1 alpha 3 code.
Definition: countrydb.cpp:102
Left
Type N (Brasilian)
Definition: countrydb.h:65
US three-pin plugs.
Definition: countrydb.h:53
PowerPlugTypes incompatiblePowerSockets(PowerPlugTypes plugs, PowerPlugTypes sockets)
Returns the power sockets out pf sockets that are unable to receive plugs out of plugs, excluding those in plugs.
Definition: countrydb.cpp:88
Country countryForId(CountryId id)
Look up contry infromation by id.
Definition: countrydb.cpp:31
Country information.
Definition: countrydb.h:79
CountryId countryIdForUicCode(uint16_t uicCountryCode)
Look up country ISO code from a UIC country code.
Definition: countrydb.cpp:114
US two-pin plugs.
Definition: countrydb.h:52
const Country * countriesBegin()
Iterator access for the country information table.
Definition: countrydb.cpp:42
DrivingSide
Driving side.
Definition: countrydb.h:40
PowerPlugType
Power plug types.
Definition: countrydb.h:50
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 22:42:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.