| 1 | // Copyright (C) 2017 Witekio. |
| 2 | // Copyright (C) 2018 The Qt Company Ltd. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 4 | |
| 5 | #ifndef QCOAPREQUEST_H |
| 6 | #define QCOAPREQUEST_H |
| 7 | |
| 8 | #include <QtCoap/qcoapglobal.h> |
| 9 | #include <QtCoap/qcoapnamespace.h> |
| 10 | #include <QtCoap/qcoapmessage.h> |
| 11 | |
| 12 | #include <QtCore/qobject.h> |
| 13 | #include <QtCore/qurl.h> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class QCoapInternalRequest; |
| 18 | class QCoapRequestPrivate; |
| 19 | class Q_COAP_EXPORT QCoapRequest : public QCoapMessage |
| 20 | { |
| 21 | public: |
| 22 | explicit QCoapRequest(const QUrl &url = QUrl(), |
| 23 | Type type = Type::NonConfirmable, |
| 24 | const QUrl &proxyUrl = QUrl()); |
| 25 | explicit QCoapRequest(const char* url, Type type = Type::NonConfirmable); |
| 26 | QCoapRequest(const QCoapRequest &other); |
| 27 | ~QCoapRequest(); |
| 28 | |
| 29 | QCoapRequest &operator=(const QCoapRequest &other); |
| 30 | |
| 31 | QUrl url() const; |
| 32 | QUrl proxyUrl() const; |
| 33 | QtCoap::Method method() const; |
| 34 | bool isObserve() const; |
| 35 | void setUrl(const QUrl &url); |
| 36 | void setProxyUrl(const QUrl &proxyUrl); |
| 37 | void enableObserve(); |
| 38 | |
| 39 | private: |
| 40 | // Q_DECLARE_PRIVATE equivalent for shared data pointers |
| 41 | inline QCoapRequestPrivate* d_func(); |
| 42 | const QCoapRequestPrivate* d_func() const |
| 43 | { return reinterpret_cast<const QCoapRequestPrivate*>(d_ptr.constData()); } |
| 44 | |
| 45 | friend class QCoapRequestPrivate; |
| 46 | }; |
| 47 | |
| 48 | QT_END_NAMESPACE |
| 49 | |
| 50 | #endif // QCOAPREQUEST_H |
| 51 | |