From baa0e6cbb67912530d80d218712e6ca1e423f4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Thu, 3 Sep 2020 19:12:17 +0800 Subject: logIn as static member functions --- qicclient/admin.hxx | 19 ++++++++++--------- qicclient/member.hxx | 16 ++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'qicclient') diff --git a/qicclient/admin.hxx b/qicclient/admin.hxx index 1e728cb..f19f167 100644 --- a/qicclient/admin.hxx +++ b/qicclient/admin.hxx @@ -22,9 +22,17 @@ namespace QICClient { m_userName{""}, m_password{""}, m_name{""}, - m_super{false} + m_super{false}, + m_data{nullptr} {} ~Admin() {} + static std::shared_ptr logIn(QString const& username, + QString const& password, + QString const& successPage = nullptr, + QString const& nextPage = nullptr, + QString const& failPage = nullptr, + size_t (*handler)(void*, size_t, size_t, + void*) = nullptr); QString const& userName() const { return m_userName; } QString const& password() const { return m_password; } @@ -36,13 +44,6 @@ namespace QICClient { void setName(QString const& name); void setSuper(bool super); - void logIn(QString const& username, QString const& password, - QString const& successPage = nullptr, - QString const& nextPage = nullptr, - QString const& failPage = nullptr, - size_t (*handler)(void*, size_t, size_t, - void*) = nullptr); - public slots: void newItem(QString const& description, QString const& comment, QString const& price, QString const& imagePath); @@ -60,7 +61,7 @@ namespace QICClient { QString m_name; bool m_super; icclient_admin* m_data; - void setData(icclient_admin* data); + inline void setData(icclient_admin* data); }; } diff --git a/qicclient/member.hxx b/qicclient/member.hxx index 86289c0..864d353 100644 --- a/qicclient/member.hxx +++ b/qicclient/member.hxx @@ -56,6 +56,13 @@ namespace QICClient { m_data{nullptr} {} ~Member() {} + static std::shared_ptr logIn(QString const& username, + QString const& password, + QString const& successPage = nullptr, + QString const& nextPage = nullptr, + QString const& failPage = nullptr, + size_t (*handler)(void*, size_t, size_t, + void*) = nullptr); QString const& userName() const { return m_userName; } QString const& userNick() const { return m_userNick; } @@ -97,13 +104,6 @@ namespace QICClient { void setPhoneDay(QString const& phoneDay); void setEmail(QString const& email); - void logIn(QString const& username, QString const& password, - QString const& successPage = nullptr, - QString const& nextPage = nullptr, - QString const& failPage = nullptr, - size_t (*handler)(void*, size_t, size_t, - void*) = nullptr); - public slots: void account(QString const& firstName, QString const& lastName, QString const& address1, QString const& address2, @@ -156,7 +156,7 @@ namespace QICClient { QString m_phoneDay; QString m_email; icclient_member* m_data; - void setData(icclient_member* data); + inline void setData(icclient_member* data); }; } -- cgit v1.2.3