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 QCOAPMESSAGE_P_H |
6 | #define QCOAPMESSAGE_P_H |
7 | |
8 | #include <QtCoap/qcoapmessage.h> |
9 | #include <QtCore/qshareddata.h> |
10 | #include <private/qobject_p.h> |
11 | |
12 | // |
13 | // W A R N I N G |
14 | // ------------- |
15 | // |
16 | // This file is not part of the Qt API. It exists purely as an |
17 | // implementation detail. This header file may change from version to |
18 | // version without notice, or even be removed. |
19 | // |
20 | // We mean it. |
21 | // |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class Q_AUTOTEST_EXPORT QCoapMessagePrivate : public QSharedData |
26 | { |
27 | public: |
28 | QCoapMessagePrivate(QCoapMessage::Type type = QCoapMessage::Type::NonConfirmable); |
29 | virtual ~QCoapMessagePrivate(); |
30 | |
31 | virtual QCoapMessagePrivate *clone() const; |
32 | |
33 | QList<QCoapOption>::const_iterator findOption(QCoapOption::OptionName name) const; |
34 | |
35 | quint8 version = 1; |
36 | QCoapMessage::Type type = QCoapMessage::Type::NonConfirmable; |
37 | quint16 messageId = 0; |
38 | QByteArray token; |
39 | QList<QCoapOption> options; |
40 | QByteArray payload; |
41 | |
42 | protected: |
43 | QCoapMessagePrivate(const QCoapMessagePrivate &other); |
44 | }; |
45 | |
46 | // don't use the copy constructor when detaching from a QSharedDataPointer, |
47 | // use virtual clone() call instead. |
48 | template <> |
49 | Q_INLINE_TEMPLATE QCoapMessagePrivate *QSharedDataPointer<QCoapMessagePrivate>::clone() |
50 | { |
51 | return d->clone(); |
52 | } |
53 | |
54 | QT_END_NAMESPACE |
55 | |
56 | #endif // QCOAPMESSAGE_P_H |
57 |