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

source code of qtcoap/src/coap/qcoapmessage_p.h