2020-09-20 20:33:16 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2008 Laurent Montel <montel@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_COPYTARGET_H
|
2017-09-10 20:12:52 +01:00
|
|
|
#define KPMCORE_COPYTARGET_H
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2016-04-18 17:14:31 +01:00
|
|
|
#include <QtGlobal>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2018-01-24 15:22:42 +00:00
|
|
|
class QString;
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
/** Base class for something to copy to.
|
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
Abstract base class for all copy targets. Used together with CopySource to
|
|
|
|
implement moving, copying, restoring and backing up FileSystems.
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
@see CopySource
|
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2015-06-04 01:29:22 +01:00
|
|
|
*/
|
|
|
|
class CopyTarget
|
|
|
|
{
|
2015-07-13 15:16:36 +01:00
|
|
|
Q_DISABLE_COPY(CopyTarget)
|
|
|
|
|
|
|
|
protected:
|
2017-10-26 16:20:21 +01:00
|
|
|
CopyTarget() : m_BytesWritten(0) {}
|
2015-07-13 15:16:36 +01:00
|
|
|
virtual ~CopyTarget() {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual bool open() = 0;
|
2017-10-26 16:20:21 +01:00
|
|
|
virtual qint64 firstByte() const = 0;
|
|
|
|
virtual qint64 lastByte() const = 0;
|
2018-01-24 15:22:42 +00:00
|
|
|
virtual QString path() const = 0;
|
2017-10-26 16:20:21 +01:00
|
|
|
qint64 bytesWritten() const {
|
|
|
|
return m_BytesWritten;
|
2015-07-13 15:16:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2017-10-26 16:20:21 +01:00
|
|
|
void setBytesWritten(qint64 s) {
|
|
|
|
m_BytesWritten = s;
|
2015-07-13 15:16:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2017-10-26 16:20:21 +01:00
|
|
|
qint64 m_BytesWritten;
|
2015-06-04 01:29:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|