summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2020-06-29 21:19:58 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2020-06-29 21:19:58 +0800
commitdd94e52d98aa29e0273176e038864c13fbd4aa6b (patch)
tree926590e7b82d85ff151d1e7cbef81e4cfe624338
parent8285dbcaa075ed2eb316b06f33ddf27f3a7f1e4b (diff)
Reorder results and flyPage parameters
Remove cURL handler parameter variables, and copy documentation from libicclient.
-rw-r--r--client.cxx10
m---------libicclient0
-rw-r--r--qicclient/client.hxx45
3 files changed, 38 insertions, 17 deletions
diff --git a/client.cxx b/client.cxx
index 90b8890..d10c9b6 100644
--- a/client.cxx
+++ b/client.cxx
@@ -19,9 +19,8 @@ namespace ICClient {
icclient_cleanup();
}
- void Client::results(size_t (*handler)(void* contents, size_t size,
- size_t nmemb, void* userdata),
- QString const& prodGroup)
+ void Client::results(QString const& prodGroup,
+ size_t (*handler)(void*, size_t, size_t, void*))
{
icclient_catalog* catalog = nullptr;
icclient_results(prodGroup.toLatin1().constData(), handler, &catalog);
@@ -35,9 +34,8 @@ namespace ICClient {
if (catalog) emit gotResults(new Catalog{catalog});
}
- void Client::flyPage(size_t (*handler)(void* contents, size_t size,
- size_t nmemb, void* userdata),
- QString const& sku)
+ void Client::flyPage(QString const& sku,
+ size_t (*handler)(void*, size_t, size_t, void*))
{
icclient_product* product = nullptr;
icclient_flypage(sku.toLatin1().constData(), handler, &product);
diff --git a/libicclient b/libicclient
-Subproject e13c106e8b28111feb0f71e5c04cab8637fcadb
+Subproject 3074a867e052af594f1c7252c9cb967ff0747f4
diff --git a/qicclient/client.hxx b/qicclient/client.hxx
index 056b3f8..d05d101 100644
--- a/qicclient/client.hxx
+++ b/qicclient/client.hxx
@@ -17,22 +17,45 @@ namespace ICClient {
Q_OBJECT
public:
+ /*!
+ * \brief Constructor.
+ * \param url Server root URL.
+ * \param certificate Path to the CA certificate file.
+ */
Client(char const* url, char const* certificate = nullptr);
~Client();
- void results(size_t (*handler)(void* contents,
- size_t size, size_t nmemb,
- void* userdata),
- QString const& prodGroup);
- void allProducts(size_t (*handler)(void* contents,
- size_t size, size_t nmemb,
- void* userdata));
- void flyPage(size_t (*handler)(void* contents,
- size_t size, size_t nmemb,
- void* userdata),
- QString const& sku);
+ /*!
+ * \brief For fetching products that belong a specific group.
+ * \param prodGroup The name of the product group.
+ * \param handler A pointer to a cURL write function callback.
+ */
+ void results(QString const& prodGroup,
+ size_t (*handler)(void*, size_t, size_t, void*));
+
+ /*!
+ * \brief For fetching data about all active products.
+ * \param handler A pointer to a cURL write function callback.
+ */
+ void allProducts(size_t (*handler)(void*, size_t, size_t, void*));
+
+ /*!
+ * \brief For fetching data about a specific product.
+ * \param sku The SKU of the item to order.
+ * \param handler A pointer to a cURL write function callback.
+ */
+ void flyPage(QString const& sku,
+ size_t (*handler)(void*, size_t, size_t, void*));
+
+ /*!
+ * \brief For putting an item to a cart.
+ * \param sku The SKU of the item to order.
+ * \param catalog The catalog from which the item is.
+ * \param order The order.
+ */
void order(QString const& sku, Catalog const& catalog,
Basket& order);
+
void logIn(size_t (*handler)(void*, size_t, size_t, void*),
icclient_user* user,
QString const& username,