File indexing completed on 2024-12-08 07:19:10
0001 /* 0002 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KPUBLICTRANSPORT_LOCATIONREPLY_H 0008 #define KPUBLICTRANSPORT_LOCATIONREPLY_H 0009 0010 #include "reply.h" 0011 0012 #include <vector> 0013 0014 namespace KPublicTransport { 0015 0016 class AbstractBackend; 0017 class Location; 0018 class LocationRequest; 0019 class LocationReplyPrivate; 0020 0021 /** Location query reply. */ 0022 class KPUBLICTRANSPORT_EXPORT LocationReply : public Reply 0023 { 0024 Q_OBJECT 0025 public: 0026 ~LocationReply() override; 0027 0028 /** The request this is the reply for. */ 0029 LocationRequest request() const; 0030 0031 /** Returns the found locations. */ 0032 const std::vector<Location>& result() const; 0033 /** Returns the found locations for moving elsewhere. */ 0034 std::vector<Location>&& takeResult(); 0035 0036 private: 0037 friend class Manager; 0038 friend class ManagerPrivate; 0039 explicit LocationReply(const LocationRequest &req, QObject *parent = nullptr); 0040 0041 friend class AbstractBackend; 0042 Q_DECL_HIDDEN void addResult(std::vector<Location> &&res); 0043 using Reply::addError; 0044 Q_DECL_HIDDEN void addError(const AbstractBackend *backend, Reply::Error error, const QString &errorMsg); 0045 0046 0047 Q_DECLARE_PRIVATE(LocationReply) 0048 }; 0049 0050 } 0051 0052 #endif // KPUBLICTRANSPORT_LOCATIONREPLY_H