KPublicTransport

stopoverreply.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_STOPOVERREPLY_H
8 #define KPUBLICTRANSPORT_STOPOVERREPLY_H
9 
10 #include "reply.h"
11 
12 #include <vector>
13 
14 namespace KPublicTransport {
15 
16 class AbstractBackend;
17 class Stopover;
18 class StopoverReplyPrivate;
19 class StopoverRequest;
20 
21 /** Departure or arrival query reply. */
22 class KPUBLICTRANSPORT_EXPORT StopoverReply : public Reply
23 {
24  Q_OBJECT
25 public:
26  ~StopoverReply();
27 
28  /** The request this is the reply for. */
29  StopoverRequest request() const;
30 
31  /** Returns the found arrival or departure information. */
32  const std::vector<Stopover>& result() const;
33  /** Returns the found arrival or departure information for moving elsewhere. */
34  std::vector<Stopover>&& takeResult();
35 
36  /** Returns a request object for querying departures following the ones returned by this reply.
37  * The returned request is empty if querying later departures is not possible/supported.
38  */
39  StopoverRequest nextRequest() const;
40  /** Returns a request object for querying departures preceding the ones returned by this reply.
41  * The returned request is empty if querying earlier departures is not possible/supported.
42  */
43  StopoverRequest previousRequest() const;
44 
45 private:
46  friend class Manager;
47  friend class ManagerPrivate;
48  explicit StopoverReply(const StopoverRequest &req, QObject *parent = nullptr);
49 
50  friend class AbstractBackend;
51  Q_DECL_HIDDEN void addResult(const AbstractBackend *backend, std::vector<Stopover> &&res);
52  using Reply::addError;
53  Q_DECL_HIDDEN void addError(const AbstractBackend *backend, Reply::Error error, const QString &errorMsg);
54 
55  Q_DECL_HIDDEN void setNextContext(const AbstractBackend *backend, const QVariant &data);
56  Q_DECL_HIDDEN void setPreviousContext(const AbstractBackend *backend, const QVariant &data);
57 
58  Q_DECLARE_PRIVATE(StopoverReply)
59 };
60 
61 }
62 
63 #endif // KPUBLICTRANSPORT_STOPOVERREPLY_H
Departure or arrival query reply.
Definition: stopoverreply.h:22
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Describes an arrival or departure search.
Error
Error types.
Definition: reply.h:31
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.