From 469987e585ff23f3ae7ab221b826264d734cd06b Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 26 Sep 2019 16:04:10 -0300 Subject: [PATCH] Adding getDescription and getSummary on action object. --- client/src/core/actions.cc | 17 +++++++++++++++++ client/src/include/lib3270/ipc/action.h | 10 ++++++++++ client/src/session/local/actions.cc | 3 +-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/client/src/core/actions.cc b/client/src/core/actions.cc index 5b744f9..b08b937 100644 --- a/client/src/core/actions.cc +++ b/client/src/core/actions.cc @@ -38,9 +38,26 @@ #include #include + #include + #include /*---[ Implement ]----------------------------------------------------------------------------------*/ + TN3270::Action::Action(const LIB3270_ACTION *descriptor) { + this->descriptor = descriptor; + } + + TN3270::Action::~Action() { + } + + const char * TN3270::Action::getDescription() const noexcept { + return lib3270_property_get_description((const LIB3270_PROPERTY *) this->descriptor); + } + + const char * TN3270::Action::getSummary() const noexcept { + return lib3270_property_get_summary((const LIB3270_PROPERTY *) this->descriptor); + } + std::vector TN3270::getActions() { std::vector actions; diff --git a/client/src/include/lib3270/ipc/action.h b/client/src/include/lib3270/ipc/action.h index f26362e..6be8749 100644 --- a/client/src/include/lib3270/ipc/action.h +++ b/client/src/include/lib3270/ipc/action.h @@ -41,19 +41,29 @@ #define IPC3270_ACTION_H_INCLUDED #include + #include namespace TN3270 { /// @brief TN3270 Action class TN3270_PUBLIC Action { + protected: + const LIB3270_ACTION *descriptor; + + Action(const LIB3270_ACTION *descriptor); + public: virtual bool activatable() const noexcept = 0; virtual void activate() = 0; + virtual ~Action(); inline operator bool() const noexcept { return activatable(); } + const char * getDescription() const noexcept; + const char * getSummary() const noexcept; + }; } diff --git a/client/src/session/local/actions.cc b/client/src/session/local/actions.cc index e8cf9bd..19e92c3 100644 --- a/client/src/session/local/actions.cc +++ b/client/src/session/local/actions.cc @@ -44,9 +44,8 @@ namespace TN3270 { - Local::Action::Action(Session *session, const LIB3270_ACTION *descriptor) { + Local::Action::Action(Session *session, const LIB3270_ACTION *descriptor) : TN3270::Action(descriptor) { this->session = session; - this->descriptor = descriptor; } bool Local::Action::activatable() const noexcept { -- libgit2 0.21.2