From f91691a987aaca4a16a2ffe8d4ad3b6c6b8c8059 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: Sun, 13 Jun 2021 10:34:53 +0800 Subject: Move basic header outside of package dir --- CMakeLists.txt | 37 ++++++++---------------------- client.cxx | 3 +-- qicclient.hxx | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ qicclient/client.hxx | 63 --------------------------------------------------- 4 files changed, 75 insertions(+), 92 deletions(-) create mode 100644 qicclient.hxx delete mode 100644 qicclient/client.hxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 15a39d7..c7ff803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,48 +2,31 @@ cmake_minimum_required(VERSION 3.5) project(qicclient) set(CMAKE_AUTOMOC ON) find_package(Qt5Core) - set(HDRS - ${PROJECT_NAME}/product.hxx ${PROJECT_NAME}/catalog.hxx - ${PROJECT_NAME}/client.hxx + ${PROJECT_NAME}/product.hxx + ${PROJECT_NAME}/ord.hxx + ${PROJECT_NAME}/member.hxx + ${PROJECT_NAME}/admin.hxx ) - -if (NOT EMSCRIPTEN) - set(HDRS - ${HDRS} - ${PROJECT_NAME}/ord.hxx - ${PROJECT_NAME}/member.hxx - ${PROJECT_NAME}/admin.hxx - ) -endif() - set(SRCS + ${PROJECT_NAME}.hxx ${HDRS} - catalog.cxx client.cxx + catalog.cxx + ord.cxx + member.cxx + admin.cxx ) - -if (NOT EMSCRIPTEN) - set(SRCS - ${SRCS} - ord.cxx - member.cxx - admin.cxx - ) -endif() - if (EMSCRIPTEN OR IOS) add_library(${PROJECT_NAME} STATIC ${SRCS}) else() add_library(${PROJECT_NAME} SHARED ${SRCS}) endif() - target_link_libraries(${PROJECT_NAME} Qt5::Core icclient ) - -target_compile_definitions(${PROJECT_NAME} PRIVATE QICCLIENT) install(TARGETS ${PROJECT_NAME} DESTINATION lib) +install(FILES ${PROJECT_NAME}.hxx DESTINATION include) install(FILES ${HDRS} DESTINATION include/${PROJECT_NAME}) diff --git a/client.cxx b/client.cxx index 9cbbcf9..4321726 100644 --- a/client.cxx +++ b/client.cxx @@ -1,9 +1,8 @@ #include #include #include -#include "qicclient/catalog.hxx" +#include "qicclient.hxx" #include "qicclient/ord.hxx" -#include "qicclient/client.hxx" static QICClient::Client *client; diff --git a/qicclient.hxx b/qicclient.hxx new file mode 100644 index 0000000..aa8bca9 --- /dev/null +++ b/qicclient.hxx @@ -0,0 +1,64 @@ +#ifndef QICCLIENT_CLIENT_HXX +#define QICCLIENT_CLIENT_HXX + +#include +#include +#include + +namespace QICClient { + + using std::shared_ptr; + class Catalog; + class Ord; + + class Client : public QObject + { + 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(); + + /*! + * \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, icclient_handler handler = nullptr); + + /*! + * \brief For fetching data about all active products. + * \param handler A pointer to a cURL write function callback. + */ + void allProducts(icclient_handler handler = nullptr); + + void emitCatalog(icclient_catalog *catalog); + + /*! + * \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, icclient_handler handler); + + /*! + * \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, Ord& order); + + signals: + void gotResults(Catalog* catalog); + void gotFlyPage(shared_ptr product); + }; + +} + +#endif diff --git a/qicclient/client.hxx b/qicclient/client.hxx deleted file mode 100644 index 1a86a36..0000000 --- a/qicclient/client.hxx +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef QICCLIENT_CLIENT_HXX -#define QICCLIENT_CLIENT_HXX - -#include -#include - -namespace QICClient { - - using std::shared_ptr; - class Catalog; - class Ord; - - class Client : public QObject - { - 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(); - - /*! - * \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, icclient_handler handler = nullptr); - - /*! - * \brief For fetching data about all active products. - * \param handler A pointer to a cURL write function callback. - */ - void allProducts(icclient_handler handler = nullptr); - - void emitCatalog(icclient_catalog *catalog); - - /*! - * \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, icclient_handler handler); - - /*! - * \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, Ord& order); - - signals: - void gotResults(Catalog* catalog); - void gotFlyPage(shared_ptr product); - }; - -} - -#endif -- cgit v1.2.3