2#include <ossia/network/context.hpp>
3#include <ossia/network/http/http_client_request.hpp>
5#include <ossia-qt/protocols/utils.hpp>
6#include <ossia-qt/qml_protocols.hpp>
13struct qml_protocols_http_answer;
14struct qml_protocols_http_error;
15using request_type = ossia::net::http_client_request<
16 qml_protocols_http_answer, qml_protocols_http_error>;
18struct qml_protocols_http_answer
20 static constexpr int reserve_expect = 65536 * 8;
21 QPointer<qml_protocols> self{};
27 void operator()(
auto& req,
int status, std::string_view str)
29 if(status < 200 || status >= 300)
32 ossia::qt::run_async(self.get(), [self = self, v = v, s = QString::fromUtf8(str)] {
42struct qml_protocols_http_error
44 void operator()(
auto& req, std::string_view msg)
52struct qml_protocols_fetch_answer;
53struct qml_protocols_fetch_error;
54using fetch_request_type = ossia::net::http_client_request<
55 qml_protocols_fetch_answer, qml_protocols_fetch_error>;
57struct qml_protocols_fetch_answer
59 static constexpr int reserve_expect = 65536 * 8;
60 QPointer<qml_protocols> self{};
62 void operator()(
auto& req,
int status, std::string_view str)
66 [self = self, v = onResponse, status, s = QString::fromUtf8(str)] {
70 auto engine = qjsEngine(self.get());
72 v.call({QJSValue(status), engine->toScriptValue(s)});
78struct qml_protocols_fetch_error
80 QPointer<qml_protocols> self{};
82 void operator()(
auto& req, std::string_view msg)
85 self.get(), [self = self, v = onError, m = QString::fromUtf8(msg)] {
Definition qml_device.cpp:43
spdlog::logger & logger() noexcept
Where the errors will be logged. Default is stderr.
Definition context.cpp:120