File indexing completed on 2024-12-08 07:19:11
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KPUBLICTRANSPORT_REQUESTCONTEXT_P_H 0008 #define KPUBLICTRANSPORT_REQUESTCONTEXT_P_H 0009 0010 #include <QDateTime> 0011 #include <QVariant> 0012 0013 namespace KPublicTransport { 0014 0015 class AbstractBackend; 0016 0017 /** Backend-specific request information. */ 0018 class RequestContext 0019 { 0020 public: 0021 explicit RequestContext(); 0022 ~RequestContext(); 0023 bool operator==(const RequestContext &other) const; 0024 bool operator<(const AbstractBackend *other) const; 0025 0026 /** Removes all contexts from @p contexts that already exist in @p baseContexts. 0027 * Both vectors are assumed to be sorted by backend pointer. 0028 */ 0029 static void purgeLoops(std::vector<RequestContext> &contexts, const std::vector<RequestContext> &baseContexts); 0030 0031 const AbstractBackend *backend = nullptr; 0032 0033 enum RequestType { 0034 Normal, 0035 Next, 0036 Previous 0037 }; 0038 RequestType type = Normal; 0039 // for departure/next this is the time of the last previously found departure time 0040 // for departure/previous this is the first previously found departure time 0041 // for arrival/next this is the last previously found arrival time 0042 // for arrival/previous this is the first previously found arrival time 0043 QDateTime dateTime; 0044 QVariant backendData; 0045 }; 0046 0047 } 0048 0049 #endif // KPUBLICTRANSPORT_REQUESTCONTEXT_P_H