File indexing completed on 2024-12-08 07:19:12
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_VEHICLELAYOUTREQUEST_H 0008 #define KPUBLICTRANSPORT_VEHICLELAYOUTREQUEST_H 0009 0010 #include "kpublictransport_export.h" 0011 0012 #include <KPublicTransport/Datatypes> 0013 0014 #include <QDateTime> 0015 #include <QMetaType> 0016 #include <QSharedDataPointer> 0017 0018 namespace KPublicTransport { 0019 0020 class Stopover; 0021 class VehicleLayoutRequestPrivate; 0022 0023 /** Describes a query for vehicle layout information. */ 0024 class KPUBLICTRANSPORT_EXPORT VehicleLayoutRequest 0025 { 0026 KPUBLICTRANSPORT_GADGET(VehicleLayoutRequest) 0027 0028 /** The stopover vehicle and platform layout information are requested for. */ 0029 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Stopover, stopover, setStopover) 0030 0031 public: 0032 /** Creates a vehicle layout request for the given stopover. */ 0033 explicit VehicleLayoutRequest(const Stopover &stopover); 0034 0035 /** Returns @c true if this is a valid request, that is it has enough parameters set to perform a query. */ 0036 bool isValid() const; 0037 0038 /** Unique string representation used for caching results. */ 0039 QString cacheKey() const; 0040 0041 /** Identifiers of the backends that should be queried. 0042 * @see setBackendIds() 0043 */ 0044 QStringList backendIds() const; 0045 /** Set identifiers of backends that should be queried. 0046 * Settings this is only needed when you want explicit control over this, leaving 0047 * this empty picks suitable backends automatically. 0048 */ 0049 void setBackendIds(const QStringList &backendIds); 0050 0051 ///@cond internal 0052 static QJsonObject toJson(const VehicleLayoutRequest &req); 0053 ///@endcond 0054 }; 0055 0056 } 0057 0058 Q_DECLARE_METATYPE(KPublicTransport::VehicleLayoutRequest) 0059 0060 #endif // KPUBLICTRANSPORT_VEHICLELAYOUTREQUEST_H