1 /* 2 SPDX-FileCopyrightText: 2018 Andrius Štikonas <andrius@stikonas.eu> 3 4 SPDX-License-Identifier: GPL-3.0-or-later 5 */ 6 7 #ifndef KPMCORE_COPYTARGETBYTEARRAY_H 8 #define KPMCORE_COPYTARGETBYTEARRAY_H 9 10 #include "core/copytarget.h" 11 12 #include <QtGlobal> 13 #include <QByteArray> 14 #include <QString> 15 16 /** A file to copy to. 17 18 Represents a target file to copy to. Used to back up a FileSystem to a file. 19 20 @see CopySourceFile, CopyTargetDevice 21 @author Volker Lanz <vl@fidra.de> 22 */ 23 class CopyTargetByteArray : public CopyTarget 24 { 25 public: 26 explicit CopyTargetByteArray(QByteArray& array); 27 28 public: open()29 bool open() override { 30 return true; 31 } 32 path()33 QString path() const override { 34 return QString(); 35 } 36 firstByte()37 qint64 firstByte() const override { 38 return 0; /**< @return always 0 for QByteArray */ 39 } lastByte()40 qint64 lastByte() const override { 41 return bytesWritten(); /**< @return the number of bytes written so far */ 42 } 43 44 QByteArray& m_Array; 45 }; 46 47 #endif 48