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
45 /** Index at which journeySection() begins in trip(). */
46 [[nodiscard]] qsizetype journeySectionBegin() const;
47 /** Index at which journeySection() ends in trip(). */
48 [[nodiscard]] qsizetype journeySectionEnd() const;
49
50private:
51 friend class Manager;
52 friend class ManagerPrivate;
53 explicit TripReply(const TripRequest &req, QObject *parent = nullptr);
54
55 friend class AbstractBackend;
56 void addResult(const AbstractBackend *backend, JourneySection &&journeySection); // exported for unit tests
57 using Reply::addError;
58 Q_DECL_HIDDEN void addError(const AbstractBackend *backend, Reply::Error error, const QString &errorMsg);
59
60 friend class TripReplyTest;
61 Q_DECLARE_PRIVATE(TripReply)
62};
63
64}
65
66#endif
A segment of a journey plan.
Definition journey.h:39
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
qsizetype journeySectionBegin() const
Index at which journeySection() begins in trip().
Definition tripreply.cpp:75
qsizetype journeySectionEnd() const
Index at which journeySection() ends in trip().
Definition tripreply.cpp:81
JourneySection journeySection() const
The sub-trip matching the JourneySection used in the request.
Definition tripreply.cpp:57
TripRequest request() const
The request this is the reply for.
Definition tripreply.cpp:45
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 Feb 21 2025 11:47:40 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.