aboutsummaryrefslogtreecommitdiffstats
path: root/src/coap/qcoaprequest.h
blob: 31afe96ff7008a738ac3bc2ddfb616374c4a28b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2017 Witekio.
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QCOAPREQUEST_H
#define QCOAPREQUEST_H

#include <QtCoap/qcoapglobal.h>
#include <QtCoap/qcoapnamespace.h>
#include <QtCoap/qcoapmessage.h>

#include <QtCore/qobject.h>
#include <QtCore/qurl.h>

QT_BEGIN_NAMESPACE

class QCoapInternalRequest;
class QCoapRequestPrivate;
class Q_COAP_EXPORT QCoapRequest : public QCoapMessage
{
public:
    explicit QCoapRequest(const QUrl &url = QUrl(),
                          Type type = Type::NonConfirmable,
                          const QUrl &proxyUrl = QUrl());
    explicit QCoapRequest(const char* url, Type type = Type::NonConfirmable);
    QCoapRequest(const QCoapRequest &other);
    ~QCoapRequest();

    QCoapRequest &operator=(const QCoapRequest &other);

    QUrl url() const;
    QUrl proxyUrl() const;
    QtCoap::Method method() const;
    bool isObserve() const;
    void setUrl(const QUrl &url);
    void setProxyUrl(const QUrl &proxyUrl);
    void enableObserve();

private:
    // Q_DECLARE_PRIVATE equivalent for shared data pointers
    inline QCoapRequestPrivate* d_func();
    const QCoapRequestPrivate* d_func() const
    { return reinterpret_cast<const QCoapRequestPrivate*>(d_ptr.constData()); }

    friend class QCoapRequestPrivate;
};

QT_END_NAMESPACE

#endif // QCOAPREQUEST_H