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-04-29 05:54:00 +05:30
|
|
|
Task::Status init(QNetworkRequest & request) override;
|
|
|
|
Task::Status write(QByteArray & data) override;
|
|
|
|
Task::Status abort() override;
|
|
|
|
Task::Status 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-04-29 05:54:00 +05:30
|
|
|
virtual Task::Status initCache(QNetworkRequest &);
|
|
|
|
virtual Task::Status 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;
|
|
|
|
};
|
|
|
|
}
|