Warning, file /system/kpmcore/src/core/copysourceshred.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@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_COPYSOURCESHRED_H
0011 #define KPMCORE_COPYSOURCESHRED_H
0012 
0013 #include "core/copysource.h"
0014 
0015 #include <QFile>
0016 
0017 class CopyTarget;
0018 class QString;
0019 
0020 /** A source for securely overwriting a partition (shredding).
0021 
0022     Represents a source of data (random or zeros) to copy from. Used to securely overwrite data on disk.
0023 
0024     @author Volker Lanz <vl@fidra.de>
0025 */
0026 class CopySourceShred : public CopySource
0027 {
0028 public:
0029     CopySourceShred(qint64 size, bool randomShred);
0030 
0031 public:
0032     bool open() override;
0033     qint64 length() const override;
0034 
0035     bool overlaps(const CopyTarget&) const override {
0036         return false;    /**< @return false for shred source */
0037     }
0038     qint64 firstByte() const override {
0039         return 0;    /**< @return 0 for shred source */
0040     }
0041     qint64 lastByte() const override {
0042         return length();    /**< @return equal to length for shred source. @see length() */
0043     }
0044     QString path() const override {
0045         return m_SourceFile.fileName();
0046     }
0047 
0048 protected:
0049     QFile& sourceFile() {
0050         return m_SourceFile;
0051     }
0052     const QFile& sourceFile() const {
0053         return m_SourceFile;
0054     }
0055     qint64 size() const {
0056         return m_Size;
0057     }
0058 
0059 private:
0060     qint64 m_Size;
0061     QFile m_SourceFile;
0062 };
0063 
0064 #endif