From a1e538564d4b2a60be70a32ec39afdba249ce37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Wed, 9 Jun 2021 19:55:28 +0800 Subject: Add support for Emscripten --- client.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx index edb1c84..ff28eaa 100644 --- a/client.cxx +++ b/client.cxx @@ -1,10 +1,12 @@ #include #include #include +#include #include -#include #include "qicclient/catalog.hxx" +#ifndef __EMSCRIPTEN__ #include "qicclient/ord.hxx" +#endif #include "qicclient/client.hxx" namespace QICClient { @@ -19,29 +21,28 @@ namespace QICClient { icclient_cleanup(); } - void Client::results(QString const& prodGroup, - size_t (*handler)(void*, size_t, size_t, void*)) + void Client::results(QString const& prodGroup, icclient_handler handler) { icclient_catalog* catalog = nullptr; icclient_results(prodGroup.toLatin1().constData(), handler, &catalog); if (catalog) emit gotResults(new Catalog{catalog}); } - void Client::allProducts(size_t (*handler)(void*, size_t, size_t, void*)) + void Client::allProducts(icclient_handler handler) { icclient_catalog* catalog = nullptr; icclient_allproducts(handler, &catalog); if (catalog) emit gotResults(new Catalog{catalog}); } - void Client::flyPage(QString const& sku, - size_t (*handler)(void*, size_t, size_t, void*)) + void Client::flyPage(QString const& sku,icclient_handler handler) { icclient_product* product = nullptr; icclient_flypage(sku.toLatin1().constData(), handler, &product); if (product) emit gotFlyPage(shared_ptr{new Product{product}}); } +#ifndef __EMSCRIPTEN__ void Client::order(QString const& sku, Catalog const& catalog, Ord& order) { auto c_order = order.data(); @@ -49,5 +50,6 @@ namespace QICClient { &c_order); order.setData(c_order); } +#endif } -- cgit v1.2.3