kpmcore/src/core/copytargetfile.h

58 lines
1.2 KiB
C
Raw Permalink Normal View History

/*
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef KPMCORE_COPYTARGETFILE_H
#define KPMCORE_COPYTARGETFILE_H
2016-05-06 22:36:24 +01:00
#include "core/copytarget.h"
2016-04-18 17:14:31 +01:00
#include <QtGlobal>
#include <QFile>
class QString;
/** A file to copy to.
2015-07-13 15:16:36 +01:00
Repesents a target file to copy to. Used to back up a FileSystem to a file.
2015-07-13 15:16:36 +01:00
@see CopySourceFile, CopyTargetDevice
@author Volker Lanz <vl@fidra.de>
*/
class CopyTargetFile : public CopyTarget
{
2015-07-13 15:16:36 +01:00
public:
2019-12-09 16:09:53 +00:00
explicit CopyTargetFile(const QString& filename);
2015-07-13 15:16:36 +01:00
public:
2016-05-17 18:01:31 +01:00
bool open() override;
qint64 firstByte() const override {
2015-07-13 15:16:36 +01:00
return 0; /**< @return always 0 for a file */
}
qint64 lastByte() const override {
return bytesWritten(); /**< @return the number of bytes written so far */
2015-07-13 15:16:36 +01:00
}
QString path() const override {
return m_File.fileName();
}
2015-07-13 15:16:36 +01:00
protected:
QFile& file() {
return m_File;
}
const QFile& file() const {
return m_File;
}
2015-07-13 15:16:36 +01:00
protected:
QFile m_File;
};
#endif