2#include <ossia/network/context.hpp>
3#include <ossia/network/http/http_client.hpp>
4#include <ossia/network/http/http_client_request.hpp>
6#include <ossia-qt/protocols/utils.hpp>
7#include <ossia-qt/qml_protocols.hpp>
14struct qml_protocols_http_answer;
15struct qml_protocols_http_error;
17 = ossia::net::http_get_request<qml_protocols_http_answer, qml_protocols_http_error>;
19struct qml_protocols_http_answer
21 static constexpr int reserve_expect = 65536 * 8;
22 QPointer<qml_protocols> self{};
24 void operator()(
auto& req, std::string_view str)
26 ossia::qt::run_async(self.get(), [self = self, v = v, s = QString::fromUtf8(str)] {
33struct qml_protocols_http_error
35 void operator()(
auto& self) { }
40struct qml_protocols_fetch_answer;
41struct qml_protocols_fetch_error;
42using fetch_request_type = ossia::net::http_client_request<
43 qml_protocols_fetch_answer, qml_protocols_fetch_error>;
45struct qml_protocols_fetch_answer
47 static constexpr int reserve_expect = 65536 * 8;
48 QPointer<qml_protocols> self{};
50 void operator()(
auto& req,
int status, std::string_view str)
54 [self = self, v = onResponse, status, s = QString::fromUtf8(str)] {
58 auto engine = qjsEngine(self.get());
60 v.call({QJSValue(status), engine->toScriptValue(s)});
66struct qml_protocols_fetch_error
68 QPointer<qml_protocols> self{};
70 void operator()(
auto& req, std::string_view msg)
73 self.get(), [self = self, v = onError, m = QString::fromUtf8(msg)] {
Definition qml_device.cpp:43