2016-05-28 23:24:17 +05:30
|
|
|
#pragma once
|
|
|
|
#include "Sink.h"
|
|
|
|
#include <QSaveFile>
|
|
|
|
|
|
|
|
namespace Net {
|
|
|
|
class FileSink : public Sink
|
|
|
|
{
|
|
|
|
public: /* con/des */
|
|
|
|
FileSink(QString filename);
|
|
|
|
virtual ~FileSink();
|
|
|
|
|
|
|
|
public: /* methods */
|
2017-05-04 02:41:52 +05:30
|
|
|
JobStatus init(QNetworkRequest & request) override;
|
|
|
|
JobStatus write(QByteArray & data) override;
|
|
|
|
JobStatus abort() override;
|
|
|
|
JobStatus finalize(QNetworkReply & reply) override;
|
2016-10-28 05:49:19 +05:30
|
|
|
bool hasLocalData() override;
|
2016-05-28 23:24:17 +05:30
|
|
|
|
|
|
|
protected: /* methods */
|
2017-05-04 02:41:52 +05:30
|
|
|
virtual JobStatus initCache(QNetworkRequest &);
|
|
|
|
virtual JobStatus finalizeCache(QNetworkReply &reply);
|
2016-05-28 23:24:17 +05:30
|
|
|
|
|
|
|
protected: /* data */
|
|
|
|
QString m_filename;
|
|
|
|
bool wroteAnyData = false;
|
|
|
|
std::unique_ptr<QSaveFile> m_output_file;
|
|
|
|
};
|
|
|
|
}
|