Solid

frontend/block.h
1/*
2 SPDX-FileCopyrightText: 2006-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_BLOCK_H
8#define SOLID_BLOCK_H
9
10#include <solid/solid_export.h>
11
12#include <solid/deviceinterface.h>
13
14namespace Solid
15{
16class BlockPrivate;
17class Device;
18
19/**
20 * @class Solid::Block block.h <Solid/Block>
21 *
22 * This device interface is available on block devices.
23 *
24 * A block device is an addressable device such as drive or partition.
25 * It is possible to interact with such a device using a special file
26 * in the system.
27 */
28class SOLID_EXPORT Block : public DeviceInterface
29{
30 Q_OBJECT
31 Q_PROPERTY(int major READ deviceMajor)
32 Q_PROPERTY(int minor READ deviceMinor)
33 Q_PROPERTY(QString device READ device)
34 Q_DECLARE_PRIVATE(Block)
35 friend class Device;
36
37private:
38 /**
39 * Creates a new Block object.
40 * You generally won't need this. It's created when necessary using
41 * Device::as().
42 *
43 * @param backendObject the device interface object provided by the backend
44 * @see Solid::Device::as()
45 */
46 SOLID_NO_EXPORT explicit Block(QObject *backendObject);
47
48public:
49 /**
50 * Destroys a Block object.
51 */
52 ~Block() override;
53
54 /**
55 * Get the Solid::DeviceInterface::Type of the Block device interface.
56 *
57 * @return the Block device interface type
58 * @see Solid::Ifaces::Enums::DeviceInterface::Type
59 */
61 {
62 return DeviceInterface::Block;
63 }
64
65 /**
66 * Retrieves the major number of the node file to interact with
67 * the device.
68 *
69 * @return the device major number
70 */
71 int deviceMajor() const;
72
73 /**
74 * Retrieves the minor number of the node file to interact with
75 * the device.
76 *
77 * @return the device minor number
78 */
79 int deviceMinor() const;
80
81 /**
82 * Retrieves the absolute path of the special file to interact
83 * with the device.
84 *
85 * @return the absolute path of the special file to interact with
86 * the device
87 */
88 QString device() const;
89};
90}
91
92#endif
This device interface is available on block devices.
static Type deviceInterfaceType()
Get the Solid::DeviceInterface::Type of the Block device interface.
Base class of all the device interfaces.
Type
This enum type defines the type of device interface that a Device can have.
This class allows applications to deal with devices available in the underlying system.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.