File indexing completed on 2024-05-19 15:22:55

0001 /*
0002     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_IFACES_STORAGEDRIVE_H
0008 #define SOLID_IFACES_STORAGEDRIVE_H
0009 
0010 #include <solid/devices/ifaces/block.h>
0011 #include <solid/storagedrive.h>
0012 
0013 namespace Solid
0014 {
0015 namespace Ifaces
0016 {
0017 /**
0018  * This device interface is available on storage devices.
0019  *
0020  * A storage is anything that can contain a set of volumes (card reader,
0021  * hard disk, cdrom drive...). It's a particular kind of block device.
0022  */
0023 class StorageDrive : virtual public Block
0024 {
0025 public:
0026     /**
0027      * Destroys a StorageDrive object.
0028      */
0029     ~StorageDrive() override;
0030 
0031     /**
0032      * Retrieves the type of physical interface this storage device is
0033      * connected to.
0034      *
0035      * @return the bus type
0036      * @see Solid::StorageDrive::Bus
0037      */
0038     virtual Solid::StorageDrive::Bus bus() const = 0;
0039 
0040     /**
0041      * Retrieves the type of this storage drive.
0042      *
0043      * @return the drive type
0044      * @see Solid::StorageDrive::DriveType
0045      */
0046     virtual Solid::StorageDrive::DriveType driveType() const = 0;
0047 
0048     /**
0049      * Indicates if the media contained by this drive can be removed.
0050      *
0051      * For example memory card can be removed from the drive by the user,
0052      * while partitions can't be removed from hard disks.
0053      *
0054      * @return true if media can be removed, false otherwise.
0055      */
0056     virtual bool isRemovable() const = 0;
0057 
0058     /**
0059      * Indicates if this storage device can be plugged or unplugged while
0060      * the computer is running.
0061      *
0062      * @return true if this storage supports hotplug, false otherwise
0063      */
0064     virtual bool isHotpluggable() const = 0;
0065 
0066     /**
0067      * Retrieves this drives size in bytes.
0068      *
0069      * @return the size of this drive
0070      */
0071     virtual qulonglong size() const = 0;
0072 };
0073 }
0074 }
0075 
0076 Q_DECLARE_INTERFACE(Solid::Ifaces::StorageDrive, "org.kde.Solid.Ifaces.StorageDrive/0.1")
0077 
0078 #endif // SOLID_IFACES_STORAGEDRIVE_H