Debian Codegraph @

wayland/qtwayland-dev/5.11.3/QtWaylandClient/private/qwaylanddataoffer_p.h

raw symbols SCIP
1 // Copyright (C) 2016 The Qt Company Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5 #ifndef QWAYLANDDATAOFFER_H
6 #define QWAYLANDDATAOFFER_H
7
8 //
9 // W A R N I N G
10 // -------------
11 //
12 // This file is not part of the Qt API. It exists purely as an
13 // implementation detail. This header file may change from version to
14 // version without notice, or even be removed.
15 //
16 // We mean it.
17 //
18
19 #include <QtGui/private/qinternalmimedata_p.h>
20
21 #include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
22 #include <QtWaylandClient/private/qwayland-wayland.h>
23
24 QT_REQUIRE_CONFIG(wayland_datadevice);
25
26 QT_BEGIN_NAMESPACE
27
28 namespace QtWaylandClient {
29
30 class QWaylandDisplay;
31 class QWaylandMimeData;
32
33 class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offer
34 {
35 public:
36 explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer);
37 ~QWaylandDataOffer() override;
38
39 QString firstFormat() const;
40
41 QMimeData *mimeData();
42
43 protected:
44 void data_offer_offer(const QString &mime_type) override;
45
46 private:
47 QScopedPointer<QWaylandMimeData> m_mimeData;
48 };
49
50
51 class QWaylandMimeData : public QInternalMimeData {
52 public:
53 explicit QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display);
54 ~QWaylandMimeData() override;
55
56 void appendFormat(const QString &mimeType);
57
58 protected:
59 bool hasFormat_sys(const QString &mimeType) const override;
60 QStringList formats_sys() const override;
61 QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
62
63 private:
64 int readData(int fd, QByteArray &data) const;
65
66 mutable QWaylandDataOffer *m_dataOffer = nullptr;
67 QWaylandDisplay *m_display = nullptr;
68 mutable QStringList m_types;
69 mutable QHash<QString, QByteArray> m_data;
70 };
71
72 }
73
74 QT_END_NAMESPACE
75 #endif