6#ifndef EGT_NETWORK_HTTP_H
7#define EGT_NETWORK_HTTP_H
15#include <egt/detail/meta.h>
27struct HttpClientRequestData;
28class HttpClientRequestManager;
52 using ReadCallback = std::function < void(
const unsigned char* data,
size_t len,
bool done) >;
67 virtual
void start_async(const std::
string& url,
ReadCallback callback);
70 inline detail::HttpClientRequestData* impl()
86 std::unique_ptr<detail::HttpClientRequestData> m_impl;
88 friend class detail::HttpClientRequestManager;
98T load_file_from_network(const std::
string& url)
101 bool finished =
false;
103 request.
start_async(url, [&buffer, url, &finished](
const unsigned char* data,
size_t len,
bool done)
106 buffer.insert(buffer.end(), data, data + len);
115 Application::instance().event().step();
An HTTP client request.
Definition http.h:48
std::function< void(const unsigned char *data, size_t len, bool done) > ReadCallback
Type used for callback on read.
Definition http.h:52
virtual ~HttpClientRequest() noexcept
HttpClientRequest() noexcept
Create a request for the specified URL.
virtual void start_async(const std::string &url, ReadCallback callback)
Start the download.
EGT framework namespace.
Definition animation.h:24