Commit e886a427b026b69163a9adde845ababc0e82faa3
1 parent
91a350ba
Exists in
master
and in
1 other branch
Refactoring C++ objects based on needings of python extension module.
Showing
13 changed files
with
786 additions
and
651 deletions
Show diff stats
client/ipcclient.cbp
| ... | ... | @@ -42,10 +42,10 @@ |
| 42 | 42 | </Linker> |
| 43 | 43 | <Unit filename="../include/config.h.in" /> |
| 44 | 44 | <Unit filename="src/core/abstract.cc" /> |
| 45 | + <Unit filename="src/core/attribute.cc" /> | |
| 45 | 46 | <Unit filename="src/core/constants.cc" /> |
| 46 | 47 | <Unit filename="src/core/events.cc" /> |
| 47 | 48 | <Unit filename="src/core/linux/request.cc" /> |
| 48 | - <Unit filename="src/core/property.cc" /> | |
| 49 | 49 | <Unit filename="src/core/session.cc" /> |
| 50 | 50 | <Unit filename="src/core/windows/pop.cc" /> |
| 51 | 51 | <Unit filename="src/core/windows/push.cc" /> |
| ... | ... | @@ -66,11 +66,11 @@ |
| 66 | 66 | <Unit filename="src/include/lib3270/ipc/request.h" /> |
| 67 | 67 | <Unit filename="src/session/get.cc" /> |
| 68 | 68 | <Unit filename="src/session/local/actions.cc" /> |
| 69 | + <Unit filename="src/session/local/attribute.cc" /> | |
| 69 | 70 | <Unit filename="src/session/local/events.cc" /> |
| 70 | 71 | <Unit filename="src/session/local/get.cc" /> |
| 71 | 72 | <Unit filename="src/session/local/init.cc" /> |
| 72 | 73 | <Unit filename="src/session/local/private.h" /> |
| 73 | - <Unit filename="src/session/local/properties.cc" /> | |
| 74 | 74 | <Unit filename="src/session/local/set.cc" /> |
| 75 | 75 | <Unit filename="src/session/local/wait.cc" /> |
| 76 | 76 | <Unit filename="src/session/remote/actions.cc" /> | ... | ... |
| ... | ... | @@ -0,0 +1,234 @@ |
| 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 - 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/core/attribute.cc | |
| 32 | + * | |
| 33 | + * @brief Implements type independent property object. | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include <ipc-client-internals.h> | |
| 40 | + #include <string> | |
| 41 | + #include <cstring> | |
| 42 | + #include <stdexcept> | |
| 43 | + | |
| 44 | + using std::runtime_error; | |
| 45 | + | |
| 46 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 47 | + | |
| 48 | + namespace TN3270 { | |
| 49 | + | |
| 50 | + Attribute::~Attribute() { | |
| 51 | + } | |
| 52 | + | |
| 53 | + std::string Attribute::getString() const { | |
| 54 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 55 | + } | |
| 56 | + | |
| 57 | + int32_t Attribute::getInt32() const { | |
| 58 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 59 | + } | |
| 60 | + | |
| 61 | + uint32_t Attribute::getUint32() const { | |
| 62 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 63 | + } | |
| 64 | + | |
| 65 | + bool Attribute::getBool() const { | |
| 66 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 67 | + } | |
| 68 | + | |
| 69 | + | |
| 70 | + /* | |
| 71 | + class StringProperty : public Property, std::string { | |
| 72 | + public: | |
| 73 | + StringProperty(const char *str) : Property(Property::String), std::string(str) { | |
| 74 | + } | |
| 75 | + | |
| 76 | + StringProperty(const std::string &str) : Property(Property::String), std::string(str) { | |
| 77 | + } | |
| 78 | + | |
| 79 | + std::string toString() const override { | |
| 80 | + return std::string(this->c_str()); | |
| 81 | + } | |
| 82 | + | |
| 83 | + int32_t toInt32() const override { | |
| 84 | + return (int32_t) atoi(this->c_str()); | |
| 85 | + } | |
| 86 | + | |
| 87 | + uint32_t toUint32() const override { | |
| 88 | + return (uint32_t) atoi(this->c_str()); | |
| 89 | + } | |
| 90 | + | |
| 91 | + bool toBool() const override { | |
| 92 | + return atoi(this->c_str()) != 0; | |
| 93 | + } | |
| 94 | + | |
| 95 | + }; | |
| 96 | + | |
| 97 | + Property::Property(Property::Type type) { | |
| 98 | + this->type = type; | |
| 99 | + | |
| 100 | + } | |
| 101 | + | |
| 102 | + Property::~Property() { | |
| 103 | + } | |
| 104 | + | |
| 105 | + std::string Property::toString() const { | |
| 106 | + throw runtime_error("The value can't be converted to string"); | |
| 107 | + } | |
| 108 | + | |
| 109 | + int32_t Property::toInt32() const { | |
| 110 | + throw runtime_error("The value can't be converted to a signed integer"); | |
| 111 | + } | |
| 112 | + | |
| 113 | + uint32_t Property::toUint32() const { | |
| 114 | + throw runtime_error("The value can't be converted to an unsigned integer"); | |
| 115 | + } | |
| 116 | + | |
| 117 | + bool Property::toBool() const { | |
| 118 | + throw runtime_error("The value can't be converted to boolean"); | |
| 119 | + } | |
| 120 | + | |
| 121 | + | |
| 122 | + Property * Property::create(const char *str) { | |
| 123 | + return new StringProperty(str); | |
| 124 | + } | |
| 125 | + | |
| 126 | + Property * Property::create(const std::string &str) { | |
| 127 | + return new StringProperty(str); | |
| 128 | + } | |
| 129 | + | |
| 130 | + Property * Property::create(const int value) { | |
| 131 | + | |
| 132 | + class Value : public Property { | |
| 133 | + private: | |
| 134 | + int32_t value; | |
| 135 | + | |
| 136 | + public: | |
| 137 | + Value(int value) : Property(Property::Int32) { | |
| 138 | + this->value = (int32_t) value; | |
| 139 | + } | |
| 140 | + | |
| 141 | + std::string toString() const override { | |
| 142 | + return std::to_string(value); | |
| 143 | + } | |
| 144 | + | |
| 145 | + int32_t toInt32() const override { | |
| 146 | + return (int32_t) value; | |
| 147 | + } | |
| 148 | + | |
| 149 | + uint32_t toUint32() const override { | |
| 150 | + return (uint32_t) value; | |
| 151 | + } | |
| 152 | + | |
| 153 | + bool toBool() const override { | |
| 154 | + return value != 0; | |
| 155 | + } | |
| 156 | + | |
| 157 | + }; | |
| 158 | + | |
| 159 | + return new Value(value); | |
| 160 | + | |
| 161 | + } | |
| 162 | + | |
| 163 | + Property * Property::create(const unsigned int value) { | |
| 164 | + | |
| 165 | + class Value : public Property { | |
| 166 | + private: | |
| 167 | + uint32_t value; | |
| 168 | + | |
| 169 | + public: | |
| 170 | + Value(unsigned int value) : Property(Property::Uint32) { | |
| 171 | + this->value = (uint32_t) value; | |
| 172 | + } | |
| 173 | + | |
| 174 | + std::string toString() const override { | |
| 175 | + return std::to_string(value); | |
| 176 | + } | |
| 177 | + | |
| 178 | + int32_t toInt32() const override { | |
| 179 | + return (int32_t) value; | |
| 180 | + } | |
| 181 | + | |
| 182 | + uint32_t toUint32() const override { | |
| 183 | + return (uint32_t) value; | |
| 184 | + } | |
| 185 | + | |
| 186 | + bool toBool() const override { | |
| 187 | + return value != 0; | |
| 188 | + } | |
| 189 | + | |
| 190 | + }; | |
| 191 | + | |
| 192 | + return new Value(value); | |
| 193 | + | |
| 194 | + } | |
| 195 | + | |
| 196 | + Property * Property::create(const bool value) { | |
| 197 | + | |
| 198 | + class Value : public Property { | |
| 199 | + private: | |
| 200 | + bool value; | |
| 201 | + | |
| 202 | + public: | |
| 203 | + Value(bool value) : Property(Property::Boolean) { | |
| 204 | + this->value = value; | |
| 205 | + } | |
| 206 | + | |
| 207 | + std::string toString() const override { | |
| 208 | + return std::to_string(value); | |
| 209 | + } | |
| 210 | + | |
| 211 | + int32_t toInt32() const override { | |
| 212 | + return (int32_t) value; | |
| 213 | + } | |
| 214 | + | |
| 215 | + uint32_t toUint32() const override { | |
| 216 | + return (uint32_t) value; | |
| 217 | + } | |
| 218 | + | |
| 219 | + bool toBool() const override { | |
| 220 | + return value; | |
| 221 | + } | |
| 222 | + | |
| 223 | + }; | |
| 224 | + | |
| 225 | + return new Value(value); | |
| 226 | + | |
| 227 | + } | |
| 228 | + */ | |
| 229 | + | |
| 230 | + | |
| 231 | + } | |
| 232 | + | |
| 233 | + | |
| 234 | + | ... | ... |
client/src/core/property.cc
| ... | ... | @@ -1,212 +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 - 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/core/property.cc | |
| 32 | - * | |
| 33 | - * @brief Implements type independent property object. | |
| 34 | - * | |
| 35 | - * @author perry.werneck@gmail.com | |
| 36 | - * | |
| 37 | - */ | |
| 38 | - | |
| 39 | - #include <ipc-client-internals.h> | |
| 40 | - #include <string> | |
| 41 | - #include <cstring> | |
| 42 | - #include <stdexcept> | |
| 43 | - | |
| 44 | - using std::runtime_error; | |
| 45 | - | |
| 46 | -/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 47 | - | |
| 48 | - namespace TN3270 { | |
| 49 | - | |
| 50 | - class StringProperty : public Property, std::string { | |
| 51 | - public: | |
| 52 | - StringProperty(const char *str) : Property(Property::String), std::string(str) { | |
| 53 | - } | |
| 54 | - | |
| 55 | - StringProperty(const std::string &str) : Property(Property::String), std::string(str) { | |
| 56 | - } | |
| 57 | - | |
| 58 | - std::string toString() const override { | |
| 59 | - return std::string(this->c_str()); | |
| 60 | - } | |
| 61 | - | |
| 62 | - int32_t toInt32() const override { | |
| 63 | - return (int32_t) atoi(this->c_str()); | |
| 64 | - } | |
| 65 | - | |
| 66 | - uint32_t toUint32() const override { | |
| 67 | - return (uint32_t) atoi(this->c_str()); | |
| 68 | - } | |
| 69 | - | |
| 70 | - bool toBool() const override { | |
| 71 | - return atoi(this->c_str()) != 0; | |
| 72 | - } | |
| 73 | - | |
| 74 | - }; | |
| 75 | - | |
| 76 | - Property::Property(Property::Type type) { | |
| 77 | - this->type = type; | |
| 78 | - | |
| 79 | - } | |
| 80 | - | |
| 81 | - Property::~Property() { | |
| 82 | - } | |
| 83 | - | |
| 84 | - std::string Property::toString() const { | |
| 85 | - throw runtime_error("The value can't be converted to string"); | |
| 86 | - } | |
| 87 | - | |
| 88 | - int32_t Property::toInt32() const { | |
| 89 | - throw runtime_error("The value can't be converted to a signed integer"); | |
| 90 | - } | |
| 91 | - | |
| 92 | - uint32_t Property::toUint32() const { | |
| 93 | - throw runtime_error("The value can't be converted to an unsigned integer"); | |
| 94 | - } | |
| 95 | - | |
| 96 | - bool Property::toBool() const { | |
| 97 | - throw runtime_error("The value can't be converted to boolean"); | |
| 98 | - } | |
| 99 | - | |
| 100 | - | |
| 101 | - Property * Property::create(const char *str) { | |
| 102 | - return new StringProperty(str); | |
| 103 | - } | |
| 104 | - | |
| 105 | - Property * Property::create(const std::string &str) { | |
| 106 | - return new StringProperty(str); | |
| 107 | - } | |
| 108 | - | |
| 109 | - Property * Property::create(const int value) { | |
| 110 | - | |
| 111 | - class Value : public Property { | |
| 112 | - private: | |
| 113 | - int32_t value; | |
| 114 | - | |
| 115 | - public: | |
| 116 | - Value(int value) : Property(Property::Int32) { | |
| 117 | - this->value = (int32_t) value; | |
| 118 | - } | |
| 119 | - | |
| 120 | - std::string toString() const override { | |
| 121 | - return std::to_string(value); | |
| 122 | - } | |
| 123 | - | |
| 124 | - int32_t toInt32() const override { | |
| 125 | - return (int32_t) value; | |
| 126 | - } | |
| 127 | - | |
| 128 | - uint32_t toUint32() const override { | |
| 129 | - return (uint32_t) value; | |
| 130 | - } | |
| 131 | - | |
| 132 | - bool toBool() const override { | |
| 133 | - return value != 0; | |
| 134 | - } | |
| 135 | - | |
| 136 | - }; | |
| 137 | - | |
| 138 | - return new Value(value); | |
| 139 | - | |
| 140 | - } | |
| 141 | - | |
| 142 | - Property * Property::create(const unsigned int value) { | |
| 143 | - | |
| 144 | - class Value : public Property { | |
| 145 | - private: | |
| 146 | - uint32_t value; | |
| 147 | - | |
| 148 | - public: | |
| 149 | - Value(unsigned int value) : Property(Property::Uint32) { | |
| 150 | - this->value = (uint32_t) value; | |
| 151 | - } | |
| 152 | - | |
| 153 | - std::string toString() const override { | |
| 154 | - return std::to_string(value); | |
| 155 | - } | |
| 156 | - | |
| 157 | - int32_t toInt32() const override { | |
| 158 | - return (int32_t) value; | |
| 159 | - } | |
| 160 | - | |
| 161 | - uint32_t toUint32() const override { | |
| 162 | - return (uint32_t) value; | |
| 163 | - } | |
| 164 | - | |
| 165 | - bool toBool() const override { | |
| 166 | - return value != 0; | |
| 167 | - } | |
| 168 | - | |
| 169 | - }; | |
| 170 | - | |
| 171 | - return new Value(value); | |
| 172 | - | |
| 173 | - } | |
| 174 | - | |
| 175 | - Property * Property::create(const bool value) { | |
| 176 | - | |
| 177 | - class Value : public Property { | |
| 178 | - private: | |
| 179 | - bool value; | |
| 180 | - | |
| 181 | - public: | |
| 182 | - Value(bool value) : Property(Property::Boolean) { | |
| 183 | - this->value = value; | |
| 184 | - } | |
| 185 | - | |
| 186 | - std::string toString() const override { | |
| 187 | - return std::to_string(value); | |
| 188 | - } | |
| 189 | - | |
| 190 | - int32_t toInt32() const override { | |
| 191 | - return (int32_t) value; | |
| 192 | - } | |
| 193 | - | |
| 194 | - uint32_t toUint32() const override { | |
| 195 | - return (uint32_t) value; | |
| 196 | - } | |
| 197 | - | |
| 198 | - bool toBool() const override { | |
| 199 | - return value; | |
| 200 | - } | |
| 201 | - | |
| 202 | - }; | |
| 203 | - | |
| 204 | - return new Value(value); | |
| 205 | - | |
| 206 | - } | |
| 207 | - | |
| 208 | - | |
| 209 | - } | |
| 210 | - | |
| 211 | - | |
| 212 | - |
client/src/core/session.cc
| ... | ... | @@ -401,10 +401,95 @@ |
| 401 | 401 | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - Property * Session::getProperty(const char *name) const { | |
| 404 | + void Session::setAttribute(const char *name, const int value) { | |
| 405 | 405 | throw std::system_error(ENOTSUP, std::system_category()); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | + void Session::setAttribute(const char *name, const char *value) { | |
| 409 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 410 | + } | |
| 411 | + | |
| 412 | + Attribute * Session::getAttribute(const char *name) const { | |
| 413 | + throw std::system_error(ENOTSUP, std::system_category()); | |
| 414 | + } | |
| 415 | + | |
| 416 | + void Session::getAttribute(const char *name, int &value) const { | |
| 417 | + | |
| 418 | + Attribute *attr = getAttribute(name); | |
| 419 | + | |
| 420 | + try { | |
| 421 | + | |
| 422 | + value = attr->getInt32(); | |
| 423 | + | |
| 424 | + } catch(...) { | |
| 425 | + | |
| 426 | + delete attr; | |
| 427 | + throw; | |
| 428 | + | |
| 429 | + } | |
| 430 | + | |
| 431 | + delete attr; | |
| 432 | + | |
| 433 | + } | |
| 434 | + | |
| 435 | + void Session::getAttribute(const char *name, unsigned int &value) const { | |
| 436 | + | |
| 437 | + Attribute *attr = getAttribute(name); | |
| 438 | + | |
| 439 | + try { | |
| 440 | + | |
| 441 | + value = attr->getUint32(); | |
| 442 | + | |
| 443 | + } catch(...) { | |
| 444 | + | |
| 445 | + delete attr; | |
| 446 | + throw; | |
| 447 | + | |
| 448 | + } | |
| 449 | + | |
| 450 | + delete attr; | |
| 451 | + | |
| 452 | + } | |
| 453 | + | |
| 454 | + void Session::getAttribute(const char *name, std::string &value) const { | |
| 455 | + | |
| 456 | + Attribute *attr = getAttribute(name); | |
| 457 | + | |
| 458 | + try { | |
| 459 | + | |
| 460 | + value.assign(attr->getString().c_str()); | |
| 461 | + | |
| 462 | + } catch(...) { | |
| 463 | + | |
| 464 | + delete attr; | |
| 465 | + throw; | |
| 466 | + | |
| 467 | + } | |
| 468 | + | |
| 469 | + delete attr; | |
| 470 | + | |
| 471 | + } | |
| 472 | + | |
| 473 | + void Session::getAttribute(const char *name, bool &value) const { | |
| 474 | + | |
| 475 | + Attribute *attr = getAttribute(name); | |
| 476 | + | |
| 477 | + try { | |
| 478 | + | |
| 479 | + value = attr->getBool(); | |
| 480 | + | |
| 481 | + } catch(...) { | |
| 482 | + | |
| 483 | + delete attr; | |
| 484 | + throw; | |
| 485 | + | |
| 486 | + } | |
| 487 | + | |
| 488 | + delete attr; | |
| 489 | + | |
| 490 | + } | |
| 491 | + | |
| 492 | + | |
| 408 | 493 | } |
| 409 | 494 | |
| 410 | 495 | ... | ... |
client/src/host/properties.cc
| ... | ... | @@ -40,11 +40,11 @@ |
| 40 | 40 | |
| 41 | 41 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 42 | 42 | |
| 43 | -TN3270::Property * TN3270::Host::getProperty(const char *name) const { | |
| 43 | +TN3270::Attribute * TN3270::Host::getAttribute(const char *name) const { | |
| 44 | 44 | |
| 45 | 45 | if(!this->session) |
| 46 | 46 | throw std::system_error(ENODATA, std::system_category()); |
| 47 | 47 | |
| 48 | - return this->session->getProperty(name); | |
| 48 | + return this->session->getAttribute(name); | |
| 49 | 49 | |
| 50 | 50 | } | ... | ... |
client/src/include/lib3270/ipc.h
| ... | ... | @@ -242,7 +242,7 @@ |
| 242 | 242 | }; |
| 243 | 243 | |
| 244 | 244 | /// @brief Dynamic Data type |
| 245 | - class TN3270_PUBLIC Property { | |
| 245 | + class TN3270_PUBLIC Attribute { | |
| 246 | 246 | public: |
| 247 | 247 | |
| 248 | 248 | /// @brief IPC Data type. |
| ... | ... | @@ -263,19 +263,23 @@ |
| 263 | 263 | Type type; |
| 264 | 264 | |
| 265 | 265 | protected: |
| 266 | - Property(Type type); | |
| 266 | + Attribute(Type type) { | |
| 267 | + this->type = type; | |
| 268 | + } | |
| 267 | 269 | |
| 268 | 270 | public: |
| 271 | + | |
| 272 | + virtual std::string getString() const; | |
| 273 | + virtual int32_t getInt32() const; | |
| 274 | + virtual uint32_t getUint32() const; | |
| 275 | + virtual bool getBool() const; | |
| 276 | + | |
| 277 | + virtual ~Attribute(); | |
| 278 | + | |
| 269 | 279 | inline bool operator==(Type type) const noexcept { |
| 270 | 280 | return this->type == type; |
| 271 | 281 | } |
| 272 | 282 | |
| 273 | - static Property * create(const char *str); | |
| 274 | - static Property * create(const std::string &str); | |
| 275 | - static Property * create(const int value); | |
| 276 | - static Property * create(const unsigned int value); | |
| 277 | - static Property * create(const bool value); | |
| 278 | - | |
| 279 | 283 | inline Type getType() const { |
| 280 | 284 | return this->type; |
| 281 | 285 | } |
| ... | ... | @@ -284,12 +288,6 @@ |
| 284 | 288 | return this->type; |
| 285 | 289 | } |
| 286 | 290 | |
| 287 | - virtual std::string toString() const; | |
| 288 | - virtual int32_t toInt32() const; | |
| 289 | - virtual uint32_t toUint32() const; | |
| 290 | - virtual bool toBool() const; | |
| 291 | - | |
| 292 | - virtual ~Property(); | |
| 293 | 291 | |
| 294 | 292 | }; |
| 295 | 293 | |
| ... | ... | @@ -402,14 +400,16 @@ |
| 402 | 400 | /// |
| 403 | 401 | LIB3270_KEYBOARD_LOCK_STATE input(const std::string &str, const char control_char = '@'); |
| 404 | 402 | |
| 405 | - // Properties. | |
| 406 | - virtual Property * getProperty(const char *name) const; | |
| 407 | - virtual void getProperty(const char *name, int &value) const = 0; | |
| 408 | - virtual void getProperty(const char *name, unsigned int &value) const = 0; | |
| 409 | - virtual void getProperty(const char *name, std::string &value) const = 0; | |
| 410 | - virtual void getProperty(const char *name, bool &value) const = 0; | |
| 411 | - virtual void setProperty(const char *name, const int value) = 0; | |
| 412 | - virtual void setProperty(const char *name, const char *value) = 0; | |
| 403 | + // Attributes | |
| 404 | + virtual Attribute * getAttribute(const char *name) const; | |
| 405 | + | |
| 406 | + virtual void getAttribute(const char *name, int &value) const; | |
| 407 | + virtual void getAttribute(const char *name, unsigned int &value) const; | |
| 408 | + virtual void getAttribute(const char *name, std::string &value) const; | |
| 409 | + virtual void getAttribute(const char *name, bool &value) const; | |
| 410 | + | |
| 411 | + virtual void setAttribute(const char *name, const int value); | |
| 412 | + virtual void setAttribute(const char *name, const char *value); | |
| 413 | 413 | |
| 414 | 414 | /// @brief Get the lib3270 version string. |
| 415 | 415 | virtual std::string getVersion() const = 0; |
| ... | ... | @@ -635,10 +635,10 @@ |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | // Get properties |
| 638 | - Property * getProperty(const char *name) const; | |
| 638 | + Attribute * getAttribute(const char *name) const; | |
| 639 | 639 | |
| 640 | - inline Property * operator[](const char *name) const { | |
| 641 | - return getProperty(name); | |
| 640 | + inline Attribute * operator[](const char *name) const { | |
| 641 | + return getAttribute(name); | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | /// @brief Get lib3270 version. | ... | ... |
| ... | ... | @@ -0,0 +1,405 @@ |
| 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 - 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 | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include "private.h" | |
| 40 | + #include <lib3270/ipc.h> | |
| 41 | + #include <lib3270/properties.h> | |
| 42 | + #include <lib3270/toggle.h> | |
| 43 | + #include <cstring> | |
| 44 | + | |
| 45 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 46 | + | |
| 47 | + namespace TN3270 { | |
| 48 | + | |
| 49 | + Attribute * Local::Session::getAttribute(const char *name) const { | |
| 50 | + | |
| 51 | + // Signed int attribute | |
| 52 | + class IntAttribute : public Attribute { | |
| 53 | + private: | |
| 54 | + H3270 * hSession; | |
| 55 | + const LIB3270_INT_PROPERTY * descriptor; | |
| 56 | + | |
| 57 | + public: | |
| 58 | + IntAttribute(H3270 *hSession, const LIB3270_INT_PROPERTY *descriptor) : Attribute(Attribute::Int32) { | |
| 59 | + this->hSession = hSession; | |
| 60 | + this->descriptor = descriptor; | |
| 61 | + } | |
| 62 | + | |
| 63 | + std::string getString() const override { | |
| 64 | + return std::to_string(getInt32()); | |
| 65 | + } | |
| 66 | + | |
| 67 | + int32_t getInt32() const override { | |
| 68 | + | |
| 69 | + errno = 0; | |
| 70 | + int value = descriptor->get(hSession); | |
| 71 | + | |
| 72 | + if(errno != 0) { | |
| 73 | + throw std::system_error(errno, std::system_category()); | |
| 74 | + } | |
| 75 | + | |
| 76 | + return ((int32_t) value) != 0; | |
| 77 | + | |
| 78 | + } | |
| 79 | + | |
| 80 | + uint32_t getUint32() const override { | |
| 81 | + return (uint32_t) descriptor->get(this->hSession); | |
| 82 | + } | |
| 83 | + | |
| 84 | + bool getBool() const override { | |
| 85 | + return getInt32() != 0; | |
| 86 | + } | |
| 87 | + | |
| 88 | + }; | |
| 89 | + | |
| 90 | + // Unsigned int attribute | |
| 91 | + class UnsignedIntAttribute : public Attribute { | |
| 92 | + private: | |
| 93 | + H3270 * hSession; | |
| 94 | + const LIB3270_UINT_PROPERTY * descriptor; | |
| 95 | + | |
| 96 | + public: | |
| 97 | + UnsignedIntAttribute(H3270 *hSession, const LIB3270_UINT_PROPERTY *descriptor) : Attribute(Attribute::Uint32) { | |
| 98 | + this->hSession = hSession; | |
| 99 | + this->descriptor = descriptor; | |
| 100 | + } | |
| 101 | + | |
| 102 | + std::string getString() const override { | |
| 103 | + return std::to_string(getInt32()); | |
| 104 | + } | |
| 105 | + | |
| 106 | + int32_t getInt32() const override { | |
| 107 | + | |
| 108 | + return (int32_t) getUint32(); | |
| 109 | + } | |
| 110 | + | |
| 111 | + uint32_t getUint32() const override { | |
| 112 | + | |
| 113 | + errno = 0; | |
| 114 | + unsigned int value = descriptor->get(hSession); | |
| 115 | + | |
| 116 | + if(errno != 0) { | |
| 117 | + throw std::system_error(errno, std::system_category()); | |
| 118 | + } | |
| 119 | + | |
| 120 | + return ((uint32_t) value) != 0; | |
| 121 | + } | |
| 122 | + | |
| 123 | + bool getBool() const override { | |
| 124 | + return getUint32() != 0; | |
| 125 | + } | |
| 126 | + | |
| 127 | + }; | |
| 128 | + | |
| 129 | + // String attribute | |
| 130 | + class StringAttribute : public Attribute { | |
| 131 | + private: | |
| 132 | + H3270 * hSession; | |
| 133 | + const LIB3270_STRING_PROPERTY * descriptor; | |
| 134 | + | |
| 135 | + public: | |
| 136 | + StringAttribute(H3270 *hSession, const LIB3270_STRING_PROPERTY *descriptor) : Attribute(Attribute::String) { | |
| 137 | + this->hSession = hSession; | |
| 138 | + this->descriptor = descriptor; | |
| 139 | + } | |
| 140 | + | |
| 141 | + std::string getString() const override { | |
| 142 | + | |
| 143 | + const char * str = descriptor->get(hSession); | |
| 144 | + | |
| 145 | + if(str) { | |
| 146 | + return string(str); | |
| 147 | + } | |
| 148 | + | |
| 149 | + throw std::system_error(errno, std::system_category()); | |
| 150 | + | |
| 151 | + } | |
| 152 | + | |
| 153 | + int32_t getInt32() const override { | |
| 154 | + return (int32_t) atoi(getString().c_str()); | |
| 155 | + } | |
| 156 | + | |
| 157 | + uint32_t getUint32() const override { | |
| 158 | + return (uint32_t) atol(getString().c_str()); | |
| 159 | + } | |
| 160 | + | |
| 161 | + bool getBool() const override { | |
| 162 | + return getUint32() != 0; | |
| 163 | + } | |
| 164 | + | |
| 165 | + }; | |
| 166 | + | |
| 167 | + // Boolean attribute | |
| 168 | + class BooleanAttribute : public Attribute { | |
| 169 | + H3270 * hSession; | |
| 170 | + const LIB3270_INT_PROPERTY * descriptor; | |
| 171 | + | |
| 172 | + public: | |
| 173 | + BooleanAttribute(H3270 *hSession, const LIB3270_INT_PROPERTY *descriptor) : Attribute(Attribute::Boolean) { | |
| 174 | + this->hSession = hSession; | |
| 175 | + this->descriptor = descriptor; | |
| 176 | + } | |
| 177 | + | |
| 178 | + std::string getString() const override { | |
| 179 | + return std::to_string(getInt32()); | |
| 180 | + } | |
| 181 | + | |
| 182 | + int32_t getInt32() const override { | |
| 183 | + | |
| 184 | + errno = 0; | |
| 185 | + int value = descriptor->get(hSession); | |
| 186 | + | |
| 187 | + if(errno != 0) { | |
| 188 | + throw std::system_error(errno, std::system_category()); | |
| 189 | + } | |
| 190 | + | |
| 191 | + return ((int32_t) value) != 0; | |
| 192 | + | |
| 193 | + } | |
| 194 | + | |
| 195 | + uint32_t getUint32() const override { | |
| 196 | + return (uint32_t) descriptor->get(this->hSession); | |
| 197 | + } | |
| 198 | + | |
| 199 | + bool getBool() const override { | |
| 200 | + return getInt32() != 0; | |
| 201 | + } | |
| 202 | + | |
| 203 | + }; | |
| 204 | + | |
| 205 | + // Toogle attribute | |
| 206 | + class ToggleAttribute : public Attribute { | |
| 207 | + H3270 * hSession; | |
| 208 | + LIB3270_TOGGLE toggle; | |
| 209 | + | |
| 210 | + public: | |
| 211 | + ToggleAttribute(H3270 *hSession, const LIB3270_TOGGLE toggle) : Attribute(Attribute::Boolean) { | |
| 212 | + this->hSession = hSession; | |
| 213 | + this->toggle = toggle; | |
| 214 | + } | |
| 215 | + | |
| 216 | + std::string getString() const override { | |
| 217 | + return (lib3270_get_toggle(hSession, toggle) ? "1" : "0"); | |
| 218 | + } | |
| 219 | + | |
| 220 | + int32_t getInt32() const override { | |
| 221 | + return (int32_t) lib3270_get_toggle(hSession, toggle); | |
| 222 | + } | |
| 223 | + | |
| 224 | + uint32_t getUint32() const override { | |
| 225 | + return (uint32_t) lib3270_get_toggle(hSession, toggle); | |
| 226 | + } | |
| 227 | + | |
| 228 | + bool getBool() const override { | |
| 229 | + return (lib3270_get_toggle(hSession, toggle) != 0); | |
| 230 | + } | |
| 231 | + | |
| 232 | + }; | |
| 233 | + | |
| 234 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 235 | + | |
| 236 | + // Check for integer properties. | |
| 237 | + { | |
| 238 | + const LIB3270_INT_PROPERTY * intprop = lib3270_get_int_properties_list(); | |
| 239 | + for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 240 | + | |
| 241 | + if(!strcasecmp(name,intprop[ix].name)) { | |
| 242 | + return new IntAttribute(hSession,&intprop[ix]); | |
| 243 | + } | |
| 244 | + | |
| 245 | + } | |
| 246 | + } | |
| 247 | + | |
| 248 | + // Check for unsigned int properties | |
| 249 | + { | |
| 250 | + const LIB3270_UINT_PROPERTY * intprop = lib3270_get_unsigned_properties_list(); | |
| 251 | + for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 252 | + | |
| 253 | + if(!strcasecmp(name,intprop[ix].name)) { | |
| 254 | + return new UnsignedIntAttribute(hSession,&intprop[ix]); | |
| 255 | + } | |
| 256 | + | |
| 257 | + } | |
| 258 | + | |
| 259 | + } | |
| 260 | + | |
| 261 | + // Check for string properties | |
| 262 | + { | |
| 263 | + const LIB3270_STRING_PROPERTY * strprop = lib3270_get_string_properties_list(); | |
| 264 | + | |
| 265 | + for(size_t ix = 0; strprop[ix].name; ix++) { | |
| 266 | + | |
| 267 | + if(!strcasecmp(name,strprop[ix].name)) { | |
| 268 | + return new StringAttribute(hSession,&strprop[ix]); | |
| 269 | + } | |
| 270 | + | |
| 271 | + } | |
| 272 | + | |
| 273 | + } | |
| 274 | + | |
| 275 | + // Check for boolean properties | |
| 276 | + { | |
| 277 | + LIB3270_TOGGLE toggle = lib3270_get_toggle_id(name); | |
| 278 | + if(toggle != (LIB3270_TOGGLE) -1) { | |
| 279 | + | |
| 280 | + // Is a Tn3270 toggle, get it! | |
| 281 | + return new ToggleAttribute(hSession,toggle); | |
| 282 | + | |
| 283 | + } | |
| 284 | + | |
| 285 | + const LIB3270_INT_PROPERTY * intprop = lib3270_get_boolean_properties_list(); | |
| 286 | + for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 287 | + | |
| 288 | + if(!strcasecmp(name,intprop[ix].name)) { | |
| 289 | + | |
| 290 | + if(!strcasecmp(name,intprop[ix].name)) { | |
| 291 | + return new BooleanAttribute(hSession,&intprop[ix]); | |
| 292 | + } | |
| 293 | + | |
| 294 | + } | |
| 295 | + | |
| 296 | + } | |
| 297 | + | |
| 298 | + } | |
| 299 | + | |
| 300 | + // Not found! | |
| 301 | + throw std::runtime_error("Invalid property"); | |
| 302 | + | |
| 303 | + } | |
| 304 | + | |
| 305 | + void Local::Session::setCharSet(const char *charset) { | |
| 306 | + Abstract::Session::setCharSet(lib3270_get_display_charset(this->hSession),charset); | |
| 307 | + } | |
| 308 | + | |
| 309 | + unsigned short Local::Session::getScreenWidth() const { | |
| 310 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 311 | + return (unsigned short) lib3270_get_width(hSession); | |
| 312 | + } | |
| 313 | + | |
| 314 | + unsigned short Local::Session::getScreenHeight() const { | |
| 315 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 316 | + return (unsigned short) lib3270_get_height(hSession); | |
| 317 | + } | |
| 318 | + | |
| 319 | + unsigned short Local::Session::getScreenLength() const { | |
| 320 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 321 | + return (unsigned short) lib3270_get_length(hSession); | |
| 322 | + } | |
| 323 | + | |
| 324 | + void Local::Session::setUnlockDelay(unsigned short delay) { | |
| 325 | + std::lock_guard<std::mutex> lock(sync); | |
| 326 | + chkResponse(lib3270_set_unlock_delay(hSession,delay)); | |
| 327 | + } | |
| 328 | + | |
| 329 | + void Local::Session::setLockOnOperatorError(bool lock) { | |
| 330 | + std::lock_guard<std::mutex> guard(sync); | |
| 331 | + chkResponse(lib3270_set_lock_on_operator_error(hSession,lock ? 1 : 0)); | |
| 332 | + } | |
| 333 | + | |
| 334 | + unsigned short Local::Session::setCursor(int addr) { | |
| 335 | + std::lock_guard<std::mutex> lock(sync); | |
| 336 | + | |
| 337 | + int rc = lib3270_set_cursor_address(hSession,addr); | |
| 338 | + if(rc < 0) | |
| 339 | + chkResponse(-rc); | |
| 340 | + | |
| 341 | + return (unsigned short) rc; | |
| 342 | + | |
| 343 | + } | |
| 344 | + | |
| 345 | + unsigned short Local::Session::setCursor(unsigned short row, unsigned short col) { | |
| 346 | + std::lock_guard<std::mutex> lock(sync); | |
| 347 | + | |
| 348 | + int rc = lib3270_set_cursor_position(hSession,row,col); | |
| 349 | + if(rc < 0) | |
| 350 | + chkResponse(-rc); | |
| 351 | + | |
| 352 | + return (unsigned short) rc; | |
| 353 | + | |
| 354 | + } | |
| 355 | + | |
| 356 | + unsigned short Local::Session::getCursorAddress() { | |
| 357 | + std::lock_guard<std::mutex> lock(sync); | |
| 358 | + | |
| 359 | + int rc = lib3270_get_cursor_address(hSession); | |
| 360 | + | |
| 361 | + if(!rc) | |
| 362 | + chkResponse(errno); | |
| 363 | + | |
| 364 | + return rc; | |
| 365 | + } | |
| 366 | + | |
| 367 | + std::string Local::Session::getVersion() const { | |
| 368 | + | |
| 369 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 370 | + return lib3270_get_version(); | |
| 371 | + | |
| 372 | + } | |
| 373 | + | |
| 374 | + std::string Local::Session::getRevision() const { | |
| 375 | + | |
| 376 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 377 | + return lib3270_get_revision(); | |
| 378 | + | |
| 379 | + } | |
| 380 | + | |
| 381 | + std::string Local::Session::getLUName() const { | |
| 382 | + | |
| 383 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 384 | + return lib3270_get_luname(hSession); | |
| 385 | + | |
| 386 | + } | |
| 387 | + | |
| 388 | + std::string Local::Session::getHostURL() const { | |
| 389 | + | |
| 390 | + std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 391 | + return lib3270_get_url(hSession); | |
| 392 | + | |
| 393 | + } | |
| 394 | + | |
| 395 | + void Local::Session::setHostURL(const char *url) { | |
| 396 | + | |
| 397 | + std::lock_guard<std::mutex> lock(sync); | |
| 398 | + chkResponse(lib3270_set_url(hSession, url)); | |
| 399 | + | |
| 400 | + } | |
| 401 | + | |
| 402 | + | |
| 403 | + } | |
| 404 | + | |
| 405 | + | ... | ... |
client/src/session/local/private.h
| ... | ... | @@ -112,14 +112,8 @@ |
| 112 | 112 | ConnectionState getConnectionState() const override; |
| 113 | 113 | SSLState getSSLState() const override; |
| 114 | 114 | |
| 115 | - // Properties. | |
| 116 | - Property * getProperty(const char *name) const override; | |
| 117 | - void getProperty(const char *name, int &value) const override; | |
| 118 | - void getProperty(const char *name, unsigned int &value) const override; | |
| 119 | - void getProperty(const char *name, std::string &value) const override; | |
| 120 | - void getProperty(const char *name, bool &value) const override; | |
| 121 | - void setProperty(const char *name, const int value) override; | |
| 122 | - void setProperty(const char *name, const char *value) override; | |
| 115 | + // Attributes | |
| 116 | + Attribute * getAttribute(const char *name) const override; | |
| 123 | 117 | |
| 124 | 118 | std::string getVersion() const override; |
| 125 | 119 | std::string getRevision() const override; | ... | ... |
client/src/session/local/properties.cc
| ... | ... | @@ -1,354 +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 - 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 | |
| 32 | - * | |
| 33 | - * @brief | |
| 34 | - * | |
| 35 | - * @author perry.werneck@gmail.com | |
| 36 | - * | |
| 37 | - */ | |
| 38 | - | |
| 39 | - #include "private.h" | |
| 40 | - #include <lib3270/ipc.h> | |
| 41 | - #include <lib3270/properties.h> | |
| 42 | - #include <lib3270/toggle.h> | |
| 43 | - #include <cstring> | |
| 44 | - | |
| 45 | -/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 46 | - | |
| 47 | - namespace TN3270 { | |
| 48 | - | |
| 49 | - Property * Local::Session::getProperty(const char *name) const { | |
| 50 | - | |
| 51 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 52 | - | |
| 53 | - // Check for integer properties. | |
| 54 | - { | |
| 55 | - const LIB3270_INT_PROPERTY * intprop = lib3270_get_int_properties_list(); | |
| 56 | - for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 57 | - | |
| 58 | - if(!strcasecmp(name,intprop[ix].name)) { | |
| 59 | - | |
| 60 | - errno = 0; | |
| 61 | - int value = intprop[ix].get(hSession); | |
| 62 | - | |
| 63 | - if(errno != 0) { | |
| 64 | - throw std::system_error(errno, std::system_category()); | |
| 65 | - } | |
| 66 | - | |
| 67 | - return TN3270::Property::create(value); | |
| 68 | - | |
| 69 | - } | |
| 70 | - | |
| 71 | - } | |
| 72 | - } | |
| 73 | - | |
| 74 | - // Check for unsigned int properties | |
| 75 | - { | |
| 76 | - const LIB3270_UINT_PROPERTY * intprop = lib3270_get_unsigned_properties_list(); | |
| 77 | - for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 78 | - | |
| 79 | - if(!strcasecmp(name,intprop[ix].name)) { | |
| 80 | - | |
| 81 | - errno = 0; | |
| 82 | - unsigned int value = intprop[ix].get(hSession); | |
| 83 | - | |
| 84 | - if(errno != 0) { | |
| 85 | - throw std::system_error(errno, std::system_category()); | |
| 86 | - } | |
| 87 | - | |
| 88 | - return Property::create(value); | |
| 89 | - | |
| 90 | - } | |
| 91 | - | |
| 92 | - } | |
| 93 | - | |
| 94 | - } | |
| 95 | - | |
| 96 | - // Check for string properties | |
| 97 | - { | |
| 98 | - const LIB3270_STRING_PROPERTY * strprop = lib3270_get_string_properties_list(); | |
| 99 | - | |
| 100 | - for(size_t ix = 0; strprop[ix].name; ix++) { | |
| 101 | - | |
| 102 | - if(!strcasecmp(name,strprop[ix].name)) { | |
| 103 | - | |
| 104 | - // Found it! | |
| 105 | - const char * str = strprop[ix].get(hSession); | |
| 106 | - | |
| 107 | - if(str) { | |
| 108 | - return Property::create(str); | |
| 109 | - } | |
| 110 | - | |
| 111 | - throw std::system_error(errno, std::system_category()); | |
| 112 | - | |
| 113 | - } | |
| 114 | - | |
| 115 | - } | |
| 116 | - | |
| 117 | - } | |
| 118 | - | |
| 119 | - // Check for boolean properties | |
| 120 | - { | |
| 121 | - LIB3270_TOGGLE toggle = lib3270_get_toggle_id(name); | |
| 122 | - if(toggle != (LIB3270_TOGGLE) -1) { | |
| 123 | - | |
| 124 | - // Is a Tn3270 toggle, get it! | |
| 125 | - return Property::create((bool) lib3270_get_toggle(hSession,toggle)); | |
| 126 | - | |
| 127 | - } | |
| 128 | - | |
| 129 | - const LIB3270_INT_PROPERTY * intprop = lib3270_get_boolean_properties_list(); | |
| 130 | - for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 131 | - | |
| 132 | - if(!strcasecmp(name,intprop[ix].name)) { | |
| 133 | - | |
| 134 | - errno = 0; | |
| 135 | - bool value = (intprop[ix].get(hSession) != 0); | |
| 136 | - | |
| 137 | - if(errno != 0) { | |
| 138 | - throw std::system_error(errno, std::system_category()); | |
| 139 | - } | |
| 140 | - | |
| 141 | - return TN3270::Property::create(value); | |
| 142 | - | |
| 143 | - } | |
| 144 | - | |
| 145 | - } | |
| 146 | - | |
| 147 | - | |
| 148 | - } | |
| 149 | - | |
| 150 | - // Not found! | |
| 151 | - throw std::system_error(ENOENT, std::system_category()); | |
| 152 | - | |
| 153 | - } | |
| 154 | - | |
| 155 | - void Local::Session::getProperty(const char *name, int &value) const { | |
| 156 | - | |
| 157 | - const LIB3270_INT_PROPERTY * intprop = lib3270_get_int_properties_list(); | |
| 158 | - for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 159 | - | |
| 160 | - if(!strcasecmp(name,intprop[ix].name)) { | |
| 161 | - | |
| 162 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 163 | - | |
| 164 | - value = intprop[ix].get(hSession); | |
| 165 | - | |
| 166 | - if(value < 0 && errno != 0) { | |
| 167 | - throw std::system_error(errno, std::system_category()); | |
| 168 | - } | |
| 169 | - | |
| 170 | - | |
| 171 | - } | |
| 172 | - | |
| 173 | - } | |
| 174 | - | |
| 175 | - throw std::system_error(ENOENT, std::system_category()); | |
| 176 | - } | |
| 177 | - | |
| 178 | - void Local::Session::getProperty(const char *name, unsigned int &value) const { | |
| 179 | - | |
| 180 | - const LIB3270_UINT_PROPERTY * intprop = lib3270_get_unsigned_properties_list(); | |
| 181 | - for(size_t ix = 0; intprop[ix].name; ix++) { | |
| 182 | - | |
| 183 | - if(!strcasecmp(name,intprop[ix].name)) { | |
| 184 | - | |
| 185 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 186 | - | |
| 187 | - errno = 0; | |
| 188 | - value = intprop[ix].get(hSession); | |
| 189 | - | |
| 190 | - if(errno == 0) { | |
| 191 | - return; | |
| 192 | - } | |
| 193 | - | |
| 194 | - throw std::system_error(errno, std::system_category()); | |
| 195 | - | |
| 196 | - } | |
| 197 | - | |
| 198 | - } | |
| 199 | - | |
| 200 | - throw std::system_error(ENOENT, std::system_category()); | |
| 201 | - } | |
| 202 | - | |
| 203 | - void Local::Session::getProperty(const char *name, std::string &value) const { | |
| 204 | - | |
| 205 | - const LIB3270_STRING_PROPERTY * strprop = lib3270_get_string_properties_list(); | |
| 206 | - | |
| 207 | - for(size_t ix = 0; strprop[ix].name; ix++) { | |
| 208 | - | |
| 209 | - if(!strcasecmp(name,strprop[ix].name)) { | |
| 210 | - | |
| 211 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 212 | - | |
| 213 | - // Found it! | |
| 214 | - const char * str = strprop[ix].get(hSession); | |
| 215 | - | |
| 216 | - if(str) { | |
| 217 | - value.assign(str); | |
| 218 | - return; | |
| 219 | - } | |
| 220 | - | |
| 221 | - throw std::system_error(errno, std::system_category()); | |
| 222 | - | |
| 223 | - } | |
| 224 | - | |
| 225 | - } | |
| 226 | - | |
| 227 | - throw std::system_error(ENOENT, std::system_category()); | |
| 228 | - | |
| 229 | - } | |
| 230 | - | |
| 231 | - void Local::Session::getProperty(const char *name, bool &value) const { | |
| 232 | - | |
| 233 | - LIB3270_TOGGLE toggle = lib3270_get_toggle_id(name); | |
| 234 | - if(toggle != (LIB3270_TOGGLE) -1) { | |
| 235 | - | |
| 236 | - // Is a Tn3270 toggle, get it! | |
| 237 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 238 | - value = lib3270_get_toggle(hSession,toggle); | |
| 239 | - | |
| 240 | - } | |
| 241 | - | |
| 242 | - throw std::system_error(ENOENT, std::system_category()); | |
| 243 | - | |
| 244 | - } | |
| 245 | - | |
| 246 | - void Local::Session::setProperty(const char *name, const int value) { | |
| 247 | - throw std::system_error(ENOTSUP, std::system_category()); | |
| 248 | - } | |
| 249 | - | |
| 250 | - void Local::Session::setProperty(const char *name, const char *value) { | |
| 251 | - throw std::system_error(ENOTSUP, std::system_category()); | |
| 252 | - } | |
| 253 | - | |
| 254 | - void Local::Session::setCharSet(const char *charset) { | |
| 255 | - Abstract::Session::setCharSet(lib3270_get_display_charset(this->hSession),charset); | |
| 256 | - } | |
| 257 | - | |
| 258 | - unsigned short Local::Session::getScreenWidth() const { | |
| 259 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 260 | - return (unsigned short) lib3270_get_width(hSession); | |
| 261 | - } | |
| 262 | - | |
| 263 | - unsigned short Local::Session::getScreenHeight() const { | |
| 264 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 265 | - return (unsigned short) lib3270_get_height(hSession); | |
| 266 | - } | |
| 267 | - | |
| 268 | - unsigned short Local::Session::getScreenLength() const { | |
| 269 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 270 | - return (unsigned short) lib3270_get_length(hSession); | |
| 271 | - } | |
| 272 | - | |
| 273 | - void Local::Session::setUnlockDelay(unsigned short delay) { | |
| 274 | - std::lock_guard<std::mutex> lock(sync); | |
| 275 | - chkResponse(lib3270_set_unlock_delay(hSession,delay)); | |
| 276 | - } | |
| 277 | - | |
| 278 | - void Local::Session::setLockOnOperatorError(bool lock) { | |
| 279 | - std::lock_guard<std::mutex> guard(sync); | |
| 280 | - chkResponse(lib3270_set_lock_on_operator_error(hSession,lock ? 1 : 0)); | |
| 281 | - } | |
| 282 | - | |
| 283 | - unsigned short Local::Session::setCursor(int addr) { | |
| 284 | - std::lock_guard<std::mutex> lock(sync); | |
| 285 | - | |
| 286 | - int rc = lib3270_set_cursor_address(hSession,addr); | |
| 287 | - if(rc < 0) | |
| 288 | - chkResponse(-rc); | |
| 289 | - | |
| 290 | - return (unsigned short) rc; | |
| 291 | - | |
| 292 | - } | |
| 293 | - | |
| 294 | - unsigned short Local::Session::setCursor(unsigned short row, unsigned short col) { | |
| 295 | - std::lock_guard<std::mutex> lock(sync); | |
| 296 | - | |
| 297 | - int rc = lib3270_set_cursor_position(hSession,row,col); | |
| 298 | - if(rc < 0) | |
| 299 | - chkResponse(-rc); | |
| 300 | - | |
| 301 | - return (unsigned short) rc; | |
| 302 | - | |
| 303 | - } | |
| 304 | - | |
| 305 | - unsigned short Local::Session::getCursorAddress() { | |
| 306 | - std::lock_guard<std::mutex> lock(sync); | |
| 307 | - | |
| 308 | - int rc = lib3270_get_cursor_address(hSession); | |
| 309 | - | |
| 310 | - if(!rc) | |
| 311 | - chkResponse(errno); | |
| 312 | - | |
| 313 | - return rc; | |
| 314 | - } | |
| 315 | - | |
| 316 | - std::string Local::Session::getVersion() const { | |
| 317 | - | |
| 318 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 319 | - return lib3270_get_version(); | |
| 320 | - | |
| 321 | - } | |
| 322 | - | |
| 323 | - std::string Local::Session::getRevision() const { | |
| 324 | - | |
| 325 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 326 | - return lib3270_get_revision(); | |
| 327 | - | |
| 328 | - } | |
| 329 | - | |
| 330 | - std::string Local::Session::getLUName() const { | |
| 331 | - | |
| 332 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 333 | - return lib3270_get_luname(hSession); | |
| 334 | - | |
| 335 | - } | |
| 336 | - | |
| 337 | - std::string Local::Session::getHostURL() const { | |
| 338 | - | |
| 339 | - std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); | |
| 340 | - return lib3270_get_url(hSession); | |
| 341 | - | |
| 342 | - } | |
| 343 | - | |
| 344 | - void Local::Session::setHostURL(const char *url) { | |
| 345 | - | |
| 346 | - std::lock_guard<std::mutex> lock(sync); | |
| 347 | - chkResponse(lib3270_set_url(hSession, url)); | |
| 348 | - | |
| 349 | - } | |
| 350 | - | |
| 351 | - | |
| 352 | - } | |
| 353 | - | |
| 354 | - |
client/src/session/remote/get.cc
| ... | ... | @@ -88,7 +88,7 @@ |
| 88 | 88 | ProgramMessage IPC::Session::getProgramMessage() const { |
| 89 | 89 | |
| 90 | 90 | int program_message; |
| 91 | - getProperty("program_message",program_message); | |
| 91 | + getAttribute("program_message",program_message); | |
| 92 | 92 | return (ProgramMessage) program_message; |
| 93 | 93 | |
| 94 | 94 | } |
| ... | ... | @@ -96,7 +96,7 @@ |
| 96 | 96 | ConnectionState IPC::Session::getConnectionState() const { |
| 97 | 97 | |
| 98 | 98 | int cstate; |
| 99 | - getProperty("cstate",cstate); | |
| 99 | + getAttribute("cstate",cstate); | |
| 100 | 100 | return (ConnectionState) cstate; |
| 101 | 101 | |
| 102 | 102 | } |
| ... | ... | @@ -104,14 +104,14 @@ |
| 104 | 104 | SSLState IPC::Session::getSSLState() const { |
| 105 | 105 | |
| 106 | 106 | int value; |
| 107 | - getProperty("sslstate",value); | |
| 107 | + getAttribute("sslstate",value); | |
| 108 | 108 | return (TN3270::SSLState) value; |
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | LIB3270_KEYBOARD_LOCK_STATE IPC::Session::getKeyboardLockState() const { |
| 113 | 113 | unsigned int value; |
| 114 | - getProperty("kybdlock",value); | |
| 114 | + getAttribute("kybdlock",value); | |
| 115 | 115 | return (LIB3270_KEYBOARD_LOCK_STATE) value; |
| 116 | 116 | } |
| 117 | 117 | ... | ... |
client/src/session/remote/private.h
| ... | ... | @@ -114,12 +114,13 @@ |
| 114 | 114 | SSLState getSSLState() const override; |
| 115 | 115 | |
| 116 | 116 | // Properties. |
| 117 | - void getProperty(const char *name, int &value) const override; | |
| 118 | - void getProperty(const char *name, unsigned int &value) const override; | |
| 119 | - void getProperty(const char *name, std::string &value) const override; | |
| 120 | - void getProperty(const char *name, bool &value) const override; | |
| 121 | - void setProperty(const char *name, const int value) override; | |
| 122 | - void setProperty(const char *name, const char *value) override; | |
| 117 | + void getAttribute(const char *name, int &value) const override; | |
| 118 | + void getAttribute(const char *name, unsigned int &value) const override; | |
| 119 | + void getAttribute(const char *name, std::string &value) const override; | |
| 120 | + void getAttribute(const char *name, bool &value) const override; | |
| 121 | + | |
| 122 | + void setAttribute(const char *name, const int value) override; | |
| 123 | + void setAttribute(const char *name, const char *value) override; | |
| 123 | 124 | |
| 124 | 125 | std::string getVersion() const override; |
| 125 | 126 | std::string getRevision() const override; | ... | ... |
client/src/session/remote/properties.cc
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | |
| 46 | 46 | namespace TN3270 { |
| 47 | 47 | |
| 48 | - void IPC::Session::getProperty(const char *name, int &value) const { | |
| 48 | + void IPC::Session::getAttribute(const char *name, int &value) const { | |
| 49 | 49 | |
| 50 | 50 | Request(*this,false,name) |
| 51 | 51 | .call() |
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - void IPC::Session::getProperty(const char *name, unsigned int &value) const { | |
| 56 | + void IPC::Session::getAttribute(const char *name, unsigned int &value) const { | |
| 57 | 57 | |
| 58 | 58 | Request(*this,false,name) |
| 59 | 59 | .call() |
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - void IPC::Session::getProperty(const char *name, std::string &value) const { | |
| 64 | + void IPC::Session::getAttribute(const char *name, std::string &value) const { | |
| 65 | 65 | |
| 66 | 66 | Request(*this,false,name) |
| 67 | 67 | .call() |
| ... | ... | @@ -69,11 +69,11 @@ |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - void IPC::Session::getProperty(const char *name, bool &value) const { | |
| 72 | + void IPC::Session::getAttribute(const char *name, bool &value) const { | |
| 73 | 73 | throw std::system_error(ENOTSUP, std::system_category()); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - void IPC::Session::setProperty(const char *name, const int value) { | |
| 76 | + void IPC::Session::setAttribute(const char *name, const int value) { | |
| 77 | 77 | |
| 78 | 78 | int32_t rc; |
| 79 | 79 | |
| ... | ... | @@ -88,7 +88,7 @@ |
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - void IPC::Session::setProperty(const char *name, const char *value) { | |
| 91 | + void IPC::Session::setAttribute(const char *name, const char *value) { | |
| 92 | 92 | |
| 93 | 93 | int32_t rc; |
| 94 | 94 | |
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | unsigned short IPC::Session::getScreenWidth() const { |
| 112 | 112 | |
| 113 | 113 | uint32_t value; |
| 114 | - getProperty("width",value); | |
| 114 | + getAttribute("width",value); | |
| 115 | 115 | return (unsigned short) value; |
| 116 | 116 | |
| 117 | 117 | } |
| ... | ... | @@ -119,7 +119,7 @@ |
| 119 | 119 | unsigned short IPC::Session::getScreenHeight() const { |
| 120 | 120 | |
| 121 | 121 | uint32_t value; |
| 122 | - getProperty("height",value); | |
| 122 | + getAttribute("height",value); | |
| 123 | 123 | return (unsigned short) value; |
| 124 | 124 | |
| 125 | 125 | } |
| ... | ... | @@ -127,17 +127,17 @@ |
| 127 | 127 | unsigned short IPC::Session::getScreenLength() const { |
| 128 | 128 | |
| 129 | 129 | uint32_t value; |
| 130 | - getProperty("length",value); | |
| 130 | + getAttribute("length",value); | |
| 131 | 131 | return (unsigned short) value; |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | void IPC::Session::setUnlockDelay(unsigned short delay) { |
| 136 | - setProperty("unlock_delay", (uint32_t) delay); | |
| 136 | + setAttribute("unlock_delay", (uint32_t) delay); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | void IPC::Session::setLockOnOperatorError(bool lock) { |
| 140 | - setProperty("oerrlock", (uint32_t) lock); | |
| 140 | + setAttribute("oerrlock", (uint32_t) lock); | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | unsigned short IPC::Session::setCursor(int addr) { |
| ... | ... | @@ -176,7 +176,7 @@ |
| 176 | 176 | unsigned short IPC::Session::getCursorAddress() { |
| 177 | 177 | |
| 178 | 178 | int32_t address; |
| 179 | - getProperty("cursor_address",address); | |
| 179 | + getAttribute("cursor_address",address); | |
| 180 | 180 | return (unsigned short) address; |
| 181 | 181 | |
| 182 | 182 | } |
| ... | ... | @@ -184,7 +184,7 @@ |
| 184 | 184 | std::string IPC::Session::getVersion() const { |
| 185 | 185 | |
| 186 | 186 | string rc; |
| 187 | - getProperty("version",rc); | |
| 187 | + getAttribute("version",rc); | |
| 188 | 188 | return rc; |
| 189 | 189 | |
| 190 | 190 | } |
| ... | ... | @@ -192,7 +192,7 @@ |
| 192 | 192 | std::string IPC::Session::getRevision() const { |
| 193 | 193 | |
| 194 | 194 | string rc; |
| 195 | - getProperty("revision",rc); | |
| 195 | + getAttribute("revision",rc); | |
| 196 | 196 | return rc; |
| 197 | 197 | |
| 198 | 198 | } |
| ... | ... | @@ -200,7 +200,7 @@ |
| 200 | 200 | std::string IPC::Session::getLUName() const { |
| 201 | 201 | |
| 202 | 202 | string rc; |
| 203 | - getProperty("luname",rc); | |
| 203 | + getAttribute("luname",rc); | |
| 204 | 204 | return rc; |
| 205 | 205 | |
| 206 | 206 | } |
| ... | ... | @@ -208,14 +208,14 @@ |
| 208 | 208 | std::string IPC::Session::getHostURL() const { |
| 209 | 209 | |
| 210 | 210 | std::string value; |
| 211 | - getProperty("url",value); | |
| 211 | + getAttribute("url",value); | |
| 212 | 212 | return value; |
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | void IPC::Session::setHostURL(const char *url) { |
| 217 | 217 | |
| 218 | - setProperty("url",url); | |
| 218 | + setAttribute("url",url); | |
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | ... | ... |
client/src/testprogram/testprogram.cc
| ... | ... | @@ -93,11 +93,11 @@ |
| 93 | 93 | try { |
| 94 | 94 | |
| 95 | 95 | auto version = host["version"]; |
| 96 | - cout << "Property[version]: " << version->toString() << endl; | |
| 96 | + cout << "Property[version]: " << version->getString() << endl; | |
| 97 | 97 | delete version; |
| 98 | 98 | |
| 99 | 99 | auto connected = host["connected"]; |
| 100 | - cout << "Property[connected]: " << connected->toString() << endl; | |
| 100 | + cout << "Property[connected]: " << connected->getString() << endl; | |
| 101 | 101 | delete connected; |
| 102 | 102 | |
| 103 | 103 | cout |
| ... | ... | @@ -144,24 +144,6 @@ |
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - TN3270::Property * chk() { | |
| 148 | - | |
| 149 | - class Test : public TN3270::Property { | |
| 150 | - private: | |
| 151 | - int val; | |
| 152 | - | |
| 153 | - public: | |
| 154 | - Test(int value) : TN3270::Property(TN3270::Property::Uint32) { | |
| 155 | - val = value; | |
| 156 | - } | |
| 157 | - | |
| 158 | - virtual ~Test() { } | |
| 159 | - }; | |
| 160 | - | |
| 161 | - return new Test{10}; | |
| 162 | - | |
| 163 | - } | |
| 164 | - | |
| 165 | 147 | int main(int argc, char **argv) { |
| 166 | 148 | |
| 167 | 149 | ... | ... |