File indexing completed on 2024-12-29 04:50:10
0001 /* 0002 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kitinerary_export.h" 0010 0011 #include "countrydb.h" 0012 #include "iatacode.h" 0013 #include "knowledgedb.h" 0014 #include "stationidentifier.h" 0015 0016 #include <cstdint> 0017 0018 class QString; 0019 0020 namespace KItinerary { 0021 0022 namespace KnowledgeDb { 0023 0024 /** Position in the train station database. */ 0025 class TrainStationIndex : public UnalignedNumber<2> { 0026 using UnalignedNumber<2>::UnalignedNumber; 0027 }; 0028 0029 /** Train station id to station index lookup table structure. */ 0030 template <typename T> 0031 struct TrainStationIdIndex { 0032 constexpr bool operator<(const TrainStationIdIndex &other) const 0033 { 0034 return stationId < other.stationId; 0035 } 0036 constexpr bool operator<(T otherId) const 0037 { 0038 return stationId < otherId; 0039 } 0040 0041 T stationId; 0042 TrainStationIndex stationIndex; 0043 }; 0044 0045 /** Train station entry in the station table. 0046 * @note This is not for use in APIs/ABIs, but matches the binary layout of the database. 0047 */ 0048 struct TrainStation { 0049 Coordinate coordinate; 0050 CountryId country; 0051 }; 0052 0053 0054 /** Lookup train station data by IBNR. */ 0055 KITINERARY_EXPORT TrainStation stationForIbnr(IBNR ibnr); 0056 0057 /** Lookup train station data by UIC station id. */ 0058 KITINERARY_EXPORT TrainStation stationForUic(UICStation uic); 0059 0060 /** Lookup train station data by SNCF station id. */ 0061 KITINERARY_EXPORT TrainStation stationForSncfStationId(SncfStationId sncfId); 0062 0063 /** Lookup train station data by Indian Railways station code. */ 0064 KITINERARY_EXPORT TrainStation stationForIndianRailwaysStationCode(const QString &code); 0065 0066 /** Lookup train station data by VR (Finland) station code. */ 0067 KITINERARY_EXPORT TrainStation stationForVRStationCode(VRStationCode vrStation); 0068 0069 /** Lookup train station data by Benerail station identifier. */ 0070 KITINERARY_EXPORT TrainStation stationForBenerailId(BenerailStationId id); 0071 0072 /** Lookup train station data by IATA location code. */ 0073 KITINERARY_EXPORT TrainStation stationForIataCode(IataCode iataCode); 0074 0075 /** Lookup train station data by Amtrak station code. */ 0076 KITINERARY_EXPORT TrainStation stationForAmtrakStationCode(AmtrakStationCode code); 0077 0078 /** Lookup train station data by Via Rail station code. */ 0079 KITINERARY_EXPORT TrainStation stationForViaRailStationCode(ViaRailStationCode code); 0080 0081 /** Lookup train station data by UK railway station code. */ 0082 KITINERARY_EXPORT TrainStation stationForUkRailwayStationCode(UKRailwayStationCode code); 0083 } 0084 } 0085