File indexing completed on 2024-04-28 04:44:21

0001 /*
0002    SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
0003 
0004    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef UPNPCONTROLABSTRACTSERVICEREPLY_H
0008 #define UPNPCONTROLABSTRACTSERVICEREPLY_H
0009 
0010 #include "upnplibqt_export.h"
0011 
0012 #include <QObject>
0013 #include <QVariantMap>
0014 
0015 #include <memory>
0016 
0017 class UpnpControlAbstractServiceReplyPrivate;
0018 class KDSoapPendingCall;
0019 
0020 /**
0021  * @brief The UpnpControlAbstractServiceReply class is used to keep track of answers when calling actions from UPnP services
0022  *
0023  * It allows to know the status of the action call (.e. success or failure) and get the result or the returned error
0024  */
0025 class UPNPLIBQT_EXPORT UpnpControlAbstractServiceReply : public QObject
0026 {
0027 
0028     Q_OBJECT
0029 
0030 public:
0031     explicit UpnpControlAbstractServiceReply(const KDSoapPendingCall &soapAnswer, QObject *parent = nullptr);
0032 
0033     ~UpnpControlAbstractServiceReply() override;
0034 
0035     [[nodiscard]] bool success() const;
0036 
0037     [[nodiscard]] QVariantMap result() const;
0038 
0039     [[nodiscard]] QString error() const;
0040 
0041 Q_SIGNALS:
0042 
0043     void finished(UpnpControlAbstractServiceReply *self);
0044 
0045 public Q_SLOTS:
0046 
0047     void callFinished();
0048 
0049 protected:
0050     virtual void parseAnswer();
0051 
0052 private:
0053     std::unique_ptr<UpnpControlAbstractServiceReplyPrivate> d;
0054 };
0055 
0056 #endif // UPNPCONTROLABSTRACTSERVICEREPLY_H