File indexing completed on 2025-01-05 04:37:09
0001 /* 0002 SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef BTMULTIDATACHECKER_H 0007 #define BTMULTIDATACHECKER_H 0008 0009 #include "datachecker.h" 0010 #include <QMap> 0011 #include <QString> 0012 #include <util/file.h> 0013 0014 namespace bt 0015 { 0016 /** 0017 @author Joris Guisson 0018 */ 0019 class KTORRENT_EXPORT MultiDataChecker : public DataChecker 0020 { 0021 public: 0022 MultiDataChecker(bt::Uint32 from, bt::Uint32 to); 0023 ~MultiDataChecker() override; 0024 0025 void check(const QString &path, const Torrent &tor, const QString &dnddir, const BitSet ¤t_status) override; 0026 0027 private: 0028 bool loadChunk(Uint32 ci, Uint32 cs, const Torrent &to); 0029 File::Ptr open(const Torrent &tor, Uint32 idx); 0030 void closePastFiles(Uint32 min_idx); 0031 0032 private: 0033 QString cache; 0034 QString dnd_dir; 0035 Uint8 *buf; 0036 QMap<Uint32, File::Ptr> files; 0037 }; 0038 0039 } 0040 0041 #endif