File indexing completed on 2024-05-05 05:48:39

0001 /*
0002     SPDX-FileCopyrightText: 2008 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2008 Laurent Montel <montel@kde.org>
0004     SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
0005     SPDX-FileCopyrightText: 2018 Huzaifa Faruqui <huzaifafaruqui@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-3.0-or-later
0008 */
0009 
0010 #ifndef KPMCORE_COPYSOURCE_H
0011 #define KPMCORE_COPYSOURCE_H
0012 
0013 #include <QtGlobal>
0014 
0015 class CopyTarget;
0016 class QString;
0017 
0018 /** Base class for something to copy from.
0019 
0020     Abstract base class for all copy sources. Used in combination with CopyTarget
0021     to implement moving, copying, backing up and restoring FileSystems.
0022 
0023     @see CopyTarget
0024     @author Volker Lanz <vl@fidra.de>
0025 */
0026 class CopySource
0027 {
0028     Q_DISABLE_COPY(CopySource)
0029 
0030 protected:
0031     CopySource() {}
0032     virtual ~CopySource() {}
0033 
0034 public:
0035     virtual bool open() = 0;
0036     virtual QString path() const = 0;
0037     virtual qint64 length() const = 0;
0038     virtual bool overlaps(const CopyTarget& target) const = 0;
0039 
0040     virtual qint64 firstByte() const = 0;
0041     virtual qint64 lastByte() const = 0;
0042 };
0043 
0044 #endif