2020-09-20 20:33:16 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2018 Huzaifa Faruqui <huzaifafaruqui@gmail.com>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2020-09-20 20:33:16 +01:00
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KPMCORE_COPYTARGETDEVICE_H
|
2017-09-10 20:12:52 +01:00
|
|
|
#define KPMCORE_COPYTARGETDEVICE_H
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2018-03-31 14:44:40 +01:00
|
|
|
#include "backend/corebackenddevice.h"
|
2016-05-06 22:36:24 +01:00
|
|
|
#include "core/copytarget.h"
|
|
|
|
#include "util/libpartitionmanagerexport.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2018-03-31 14:44:40 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2016-04-18 17:14:31 +01:00
|
|
|
#include <QtGlobal>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
class Device;
|
|
|
|
class CoreBackendDevice;
|
|
|
|
|
|
|
|
/** A Device to copy to.
|
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
Represents a target Device to copy to. Used to copy a Partition to somewhere on the same
|
|
|
|
or another Device or to restore a FileSystem from a file to a Partition.
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
@see CopyTargetFile, CopySourceDevice
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2015-06-04 01:29:22 +01:00
|
|
|
*/
|
2017-11-01 20:11:38 +00:00
|
|
|
class CopyTargetDevice : public CopyTarget
|
2015-06-04 01:29:22 +01:00
|
|
|
{
|
2015-07-13 15:16:36 +01:00
|
|
|
Q_DISABLE_COPY(CopyTargetDevice)
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
public:
|
2017-10-26 16:20:21 +01:00
|
|
|
CopyTargetDevice(Device& d, qint64 firstbyte, qint64 lastbyte);
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
public:
|
2016-05-17 18:01:31 +01:00
|
|
|
bool open() override;
|
2017-10-26 16:20:21 +01:00
|
|
|
qint64 firstByte() const override {
|
|
|
|
return m_FirstByte; /**< @return the first byte to write to */
|
2015-07-13 15:16:36 +01:00
|
|
|
}
|
2017-10-26 16:20:21 +01:00
|
|
|
qint64 lastByte() const override {
|
|
|
|
return m_LastByte; /**< @return the last byte to write to */
|
2015-07-13 15:16:36 +01:00
|
|
|
}
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
Device& device() {
|
|
|
|
return m_Device; /**< @return the Device to write to */
|
|
|
|
}
|
|
|
|
const Device& device() const {
|
|
|
|
return m_Device; /**< @return the Device to write to */
|
|
|
|
}
|
2018-01-24 15:22:42 +00:00
|
|
|
QString path() const override;
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
protected:
|
|
|
|
Device& m_Device;
|
2018-03-31 14:44:40 +01:00
|
|
|
std::unique_ptr<CoreBackendDevice> m_BackendDevice;
|
2017-10-26 16:20:21 +01:00
|
|
|
const qint64 m_FirstByte;
|
|
|
|
const qint64 m_LastByte;
|
2015-06-04 01:29:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|