| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2005-2007 Kevin Ottens <ervin@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef SOLID_DEVICE_P_H |
| 8 | #define SOLID_DEVICE_P_H |
| 9 | |
| 10 | #include <QMap> |
| 11 | #include <QObject> |
| 12 | #include <QPointer> |
| 13 | #include <QSharedData> |
| 14 | |
| 15 | #include <ifaces/device.h> |
| 16 | |
| 17 | #if defined(Q_OS_WIN32) |
| 18 | #undef interface |
| 19 | #endif |
| 20 | |
| 21 | namespace Solid |
| 22 | { |
| 23 | class DevicePrivate : public QObject, public QSharedData |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | public: |
| 27 | explicit DevicePrivate(const QString &udi); |
| 28 | ~DevicePrivate() override; |
| 29 | |
| 30 | QString udi() const |
| 31 | { |
| 32 | return m_udi; |
| 33 | } |
| 34 | |
| 35 | Ifaces::Device *backendObject() const |
| 36 | { |
| 37 | return m_backendObject.get(); |
| 38 | } |
| 39 | void setBackendObject(std::unique_ptr<Ifaces::Device> &&object); |
| 40 | |
| 41 | DeviceInterface *interface(const DeviceInterface::Type &type) const; |
| 42 | void setInterface(const DeviceInterface::Type &type, std::unique_ptr<DeviceInterface> &&interface); |
| 43 | |
| 44 | private: |
| 45 | QString m_udi; |
| 46 | std::unique_ptr<Ifaces::Device> m_backendObject; |
| 47 | std::map<DeviceInterface::Type, std::unique_ptr<DeviceInterface>> m_ifaces; |
| 48 | }; |
| 49 | } |
| 50 | |
| 51 | #endif |
| 52 |
