kpmcore/src/core/copysourcedevice.h

68 lines
1.7 KiB
C
Raw Normal View History

/*
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>
SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef KPMCORE_COPYSOURCEDEVICE_H
#define KPMCORE_COPYSOURCEDEVICE_H
#include "backend/corebackenddevice.h"
2016-05-06 22:36:24 +01:00
#include "core/copysource.h"
#include "util/libpartitionmanagerexport.h"
#include <memory>
2016-04-18 17:14:31 +01:00
#include <QtGlobal>
class Device;
class CopyTarget;
class CoreBackendDevice;
class QString;
/** A Device to copy from.
2015-07-13 15:16:36 +01:00
Represents a Device to copy from. Used to copy a Partition to somewhere on the same or
another Device or to backup its FileSystem to a file.
@author Volker Lanz <vl@fidra.de>
*/
class CopySourceDevice : public CopySource
{
2015-07-13 15:16:36 +01:00
Q_DISABLE_COPY(CopySourceDevice)
2015-07-13 15:16:36 +01:00
public:
CopySourceDevice(Device& d, qint64 firstbyte, qint64 lastbyte);
2015-07-13 15:16:36 +01:00
public:
2016-05-17 18:01:31 +01:00
bool open() override;
qint64 length() const override;
bool overlaps(const CopyTarget& target) const override;
qint64 firstByte() const override {
return m_FirstByte; /**< @return first byte to copy */
2015-07-13 15:16:36 +01:00
}
qint64 lastByte() const override {
return m_LastByte; /**< @return last byte to copy */
2015-07-13 15:16:36 +01:00
}
2015-07-13 15:16:36 +01:00
Device& device() {
return m_Device; /**< @return Device to copy from */
}
const Device& device() const {
return m_Device; /**< @return Device to copy from */
}
QString path() const override;
2015-07-13 15:16:36 +01:00
protected:
Device& m_Device;
const qint64 m_FirstByte;
const qint64 m_LastByte;
std::unique_ptr<CoreBackendDevice> m_BackendDevice;
};
#endif