From 597163edb74e7cef5da39361f67686c2d5cac902 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: Sat, 10 Jul 2021 18:58:44 +0800 Subject: Wrapper for icclient_path --- client.cxx | 13 +++++++++++++ qicclient.hxx | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/client.cxx b/client.cxx index 37875b1..4c54605 100644 --- a/client.cxx +++ b/client.cxx @@ -37,6 +37,14 @@ namespace QICClient { }, nullptr); } + void Client::path(QString const& path) + { + icclient_path(path.toLatin1().constData(), [](icclient_response* response) { + client->emitPath(QString{response->data}); + icclient_free_response(response); + }); + } + void Client::defaultCatalog(QString const& prodGroup) { icclient_catalog(prodGroup.toLatin1().constData(), nullptr, [](struct icclient_catalog* catalog) { @@ -59,6 +67,11 @@ namespace QICClient { emit gotProduct(product); } + void Client::emitPath(QString const& path) + { + emit gotPath(path); + } + void Client::order(QString const& sku, Catalog const& catalog, Ord& order) { auto c_order = order.data(); diff --git a/qicclient.hxx b/qicclient.hxx index 664b566..88f07d8 100644 --- a/qicclient.hxx +++ b/qicclient.hxx @@ -47,6 +47,11 @@ namespace QICClient { * \param sku The SKU of the item to order. */ void product(QString const& sku); + /*! + * \brief For fetching data from a specific path. + * \param path The path. + */ + void path(QString const& path); /*! * \brief For fetching products that belong a specific group. * \param prodGroup The name of the product group. @@ -60,10 +65,12 @@ namespace QICClient { signals: void gotCatalog(QString const& response); void gotProduct(QString const& response); + void gotPath(QString const& response); protected: void emitCatalog(QString const& response); void emitProduct(QString const& response); + void emitPath(QString const& response); }; } -- cgit v1.2.3