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{
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
int deviceMinor() const
Retrieves the minor number of the node file to interact with the device.
static Type deviceInterfaceType()
Get the Solid::DeviceInterface::Type of the Block device interface.
int deviceMajor() const
Retrieves the major number of the node file to interact with the device.
Type
This enum type defines the type of device interface that a Device can have.
SOLID_NO_EXPORT DeviceInterface(DeviceInterfacePrivate &dd, QObject *backendObject)
This class allows applications to deal with devices available in the underlying system.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:55:36 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.