| 1 | /* |
| 2 | * Bittorrent Client using Qt and libtorrent. |
| 3 | * Copyright (C) 2015-2022 Vladimir Golovnev <[email protected]> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | * In addition, as a special exception, the copyright holders give permission to |
| 20 | * link this program with the OpenSSL project's "OpenSSL" library (or with |
| 21 | * modified versions of it that use the same license as the "OpenSSL" library), |
| 22 | * and distribute the linked executables. You must obey the GNU General Public |
| 23 | * License in all respects for all of the code used other than "OpenSSL". If you |
| 24 | * modify file(s), you may extend this exception to your version of the file(s), |
| 25 | * but you are not obligated to do so. If you do not wish to do so, delete this |
| 26 | * exception statement from your version. |
| 27 | */ |
| 28 | |
| 29 | #pragma once |
| 30 | |
| 31 | #include <QtContainerFwd> |
| 32 | #include <QList> |
| 33 | #include <QMutex> |
| 34 | #include <QObject> |
| 35 | |
| 36 | #include "base/3rdparty/expected.hpp"cxx . . $ `<file>/src/base/3rdparty/expected.hpp`/ |
| 37 | #include "base/path.h"cxx . . $ `<file>/src/base/path.h`/ |
| 38 | #include "infohash.h"cxx . . $ `<file>/src/base/bittorrent/infohash.h`/ |
| 39 | #include "loadtorrentparams.h"cxx . . $ `<file>/src/base/bittorrent/loadtorrentparams.h`/ |
| 40 | |
| 41 | namespace BitTorrentcxx . . $ BitTorrent/ |
| 42 | { |
| 43 | using LoadResumeDataResultcxx . . $ BitTorrent/LoadResumeDataResult# = nonstdcxx . . $ nonstd/::expectedcxx . . $ nonstd/expected_lite/expected#<LoadTorrentParamscxx . . $ BitTorrent/LoadTorrentParams#, QStringcxx . . $ QString#>; |
| 44 | |
| 45 | struct LoadedResumeDatacxx . . $ BitTorrent/LoadedResumeData# |
| 46 | { |
| 47 | TorrentIDcxx . . $ BitTorrent/TorrentID# torrentIDcxx . . $ BitTorrent/LoadedResumeData#torrentID.; |
| 48 | LoadResumeDataResultcxx . . $ BitTorrent/LoadResumeDataResult# resultcxx . . $ BitTorrent/LoadedResumeData#result.; |
| 49 | }; |
| 50 | |
| 51 | class ResumeDataStoragecxx . . $ BitTorrent/ResumeDataStorage# : public QObjectcxx . . $ QObject# |
| 52 | { |
| 53 | Q_OBJECTcxx . . $ BitTorrent/ResumeDataStorage#staticMetaObject. |
| 54 | Q_DISABLE_COPY_MOVEcxx . . $ BitTorrent/ResumeDataStorage#ResumeDataStorage(f211a46ec16c3d33).(ResumeDataStorage) |
| 55 | |
| 56 | public: |
| 57 | explicit ResumeDataStoragecxx . . $ BitTorrent/ResumeDataStorage#ResumeDataStorage(adc859682798efc7).(const Pathcxx . . $ Path# &path, QObjectcxx . . $ QObject# *parent = nullptr); |
| 58 | |
| 59 | Pathcxx . . $ Path# pathcxx . . $ BitTorrent/ResumeDataStorage#path(9e3832297dca56a8).() const; |
| 60 | |
| 61 | virtual QListcxx . . $ QList#<TorrentIDcxx . . $ BitTorrent/TorrentID#> registeredTorrentscxx . . $ BitTorrent/ResumeDataStorage#registeredTorrents(ca01f0d338acf10a).() const = 0; |
| 62 | virtual LoadResumeDataResultcxx . . $ BitTorrent/LoadResumeDataResult# loadcxx . . $ BitTorrent/ResumeDataStorage#load(47da3ebeb0daad2d).(const TorrentIDcxx . . $ BitTorrent/TorrentID# &id) const = 0; |
| 63 | virtual void storecxx . . $ BitTorrent/ResumeDataStorage#store(e63345e922333e54).(const TorrentIDcxx . . $ BitTorrent/TorrentID# &id, LoadTorrentParamscxx . . $ BitTorrent/LoadTorrentParams# resumeData) const = 0; |
| 64 | virtual void removecxx . . $ BitTorrent/ResumeDataStorage#remove(6a2f985110bf9e3f).(const TorrentIDcxx . . $ BitTorrent/TorrentID# &id) const = 0; |
| 65 | virtual void storeQueuecxx . . $ BitTorrent/ResumeDataStorage#storeQueue(89b24b36becac9b3).(const QListcxx . . $ QList#<TorrentIDcxx . . $ BitTorrent/TorrentID#> &queue) const = 0; |
| 66 | |
| 67 | void loadAllcxx . . $ BitTorrent/ResumeDataStorage#loadAll(83f5f38750778ac8).() const; |
| 68 | QListcxx . . $ QList#<LoadedResumeDatacxx . . $ BitTorrent/LoadedResumeData#> fetchLoadedResumeDatacxx . . $ BitTorrent/ResumeDataStorage#fetchLoadedResumeData(d04dbe7a27b24460).() const; |
| 69 | |
| 70 | signalscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:43:14`!: |
| 71 | void loadStartedcxx . . $ BitTorrent/ResumeDataStorage#loadStarted(f1eabf6d635d1568).(const QListcxx . . $ QList#<BitTorrentcxx . . $ BitTorrent/::TorrentIDcxx . . $ BitTorrent/TorrentID#> &torrents); |
| 72 | void loadFinishedcxx . . $ BitTorrent/ResumeDataStorage#loadFinished(49f6e7a06ebc5aa8).(); |
| 73 | |
| 74 | protected: |
| 75 | void onResumeDataLoadedcxx . . $ BitTorrent/ResumeDataStorage#onResumeDataLoaded(460d1dd21ae21610).(const TorrentIDcxx . . $ BitTorrent/TorrentID# &torrentID, LoadResumeDataResultcxx . . $ BitTorrent/LoadResumeDataResult# loadResumeDataResult) const; |
| 76 | |
| 77 | private: |
| 78 | virtual void doLoadAllcxx . . $ BitTorrent/ResumeDataStorage#doLoadAll(83f5f38750778ac8).() const = 0; |
| 79 | |
| 80 | const Pathcxx . . $ Path# m_pathcxx . . $ BitTorrent/ResumeDataStorage#m_path.; |
| 81 | mutable QListcxx . . $ QList#<LoadedResumeDatacxx . . $ BitTorrent/LoadedResumeData#> m_loadedResumeDatacxx . . $ BitTorrent/ResumeDataStorage#m_loadedResumeData.; |
| 82 | mutable QMutexcxx . . $ QMutex# m_loadedResumeDataMutexcxx . . $ BitTorrent/ResumeDataStorage#m_loadedResumeDataMutex.; |
| 83 | }; |
| 84 | } |