2015-06-04 01:29:22 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#if !defined(COPYTARGETDEVICE__H)
|
|
|
|
|
|
|
|
#define COPYTARGETDEVICE__H
|
|
|
|
|
|
|
|
#include "../core/copytarget.h"
|
2015-07-10 14:07:05 +01:00
|
|
|
#include "../util/libpartitionmanagerexport.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
#include <qglobal.h>
|
|
|
|
|
|
|
|
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
|
|
|
*/
|
2015-07-10 14:07:05 +01:00
|
|
|
class LIBKPMCORE_EXPORT 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:
|
|
|
|
CopyTargetDevice(Device& d, qint64 firstsector, qint64 lastsector);
|
|
|
|
~CopyTargetDevice();
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
public:
|
|
|
|
virtual bool open();
|
|
|
|
virtual qint32 sectorSize() const;
|
|
|
|
virtual bool writeSectors(void* buffer, qint64 writeOffset, qint64 numSectors);
|
|
|
|
virtual qint64 firstSector() const {
|
|
|
|
return m_FirstSector; /**< @return the first sector to write to */
|
|
|
|
}
|
|
|
|
virtual qint64 lastSector() const {
|
|
|
|
return m_LastSector; /**< @return the last sector to write to */
|
|
|
|
}
|
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 */
|
|
|
|
}
|
2015-07-13 15:03:36 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
protected:
|
|
|
|
Device& m_Device;
|
|
|
|
CoreBackendDevice* m_BackendDevice;
|
|
|
|
const qint64 m_FirstSector;
|
|
|
|
const qint64 m_LastSector;
|
2015-06-04 01:29:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|