Commit 60f3a050afe78dbfd5e463f9e64f667cc0375d65

Authored by Perry Werneck
1 parent 09f7edb3

Workin on new C++ API.

src/include/lib3270++.h
... ... @@ -74,6 +74,7 @@
74 74 Popup, ///< @brief Popup message.
75 75 Trace, ///< @brief Trace message.
76 76 Message, ///< @brief Generic message.
  77 + Connection ///< @brief Connect/Disconnect event.
77 78 };
78 79  
79 80 private:
... ... @@ -220,6 +221,10 @@
220 221 return getConnectionState();
221 222 }
222 223  
  224 + inline bool operator==(ConnectionState state) const noexcept {
  225 + return this->getConnectionState() == state;
  226 + }
  227 +
223 228 // Set contents.
224 229  
225 230 /// @brief Set field at current posicion, jumps to next writable field.
... ... @@ -272,6 +277,10 @@
272 277 Host(const char *id = nullptr, const char *url = nullptr);
273 278 ~Host();
274 279  
  280 + inline bool operator==(ConnectionState state) const noexcept {
  281 + return session->getConnectionState() == state;
  282 + }
  283 +
275 284 inline void connect(const char *url) {
276 285 this->session->connect(url);
277 286 }
... ...
src/lib3270++/lib3270++.cbp
... ... @@ -46,7 +46,8 @@
46 46 <Unit filename="abstract.cc" />
47 47 <Unit filename="events.cc" />
48 48 <Unit filename="host.cc" />
49   - <Unit filename="local.cc" />
  49 + <Unit filename="local/events.cc" />
  50 + <Unit filename="local/session.cc" />
50 51 <Unit filename="private.h" />
51 52 <Unit filename="session.cc" />
52 53 <Unit filename="testprogram/testprogram.cc" />
... ...
src/lib3270++/local.cc
... ... @@ -1,231 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como lib3270++.h e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - */
29   -
30   -/**
31   - * @file src/lib3270++/local.cc
32   - *
33   - * @brief Implement lib3270 direct access layout (NO IPC).
34   - *
35   - * @author perry.werneck@gmail.com
36   - *
37   - */
38   -
39   - #include "private.h"
40   - #include <lib3270/actions.h>
41   -
42   - using std::string;
43   -
44   -/*---[ Implement ]----------------------------------------------------------------------------------*/
45   -
46   - namespace TN3270 {
47   -
48   - LocalSession::LocalSession() : Abstract::Session() {
49   -
50   - std::lock_guard<std::mutex> lock(sync);
51   -
52   - this->hSession = lib3270_session_new("");
53   - lib3270_set_user_data(this->hSession,(void *) this);
54   - setCharSet(lib3270_get_display_charset(this->hSession));
55   -
56   - lib3270_set_popup_handler(this->hSession, popupHandler);
57   -
58   - }
59   -
60   - /// @brief Popup Handler.
61   - int LocalSession::popupHandler(H3270 *h3270, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) {
62   -
63   - LocalSession * session = (LocalSession *) lib3270_get_user_data(h3270);
64   -
65   - if(!session) {
66   - throw std::runtime_error("Invalid session handler");
67   - }
68   -
69   - class PopupEvent : public Event {
70   - private:
71   - LIB3270_NOTIFY type;
72   - string title;
73   - string msg;
74   - string description;
75   -
76   - public:
77   - PopupEvent(LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) : Event(Event::Popup) {
78   -
79   - this->type = type;
80   - this->title = title;
81   - this->msg = msg;
82   -
83   - char * buffer = NULL;
84   - if(vasprintf(&buffer,fmt,arg) != -1) {
85   - this->description = buffer;
86   - free(buffer);
87   - }
88   -
89   -#ifdef DEBUG
90   - std::cerr << "Popup:" << std::endl
91   - << "\t" << title << std::endl
92   - << "\t" << msg << std::endl
93   - << "\t" << description << std::endl;
94   -#endif // DEBUG
95   -
96   - }
97   -
98   - virtual ~PopupEvent() {
99   - }
100   -
101   - /// @brief Get event description.
102   - std::string toString() const override {
103   - return msg;
104   - }
105   -
106   -
107   - };
108   -
109   - session->fire(PopupEvent(type,title,msg,fmt,arg));
110   -
111   - return 0;
112   -
113   - }
114   -
115   - LocalSession::~LocalSession() {
116   -
117   - std::lock_guard<std::mutex> lock(sync);
118   -
119   - lib3270_session_free(this->hSession);
120   - this->hSession = nullptr;
121   - }
122   -
123   - void LocalSession::wait(time_t timeout) {
124   -
125   - int rc = lib3270_wait_for_ready(this->hSession, timeout);
126   -
127   - if(rc) {
128   - throw std::system_error(rc, std::system_category());
129   - }
130   -
131   - }
132   -
133   - void LocalSession::connect(const char *url) {
134   - std::lock_guard<std::mutex> lock(sync);
135   - int rc = lib3270_connect_url(hSession,url,0);
136   -
137   - if(rc) {
138   - throw std::system_error(rc, std::system_category());
139   - }
140   -
141   - wait();
142   -
143   - }
144   -
145   - void LocalSession::disconnect() {
146   - std::lock_guard<std::mutex> lock(sync);
147   - lib3270_disconnect(hSession);
148   - }
149   -
150   - // Wait for session state.
151   - void LocalSession::waitForReady(time_t timeout) throw() {
152   -
153   - std::lock_guard<std::mutex> lock(sync);
154   - wait(timeout);
155   -
156   - }
157   -
158   - // Gets
159   - std::string LocalSession::toString() const {
160   - std::lock_guard<std::mutex> lock(const_cast<LocalSession *>(this)->sync);
161   - }
162   -
163   - std::string LocalSession::toString(int baddr, size_t len, bool lf) {
164   - std::lock_guard<std::mutex> lock(sync);
165   - }
166   -
167   - std::string LocalSession::toString(int row, int col, size_t sz, bool lf) {
168   - std::lock_guard<std::mutex> lock(sync);
169   - }
170   -
171   - ProgramMessage LocalSession::getProgramMessage() const {
172   - std::lock_guard<std::mutex> lock(const_cast<LocalSession *>(this)->sync);
173   - return (ProgramMessage) lib3270_get_program_message(this->hSession);
174   - }
175   -
176   - ConnectionState LocalSession::getConnectionState() const {
177   - std::lock_guard<std::mutex> lock(const_cast<LocalSession *>(this)->sync);
178   - return (ConnectionState) lib3270_get_connection_state(this->hSession);
179   - }
180   -
181   - /// @brief Set field at current posicion, jumps to next writable field.
182   - TN3270::Session & LocalSession::push(const char *text) {
183   - std::lock_guard<std::mutex> lock(sync);
184   - return *this;
185   - }
186   -
187   - TN3270::Session & LocalSession::push(int baddr, const std::string &text) {
188   - std::lock_guard<std::mutex> lock(sync);
189   - return *this;
190   - }
191   -
192   - TN3270::Session & LocalSession::push(int row, int col, const std::string &text) {
193   - std::lock_guard<std::mutex> lock(sync);
194   - return *this;
195   - }
196   -
197   - TN3270::Session & LocalSession::push(const PFKey key) {
198   - std::lock_guard<std::mutex> lock(sync);
199   - lib3270_pfkey(hSession,(int) key);
200   - return *this;
201   - }
202   -
203   - TN3270::Session & LocalSession::push(const PAKey key) {
204   - std::lock_guard<std::mutex> lock(sync);
205   - lib3270_pakey(hSession,(int) key);
206   - return *this;
207   - }
208   -
209   - TN3270::Session & LocalSession::push(const Action action) {
210   - std::lock_guard<std::mutex> lock(sync);
211   - return *this;
212   - }
213   -
214   - TN3270::Session & LocalSession::pop(int baddr, std::string &text) {
215   - std::lock_guard<std::mutex> lock(sync);
216   - return *this;
217   - }
218   -
219   - TN3270::Session & LocalSession::pop(int row, int col, std::string &text) {
220   - std::lock_guard<std::mutex> lock(sync);
221   - return *this;
222   - }
223   -
224   - TN3270::Session & LocalSession::pop(std::string &text) {
225   - std::lock_guard<std::mutex> lock(sync);
226   - return *this;
227   - }
228   -
229   - }
230   -
231   -
src/lib3270++/local/events.cc 0 → 100644
... ... @@ -0,0 +1,147 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como lib3270++.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +/**
  31 + * @file src/lib3270++/local/events.cc
  32 + *
  33 + * @brief Implement lib3270 direct access events.
  34 + *
  35 + * @author perry.werneck@gmail.com
  36 + *
  37 + */
  38 +
  39 + #include "../private.h"
  40 +
  41 + extern "C" {
  42 + #include <lib3270/actions.h>
  43 + #include <lib3270/session.h>
  44 + }
  45 +
  46 + using std::string;
  47 +
  48 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  49 +
  50 + namespace TN3270 {
  51 +
  52 + /// @brief Popup Handler.
  53 + int Local::Session::popupHandler(H3270 *h3270, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) {
  54 +
  55 + Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270);
  56 +
  57 + if(!session) {
  58 + throw std::runtime_error("Invalid session handler");
  59 + }
  60 +
  61 + class PopupEvent : public TN3270::Event {
  62 + private:
  63 + LIB3270_NOTIFY type;
  64 + string title;
  65 + string msg;
  66 + string description;
  67 +
  68 + public:
  69 + PopupEvent(LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) : Event(Event::Popup) {
  70 +
  71 + this->type = type;
  72 + this->title = title;
  73 + this->msg = msg;
  74 +
  75 + char * buffer = NULL;
  76 + if(vasprintf(&buffer,fmt,arg) != -1) {
  77 + this->description = buffer;
  78 + free(buffer);
  79 + }
  80 +
  81 +#ifdef DEBUG
  82 + std::cerr << "Popup:" << std::endl
  83 + << "\t" << title << std::endl
  84 + << "\t" << msg << std::endl
  85 + << "\t" << description << std::endl;
  86 +#endif // DEBUG
  87 +
  88 + }
  89 +
  90 + virtual ~PopupEvent() {
  91 + }
  92 +
  93 + /// @brief Get event description.
  94 + std::string toString() const override {
  95 + return msg;
  96 + }
  97 +
  98 +
  99 + };
  100 +
  101 + session->fire(PopupEvent(type,title,msg,fmt,arg));
  102 +
  103 + return 0;
  104 +
  105 + }
  106 +
  107 + /// @brief Connect Handler.
  108 + void Local::Session::connectHandler(H3270 *h3270, unsigned char connected) {
  109 +
  110 + Local::Session * session = (Local::Session *) lib3270_get_user_data(h3270);
  111 +
  112 + if(!session) {
  113 + throw std::runtime_error("Invalid session handler");
  114 + }
  115 +
  116 + class ConnectionEvent : public TN3270::Event {
  117 + private:
  118 + bool connected;
  119 +
  120 + public:
  121 + ConnectionEvent(unsigned char connected) : Event(Event::Connection) {
  122 + this->connected = (connected != 0);
  123 +
  124 +#ifdef DEBUG
  125 + std::cerr << "Session is " << this->toString().c_str() << std::endl;
  126 +#endif // DEBUG
  127 +
  128 + }
  129 +
  130 + virtual ~ConnectionEvent() {
  131 + }
  132 +
  133 + /// @brief Get event description.
  134 + std::string toString() const override {
  135 + return this->connected ? "connected" : "disconnected";
  136 + }
  137 +
  138 + };
  139 +
  140 + session->fire(ConnectionEvent(connected));
  141 +
  142 + }
  143 +
  144 +
  145 + }
  146 +
  147 +
... ...
src/lib3270++/local/session.cc 0 → 100644
... ... @@ -0,0 +1,191 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como lib3270++.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +/**
  31 + * @file src/lib3270++/local/session.cc
  32 + *
  33 + * @brief Implement lib3270 direct access layout (NO IPC).
  34 + *
  35 + * @author perry.werneck@gmail.com
  36 + *
  37 + */
  38 +
  39 + #include "../private.h"
  40 +
  41 + extern "C" {
  42 + #include <lib3270/actions.h>
  43 + #include <lib3270/session.h>
  44 + }
  45 +
  46 + using std::string;
  47 +
  48 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  49 +
  50 + namespace TN3270 {
  51 +
  52 + Local::Session::Session() : Abstract::Session() {
  53 +
  54 + std::lock_guard<std::mutex> lock(sync);
  55 +
  56 + this->hSession = lib3270_session_new("");
  57 + lib3270_set_user_data(this->hSession,(void *) this);
  58 + setCharSet(lib3270_get_display_charset(this->hSession));
  59 +
  60 + lib3270_set_popup_handler(this->hSession, popupHandler);
  61 +
  62 + // Setup callbacks
  63 + struct lib3270_session_callbacks *cbk;
  64 +
  65 + cbk = lib3270_get_session_callbacks(this->hSession,sizeof(struct lib3270_session_callbacks));
  66 + if(!cbk) {
  67 + throw std::runtime_error( "Invalid callback table, possible version mismatch in lib3270" );
  68 + }
  69 +
  70 + cbk->update_connect = connectHandler;
  71 +
  72 +
  73 + }
  74 +
  75 + Local::Session::~Session() {
  76 +
  77 + std::lock_guard<std::mutex> lock(sync);
  78 +
  79 + lib3270_session_free(this->hSession);
  80 + this->hSession = nullptr;
  81 + }
  82 +
  83 + void Local::Session::wait(time_t timeout) {
  84 +
  85 + int rc = lib3270_wait_for_ready(this->hSession, timeout);
  86 +
  87 + if(rc) {
  88 + throw std::system_error(rc, std::system_category());
  89 + }
  90 +
  91 + }
  92 +
  93 + void Local::Session::connect(const char *url) {
  94 + std::lock_guard<std::mutex> lock(sync);
  95 + int rc = lib3270_connect_url(hSession,url,0);
  96 +
  97 + if(rc) {
  98 + throw std::system_error(rc, std::system_category());
  99 + }
  100 +
  101 + wait();
  102 +
  103 + }
  104 +
  105 + void Local::Session::disconnect() {
  106 + std::lock_guard<std::mutex> lock(sync);
  107 + lib3270_disconnect(hSession);
  108 + }
  109 +
  110 + // Wait for session state.
  111 + void Local::Session::waitForReady(time_t timeout) throw() {
  112 +
  113 + std::lock_guard<std::mutex> lock(sync);
  114 + wait(timeout);
  115 +
  116 + }
  117 +
  118 + // Gets
  119 + std::string Local::Session::toString() const {
  120 + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync);
  121 + }
  122 +
  123 + std::string Local::Session::toString(int baddr, size_t len, bool lf) {
  124 + std::lock_guard<std::mutex> lock(sync);
  125 + }
  126 +
  127 + std::string Local::Session::toString(int row, int col, size_t sz, bool lf) {
  128 + std::lock_guard<std::mutex> lock(sync);
  129 + }
  130 +
  131 + ProgramMessage Local::Session::getProgramMessage() const {
  132 + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync);
  133 + return (ProgramMessage) lib3270_get_program_message(this->hSession);
  134 + }
  135 +
  136 + ConnectionState Local::Session::getConnectionState() const {
  137 + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync);
  138 + return (ConnectionState) lib3270_get_connection_state(this->hSession);
  139 + }
  140 +
  141 + /// @brief Set field at current posicion, jumps to next writable field.
  142 + TN3270::Session & Local::Session::push(const char *text) {
  143 + std::lock_guard<std::mutex> lock(sync);
  144 + return *this;
  145 + }
  146 +
  147 + TN3270::Session & Local::Session::push(int baddr, const std::string &text) {
  148 + std::lock_guard<std::mutex> lock(sync);
  149 + return *this;
  150 + }
  151 +
  152 + TN3270::Session & Local::Session::push(int row, int col, const std::string &text) {
  153 + std::lock_guard<std::mutex> lock(sync);
  154 + return *this;
  155 + }
  156 +
  157 + TN3270::Session & Local::Session::push(const PFKey key) {
  158 + std::lock_guard<std::mutex> lock(sync);
  159 + lib3270_pfkey(hSession,(int) key);
  160 + return *this;
  161 + }
  162 +
  163 + TN3270::Session & Local::Session::push(const PAKey key) {
  164 + std::lock_guard<std::mutex> lock(sync);
  165 + lib3270_pakey(hSession,(int) key);
  166 + return *this;
  167 + }
  168 +
  169 + TN3270::Session & Local::Session::push(const Action action) {
  170 + std::lock_guard<std::mutex> lock(sync);
  171 + return *this;
  172 + }
  173 +
  174 + TN3270::Session & Local::Session::pop(int baddr, std::string &text) {
  175 + std::lock_guard<std::mutex> lock(sync);
  176 + return *this;
  177 + }
  178 +
  179 + TN3270::Session & Local::Session::pop(int row, int col, std::string &text) {
  180 + std::lock_guard<std::mutex> lock(sync);
  181 + return *this;
  182 + }
  183 +
  184 + TN3270::Session & Local::Session::pop(std::string &text) {
  185 + std::lock_guard<std::mutex> lock(sync);
  186 + return *this;
  187 + }
  188 +
  189 + }
  190 +
  191 +
... ...
src/lib3270++/private.h
... ... @@ -100,56 +100,64 @@
100 100  
101 101 }
102 102  
103   - class TN3270_PRIVATE LocalSession : public Abstract::Session {
104   - private:
  103 + /// @brief lib3270 direct access objects (no IPC);
  104 + namespace Local {
105 105  
106   - /// @brief Handle of the related instance of lib3270
107   - H3270 * hSession;
  106 + class TN3270_PRIVATE Session : public TN3270::Abstract::Session {
  107 + private:
  108 +
  109 + /// @brief Handle of the related instance of lib3270
  110 + H3270 * hSession;
  111 +
  112 + /// @brief Mutex to serialize access to lib3270
  113 + std::mutex sync;
  114 +
  115 + /// @brief Popup Handler.
  116 + static int popupHandler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg);
108 117  
109   - /// @brief Mutex to serialize access to lib3270
110   - std::mutex sync;
  118 + /// @brief Connect Handler.
  119 + static void connectHandler(H3270 *session, unsigned char connected);
111 120  
112   - /// @brief Popup Handler.
113   - static int popupHandler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg);
  121 + /// @brief Wait for network events
  122 + void wait(time_t timeout = 5);
114 123  
115   - /// @brief Wait for network events
116   - void wait(time_t timeout = 5);
  124 + public:
  125 + Session();
  126 + virtual ~Session();
117 127  
118   - public:
119   - LocalSession();
120   - virtual ~LocalSession();
  128 + // Connect/disconnect
  129 + void connect(const char *url) override;
  130 + void disconnect() override;
121 131  
122   - // Connect/disconnect
123   - void connect(const char *url) override;
124   - void disconnect() override;
  132 + // Wait for session state.
  133 + void waitForReady(time_t timeout = 5) throw() override;
125 134  
126   - // Wait for session state.
127   - void waitForReady(time_t timeout = 5) throw() override;
  135 + // Gets
  136 + std::string toString() const override;
  137 + std::string toString(int baddr = 0, size_t len = -1, bool lf = false) override;
  138 + std::string toString(int row, int col, size_t sz, bool lf = false) override;
128 139  
129   - // Gets
130   - std::string toString() const override;
131   - std::string toString(int baddr = 0, size_t len = -1, bool lf = false) override;
132   - std::string toString(int row, int col, size_t sz, bool lf = false) override;
  140 + ProgramMessage getProgramMessage() const override;
133 141  
134   - ProgramMessage getProgramMessage() const override;
  142 + ConnectionState getConnectionState() const override;
135 143  
136   - ConnectionState getConnectionState() const override;
  144 + /// @brief Set field at current posicion, jumps to next writable field.
  145 + TN3270::Session & push(const char *text) override;
137 146  
138   - /// @brief Set field at current posicion, jumps to next writable field.
139   - TN3270::Session & push(const char *text) override;
  147 + TN3270::Session & push(int baddr, const std::string &text) override;
  148 + TN3270::Session & push(int row, int col, const std::string &text) override;
  149 + TN3270::Session & push(const PFKey key) override;
  150 + TN3270::Session & push(const PAKey key) override;
  151 + TN3270::Session & push(const Action action) override;
140 152  
141   - TN3270::Session & push(int baddr, const std::string &text) override;
142   - TN3270::Session & push(int row, int col, const std::string &text) override;
143   - TN3270::Session & push(const PFKey key) override;
144   - TN3270::Session & push(const PAKey key) override;
145   - TN3270::Session & push(const Action action) override;
  153 + // Get contents.
  154 + TN3270::Session & pop(int baddr, std::string &text) override;
  155 + TN3270::Session & pop(int row, int col, std::string &text) override;
  156 + TN3270::Session & pop(std::string &text) override;
146 157  
147   - // Get contents.
148   - TN3270::Session & pop(int baddr, std::string &text) override;
149   - TN3270::Session & pop(int row, int col, std::string &text) override;
150   - TN3270::Session & pop(std::string &text) override;
  158 + };
151 159  
152   - };
  160 + }
153 161  
154 162 }
155 163  
... ...
src/lib3270++/session.cc
... ... @@ -47,7 +47,7 @@
47 47 Session * Session::create(const char *id) {
48 48  
49 49 if(!id) {
50   - return new LocalSession();
  50 + return new Local::Session();
51 51 }
52 52  
53 53 throw std::system_error(EINVAL, std::system_category());
... ...