MultiMC5/api/logic/net/FileSink.h

29 lines
695 B
C
Raw Normal View History

#pragma once
#include "Sink.h"
#include <QSaveFile>
namespace Net {
class FileSink : public Sink
{
public: /* con/des */
2018-07-15 12:51:05 +00:00
FileSink(QString filename);
virtual ~FileSink();
public: /* methods */
2018-07-15 12:51:05 +00:00
JobStatus init(QNetworkRequest & request) override;
JobStatus write(QByteArray & data) override;
JobStatus abort() override;
JobStatus finalize(QNetworkReply & reply) override;
bool hasLocalData() override;
protected: /* methods */
2018-07-15 12:51:05 +00:00
virtual JobStatus initCache(QNetworkRequest &);
virtual JobStatus finalizeCache(QNetworkReply &reply);
protected: /* data */
2018-07-15 12:51:05 +00:00
QString m_filename;
bool wroteAnyData = false;
std::unique_ptr<QSaveFile> m_output_file;
};
}