aboutsummaryrefslogtreecommitdiff
path: root/HTTPFileReader.cpp
blob: d7f5dd4d01f1518da6571575ad7faf858b916a2c (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
#include <cpr/cpr.h>

#include "HTTPFileReader.h"

HTTPFileReader HTTPFileReader::instance(protocol);

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

void HTTPFileReader::close() { }

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

HTTPFileReader::~HTTPFileReader() {
	this->close();
}

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

HTTPFileReader::HTTPFileReader(const HTTPFileReader *) : FileReader() { }