File indexing completed on 2024-04-28 05:45:44
0001 /* 0002 SPDX-FileCopyrightText: 2018 Andrius Štikonas <andrius@stikonas.eu> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #ifndef KPMCORE_COPYTARGETBYTEARRAY_H 0008 #define KPMCORE_COPYTARGETBYTEARRAY_H 0009 0010 #include "core/copytarget.h" 0011 0012 #include <QtGlobal> 0013 #include <QByteArray> 0014 #include <QString> 0015 0016 /** A file to copy to. 0017 0018 Represents a target file to copy to. Used to back up a FileSystem to a file. 0019 0020 @see CopySourceFile, CopyTargetDevice 0021 @author Volker Lanz <vl@fidra.de> 0022 */ 0023 class CopyTargetByteArray : public CopyTarget 0024 { 0025 public: 0026 explicit CopyTargetByteArray(QByteArray& array); 0027 0028 public: 0029 bool open() override { 0030 return true; 0031 } 0032 0033 QString path() const override { 0034 return QString(); 0035 } 0036 0037 qint64 firstByte() const override { 0038 return 0; /**< @return always 0 for QByteArray */ 0039 } 0040 qint64 lastByte() const override { 0041 return bytesWritten(); /**< @return the number of bytes written so far */ 0042 } 0043 0044 QByteArray& m_Array; 0045 }; 0046 0047 #endif