pollymc/api/logic/net/FileSink.h
Petr Mrázek dd0e996081 GH-1697 always stale files tolerate errors if a local copy is present
This fixes the situation when liteloader snapshot site is broken
and there's an older local snapshot already present.
2016-10-28 02:19:19 +02:00

29 lines
659 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;
};
}