pollymc/api/logic/net/FileSink.h
Petr Mrázek e1465f4848 NOISSUE refactor NetAction to be based on Task
Still missing some things, this is part 1.
2017-04-29 02:24:00 +02:00

29 lines
677 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 */
Task::Status init(QNetworkRequest & request) override;
Task::Status write(QByteArray & data) override;
Task::Status abort() override;
Task::Status finalize(QNetworkReply & reply) override;
bool hasLocalData() override;
protected: /* methods */
virtual Task::Status initCache(QNetworkRequest &);
virtual Task::Status finalizeCache(QNetworkReply &reply);
protected: /* data */
QString m_filename;
bool wroteAnyData = false;
std::unique_ptr<QSaveFile> m_output_file;
};
}