diff --git a/client/ipcclient.cbp b/client/ipcclient.cbp index 2a18400..f867881 100644 --- a/client/ipcclient.cbp +++ b/client/ipcclient.cbp @@ -70,6 +70,7 @@ + diff --git a/client/src/core/actions.cc b/client/src/core/actions.cc index 1c3eade..6de2ab6 100644 --- a/client/src/core/actions.cc +++ b/client/src/core/actions.cc @@ -52,13 +52,15 @@ TN3270::Action::~Action() { } + const char * TN3270::Action::getName() const noexcept { + return ((const LIB3270_PROPERTY *) this->descriptor)->name; + } + const char * TN3270::Action::getDescription() const noexcept { - debug(__FUNCTION__,"(",(void *) descriptor,")"); return lib3270_property_get_description((const LIB3270_PROPERTY *) this->descriptor); } const char * TN3270::Action::getSummary() const noexcept { - debug(__FUNCTION__,"(",(void *) descriptor,")"); return lib3270_property_get_summary((const LIB3270_PROPERTY *) this->descriptor); } diff --git a/client/src/core/session.cc b/client/src/core/session.cc index fe21e7d..e2a7c19 100644 --- a/client/src/core/session.cc +++ b/client/src/core/session.cc @@ -460,6 +460,20 @@ throw std::system_error(ENOTSUP, std::system_category()); } + Action * Session::getAction(const char *name) { + + for(auto action : getActions()) { + + if(strcasecmp(action->name,name) == 0) { + return getAction(action); + } + + } + + throw std::system_error(EINVAL, std::system_category()); + + } + } diff --git a/client/src/include/lib3270/ipc.h b/client/src/include/lib3270/ipc.h index 1af71f3..29e3c4f 100644 --- a/client/src/include/lib3270/ipc.h +++ b/client/src/include/lib3270/ipc.h @@ -583,9 +583,12 @@ /// @brief Insert event listener. // void insert(Event::Type type, std::function listener); - /// @brief Create an action object + /// @brief Create an action object. virtual Action * getAction(const LIB3270_ACTION *descriptor); + /// @brief Create an action object. + Action * getAction(const char *name); + /// @brief Checks if the terminal contains the string. size_t find(const char * str, size_t pos = 0) const; @@ -814,6 +817,15 @@ return session->getAction(descriptor); } + /// @brief Create new action object. + /// + /// Alocate a new action object associated with the session, delete it + /// when no longer necessary. + /// + inline TN3270::Action * getAction(const char *name) { + return session->getAction(name); + } + /// @brief Send PF. inline Host & pfkey(unsigned short value) { session->pfkey(value); diff --git a/client/src/include/lib3270/ipc/action.h b/client/src/include/lib3270/ipc/action.h index eee6567..3691130 100644 --- a/client/src/include/lib3270/ipc/action.h +++ b/client/src/include/lib3270/ipc/action.h @@ -62,6 +62,7 @@ return activatable(); } + const char * getName() const noexcept; const char * getDescription() const noexcept; const char * getSummary() const noexcept; diff --git a/client/src/session/action.cc b/client/src/session/action.cc new file mode 100644 index 0000000..06d07a9 --- /dev/null +++ b/client/src/session/action.cc @@ -0,0 +1,49 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief + * + * @author perry.werneck@gmail.com + * + */ + +#include + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + namespace TN3270 { + + + + } + + diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index 4dacefd..c8650fa 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -41,6 +41,7 @@ #include #include #include + #include using namespace std; @@ -196,6 +197,7 @@ //testHost(session); //testAttributes(session); + /* { TN3270::Host host{":a",nullptr,10}; @@ -205,6 +207,17 @@ cout << "post: " << host["url"] << endl; } + */ + + { + TN3270::Host host{":a",nullptr,10}; + + TN3270::Action * action = host.getAction("reconnect"); + + action->activatable(); + + delete action; + } /* -- libgit2 0.21.2