KPublicTransport

journeyreply.h
1 /*
2  SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KPUBLICTRANSPORT_JOURNEYREPLY_H
8 #define KPUBLICTRANSPORT_JOURNEYREPLY_H
9 
10 #include "reply.h"
11 
12 #include <vector>
13 
14 namespace KPublicTransport {
15 
16 class Journey;
17 class JourneyReplyPrivate;
18 class JourneyRequest;
19 
20 /** Journey query response. */
21 class KPUBLICTRANSPORT_EXPORT JourneyReply : public Reply
22 {
23  Q_OBJECT
24 public:
25  ~JourneyReply();
26 
27  /** The request this is the reply for. */
28  JourneyRequest request() const;
29 
30  /** Returns the retrieved journeys. */
31  const std::vector<Journey>& result() const;
32  /** Returns the retrieved journeys for moving elsewhere. */
33  std::vector<Journey>&& takeResult();
34 
35  /** Returns a request object for querying journeys following the ones returned by this reply.
36  * The returned request is empty if querying later journeys is not possible/supported.
37  */
38  JourneyRequest nextRequest() const;
39  /** Returns a request object for querying journeys preceding the ones returned by this reply.
40  * The returned request is empty if querying earlier journeys is not possible/supported.
41  */
42  JourneyRequest previousRequest() const;
43 
44 private:
45  friend class Manager;
46  friend class ManagerPrivate;
47  explicit JourneyReply(const JourneyRequest &req, QObject *parent = nullptr);
48 
49  friend class AbstractBackend;
50  Q_DECL_HIDDEN void addResult(const AbstractBackend *backend, std::vector<Journey> &&res);
51  using Reply::addError;
52  Q_DECL_HIDDEN void addError(const AbstractBackend *backend, Reply::Error error, const QString &errorMsg);
53 
54  Q_DECL_HIDDEN void setNextContext(const AbstractBackend *backend, const QVariant &data);
55  Q_DECL_HIDDEN void setPreviousContext(const AbstractBackend *backend, const QVariant &data);
56 
57  Q_DECLARE_PRIVATE(JourneyReply)
58 };
59 
60 }
61 
62 #endif // KPUBLICTRANSPORT_JOURNEYREPLY_H
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Journey query response.
Definition: journeyreply.h:21
Error
Error types.
Definition: reply.h:31
Describes a journey search.
Entry point for starting public transport queries.
Definition: manager.h:41
Query response base class.
Definition: reply.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.