mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-25 15:16:02 +00:00
29 lines
695 B
C++
29 lines
695 B
C++
#pragma once
|
|
#include "Sink.h"
|
|
#include <QSaveFile>
|
|
|
|
namespace Net {
|
|
class FileSink : public Sink
|
|
{
|
|
public: /* con/des */
|
|
FileSink(QString filename);
|
|
virtual ~FileSink();
|
|
|
|
public: /* methods */
|
|
JobStatus init(QNetworkRequest & request) override;
|
|
JobStatus write(QByteArray & data) override;
|
|
JobStatus abort() override;
|
|
JobStatus finalize(QNetworkReply & reply) override;
|
|
bool hasLocalData() override;
|
|
|
|
protected: /* methods */
|
|
virtual JobStatus initCache(QNetworkRequest &);
|
|
virtual JobStatus finalizeCache(QNetworkReply &reply);
|
|
|
|
protected: /* data */
|
|
QString m_filename;
|
|
bool wroteAnyData = false;
|
|
std::unique_ptr<QSaveFile> m_output_file;
|
|
};
|
|
}
|