Solid

fakemanager.h
1 /*
2  SPDX-FileCopyrightText: 2006 Michaël Larouche <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
8 #define SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
9 
10 #include <solid/devices/ifaces/devicemanager.h>
11 
12 class QDomElement;
13 
14 using namespace Solid::Ifaces;
15 
16 namespace Solid
17 {
18 namespace Backends
19 {
20 namespace Fake
21 {
22 class FakeDevice;
23 
24 /**
25  * @brief a Fake manager that read a device list from a XML file.
26  * This fake manager is used for unit tests and developers.
27  *
28  * @author Michaël Larouche <[email protected]>
29  */
31 {
32  Q_OBJECT
33 public:
34  FakeManager(QObject *parent, const QString &xmlFile);
35  virtual ~FakeManager();
36 
37  QString udiPrefix() const override;
38  QSet<Solid::DeviceInterface::Type> supportedInterfaces() const override;
39 
40  /**
41  * Return the list of UDI of all available devices.
42  */
43  QStringList allDevices() override;
44 
45  QStringList devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type) override;
46 
47  QObject *createDevice(const QString &udi) override;
48  virtual FakeDevice *findDevice(const QString &udi);
49 
50 public Q_SLOTS:
51  void plug(const QString &udi);
52  void unplug(const QString &udi);
53 
54 private Q_SLOTS:
55  /**
56  * @internal
57  * Parse the XML file that represent the fake machine.
58  */
59  void parseMachineFile();
60  /**
61  * @internal
62  * Parse a device node and the return the device.
63  */
64  FakeDevice *parseDeviceElement(const QDomElement &element);
65 
66 private:
67  QStringList findDeviceStringMatch(const QString &key, const QString &value);
68  QStringList findDeviceByDeviceInterface(Solid::DeviceInterface::Type type);
69 
70  class Private;
71  Private *d;
72 };
73 }
74 }
75 }
76 
77 #endif // SOLID_BACKENDS_FAKEHW_FAKEMANAGER_H
This class specifies the interface a backend will have to implement in order to be used in the system...
Definition: devicemanager.h:28
Type
This enum type defines the type of device interface that a Device can have.
a Fake manager that read a device list from a XML file.
Definition: fakemanager.h:30
The single responsibility of this class is to create arguments valid for logind Inhibit call...
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jun 19 2021 22:50:32 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.