Commit 469987e585ff23f3ae7ab221b826264d734cd06b
1 parent
ccc0ad39
Exists in
master
and in
1 other branch
Adding getDescription and getSummary on action object.
Showing
3 changed files
with
28 additions
and
2 deletions
Show diff stats
client/src/core/actions.cc
@@ -38,9 +38,26 @@ | @@ -38,9 +38,26 @@ | ||
38 | 38 | ||
39 | #include <lib3270/ipc.h> | 39 | #include <lib3270/ipc.h> |
40 | #include <lib3270/toggle.h> | 40 | #include <lib3270/toggle.h> |
41 | + #include <lib3270/properties.h> | ||
42 | + #include <lib3270/ipc/action.h> | ||
41 | 43 | ||
42 | /*---[ Implement ]----------------------------------------------------------------------------------*/ | 44 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
43 | 45 | ||
46 | + TN3270::Action::Action(const LIB3270_ACTION *descriptor) { | ||
47 | + this->descriptor = descriptor; | ||
48 | + } | ||
49 | + | ||
50 | + TN3270::Action::~Action() { | ||
51 | + } | ||
52 | + | ||
53 | + const char * TN3270::Action::getDescription() const noexcept { | ||
54 | + return lib3270_property_get_description((const LIB3270_PROPERTY *) this->descriptor); | ||
55 | + } | ||
56 | + | ||
57 | + const char * TN3270::Action::getSummary() const noexcept { | ||
58 | + return lib3270_property_get_summary((const LIB3270_PROPERTY *) this->descriptor); | ||
59 | + } | ||
60 | + | ||
44 | std::vector<const LIB3270_ACTION *> TN3270::getActions() { | 61 | std::vector<const LIB3270_ACTION *> TN3270::getActions() { |
45 | 62 | ||
46 | std::vector<const LIB3270_ACTION *> actions; | 63 | std::vector<const LIB3270_ACTION *> actions; |
client/src/include/lib3270/ipc/action.h
@@ -41,19 +41,29 @@ | @@ -41,19 +41,29 @@ | ||
41 | #define IPC3270_ACTION_H_INCLUDED | 41 | #define IPC3270_ACTION_H_INCLUDED |
42 | 42 | ||
43 | #include <lib3270/ipc.h> | 43 | #include <lib3270/ipc.h> |
44 | + #include <string.h> | ||
44 | 45 | ||
45 | namespace TN3270 { | 46 | namespace TN3270 { |
46 | 47 | ||
47 | /// @brief TN3270 Action | 48 | /// @brief TN3270 Action |
48 | class TN3270_PUBLIC Action { | 49 | class TN3270_PUBLIC Action { |
50 | + protected: | ||
51 | + const LIB3270_ACTION *descriptor; | ||
52 | + | ||
53 | + Action(const LIB3270_ACTION *descriptor); | ||
54 | + | ||
49 | public: | 55 | public: |
50 | virtual bool activatable() const noexcept = 0; | 56 | virtual bool activatable() const noexcept = 0; |
51 | virtual void activate() = 0; | 57 | virtual void activate() = 0; |
58 | + virtual ~Action(); | ||
52 | 59 | ||
53 | inline operator bool() const noexcept { | 60 | inline operator bool() const noexcept { |
54 | return activatable(); | 61 | return activatable(); |
55 | } | 62 | } |
56 | 63 | ||
64 | + const char * getDescription() const noexcept; | ||
65 | + const char * getSummary() const noexcept; | ||
66 | + | ||
57 | }; | 67 | }; |
58 | 68 | ||
59 | } | 69 | } |
client/src/session/local/actions.cc
@@ -44,9 +44,8 @@ | @@ -44,9 +44,8 @@ | ||
44 | 44 | ||
45 | namespace TN3270 { | 45 | namespace TN3270 { |
46 | 46 | ||
47 | - Local::Action::Action(Session *session, const LIB3270_ACTION *descriptor) { | 47 | + Local::Action::Action(Session *session, const LIB3270_ACTION *descriptor) : TN3270::Action(descriptor) { |
48 | this->session = session; | 48 | this->session = session; |
49 | - this->descriptor = descriptor; | ||
50 | } | 49 | } |
51 | 50 | ||
52 | bool Local::Action::activatable() const noexcept { | 51 | bool Local::Action::activatable() const noexcept { |