File indexing completed on 2025-02-02 05:02:34

0001 /*
0002     SPDX-FileCopyrightText: 2019-2023 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef PUBLICTRANSPORTMATCHER_H
0007 #define PUBLICTRANSPORTMATCHER_H
0008 
0009 #include <KPublicTransport/Line>
0010 
0011 namespace KPublicTransport {
0012 class Journey;
0013 class JourneySection;
0014 class Stopover;
0015 }
0016 
0017 class QVariant;
0018 
0019 /** Methods to compare/match KPublicTransport types and KItinerary types. */
0020 namespace PublicTransportMatcher
0021 {
0022 
0023 /** Checks if the given reservation and journey section have a compatible mode of transportation. */
0024 bool isSameMode(const QVariant &res, KPublicTransport::Line::Mode mode);
0025 bool isSameMode(const QVariant &res, const KPublicTransport::JourneySection &section);
0026 
0027 /** Checks whether a given route and a given train name/number from a reservation refer to the same thing. */
0028 bool isSameRoute(const KPublicTransport::Route &lhs, const QString &trainName, const QString &trainNumber);
0029 
0030 /** Check whether a given reservation matches the respective departure/arrival/journey object. */
0031 bool isDepartureForReservation(const QVariant &res, const KPublicTransport::Stopover &dep);
0032 bool isArrivalForReservation(const QVariant &res, const KPublicTransport::Stopover &arr);
0033 bool isJourneyForReservation(const QVariant &res, const KPublicTransport::JourneySection &journey);
0034 
0035 /** Returns a sub-section of @p journey that matches @p res, or an empty journey otherwise. */
0036 KPublicTransport::JourneySection subJourneyForReservation(const QVariant &res, const KPublicTransport::JourneySection &journey);
0037 
0038 }
0039 
0040 #endif // PUBLICTRANSPORTMATCHER_H