Add copy constructor to Device.
This commit is contained in:
parent
7c0a32758e
commit
ea9e079ee8
|
@ -46,6 +46,26 @@ Device::Device(const QString& name,
|
|||
{
|
||||
}
|
||||
|
||||
/** Copy constructor for Device.
|
||||
* @param other the other Device.
|
||||
*/
|
||||
Device::Device(const Device& other)
|
||||
: QObject()
|
||||
, m_Name(other.m_Name)
|
||||
, m_DeviceNode(other.m_DeviceNode)
|
||||
, m_LogicalSize(other.m_LogicalSize)
|
||||
, m_TotalLogical(other.m_TotalLogical)
|
||||
, m_PartitionTable(nullptr)
|
||||
, m_IconName(other.m_IconName)
|
||||
, m_SmartStatus(nullptr)
|
||||
, m_Type(other.m_Type)
|
||||
{
|
||||
if (other.m_PartitionTable)
|
||||
m_PartitionTable = new PartitionTable(*other.m_PartitionTable);
|
||||
if (other.m_SmartStatus)
|
||||
m_SmartStatus = new SmartStatus(*other.m_SmartStatus);
|
||||
}
|
||||
|
||||
/** Destructs a Device. */
|
||||
Device::~Device()
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ class SmartStatus;
|
|||
*/
|
||||
class LIBKPMCORE_EXPORT Device : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY(Device)
|
||||
Device &operator=(const Device &) = delete;
|
||||
|
||||
friend class CreatePartitionTableOperation;
|
||||
friend class CoreBackend;
|
||||
|
@ -54,7 +54,8 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
Device(const QString& name, const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Disk_Device);
|
||||
explicit Device(const QString& name, const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Disk_Device);
|
||||
explicit Device(const Device& other);
|
||||
|
||||
public:
|
||||
virtual ~Device();
|
||||
|
|
Loading…
Reference in New Issue