aboutsummaryrefslogtreecommitdiff
path: root/HTTPFileReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'HTTPFileReader.cpp')
-rw-r--r--HTTPFileReader.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/HTTPFileReader.cpp b/HTTPFileReader.cpp
new file mode 100644
index 0000000..d7f5dd4
--- /dev/null
+++ b/HTTPFileReader.cpp
@@ -0,0 +1,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() { }
+