KPublicTransport

tripreply.h
1/*
2 SPDX-FileCopyrightText: 2025 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KPUBLICTRANSPORT_TRIPREPLY_H
7#define KPUBLICTRANSPORT_TRIPREPLY_H
8
9#include "reply.h"
10
11namespace KPublicTransport {
12
13class AbstractBackend;
14class JourneySection;
15class TripReplyPrivate;
16class TripReplyTest;
17class TripRequest;
18
19/** Reply to a trip query.
20 * @since 25.04
21 */
22class KPUBLICTRANSPORT_EXPORT TripReply : public Reply
23{
26
27public:
28 ~TripReply() override;
29
30 /** The request this is the reply for. */
31 [[nodiscard]] TripRequest request() const;
32
33 /** The full trip, ie the entire vehicle run.
34 * This can be incomplete if no backend supports trip queries and this
35 * is emulated internally by journey queries.
36 */
37 [[nodiscard]] JourneySection trip() const;
38
39 /** The sub-trip matching the JourneySection used in the request.
40 * This can be identical to trip() if the entire vehicle run happened
41 * to be requested, or when no backend supports trip queries.
42 */
43 [[nodiscard]] JourneySection journeySection() const;
44
45private:
46 friend class Manager;
47 friend class ManagerPrivate;
48 explicit TripReply(const TripRequest &req, QObject *parent = nullptr);
49
50 friend class AbstractBackend;
51 void addResult(const AbstractBackend *backend, JourneySection &&journeySection); // exported for unit tests
52 using Reply::addError;
53 Q_DECL_HIDDEN void addError(const AbstractBackend *backend, Reply::Error error, const QString &errorMsg);
54
55 friend class TripReplyTest;
56 Q_DECLARE_PRIVATE(TripReply)
57};
58
59}
60
61#endif
A segment of a journey plan.
Definition journey.h:32
Query response base class.
Definition reply.h:25
void finished()
Emitted whenever the corresponding search has been completed.
Error
Error types.
Definition reply.h:33
JourneySection journeySection() const
The sub-trip matching the JourneySection used in the request.
Definition tripreply.cpp:53
TripRequest request() const
The request this is the reply for.
Definition tripreply.cpp:41
Request for a single trip.
Definition triprequest.h:29
Query operations and data types for accessing realtime public transport information from online servi...
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:52:18 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.