The-Powder-Toy/src/client/Download.h
mniip ff27d69424 Switch from std::string to String/ByteString in most of the code
Also switch SimulationData from weird arrays to std::vector
2018-04-30 21:13:24 +03:00

48 lines
930 B
C++

#ifndef DOWNLOAD_H
#define DOWNLOAD_H
#include <map>
#include "common/String.h"
class DownloadManager;
class Download
{
ByteString uri;
void *http;
bool keepAlive;
char *downloadData;
int downloadSize;
int downloadStatus;
ByteString postData;
ByteString postDataBoundary;
ByteString userID;
ByteString userSession;
volatile bool downloadFinished;
volatile bool downloadCanceled;
volatile bool downloadStarted;
public:
Download(ByteString uri, bool keepAlive = false);
~Download();
void AddPostData(std::map<ByteString, ByteString> data);
void AddPostData(std::pair<ByteString, ByteString> data);
void AuthHeaders(ByteString ID, ByteString session);
void Start();
bool Reuse(ByteString newuri);
char* Finish(int *length, int *status);
void Cancel();
void CheckProgress(int *total, int *done);
bool CheckDone();
bool CheckCanceled();
bool CheckStarted();
friend class DownloadManager;
};
#endif