aboutsummaryrefslogtreecommitdiff
path: root/HTTPFile.cpp
blob: d488ab0f850d9dc6b497c151476a10acdeba56fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <cpr/cpr.h>

#include "HTTPFile.h"
#include "Exception.h"

HTTPFile HTTPFile::instance(protocol);

void HTTPFile::open(const std::string url) {
	_res = cpr::Get(cpr::Url{url});
}

void HTTPFile::close() { }

const std::string HTTPFile::read() {
	return _res.text.data();
}

HTTPFile::~HTTPFile() {
	close();
}

HTTPFile * HTTPFile::clone() const {
	return new HTTPFile(this);
}

HTTPFile::HTTPFile(const HTTPFile *) : File() { }