Commit ba57ff5ccb05f10381331701e0b5dee20b73d813
1 parent
9077bc4c
Exists in
master
and in
1 other branch
Adding "set' method in local properties.
Showing
4 changed files
with
91 additions
and
2 deletions
Show diff stats
client/ipcclient.cbp
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | <Option compiler="gcc" /> |
| 9 | 9 | <Build> |
| 10 | 10 | <Target title="Debug"> |
| 11 | - <Option output=".bin/Debug/ipc3270" prefix_auto="1" extension_auto="1" /> | |
| 11 | + <Option output="../.bin/Debug/ipc3270-client" prefix_auto="1" extension_auto="1" /> | |
| 12 | 12 | <Option object_output=".obj/Debug/" /> |
| 13 | 13 | <Option type="1" /> |
| 14 | 14 | <Option compiler="gcc" /> | ... | ... |
client/src/include/lib3270/ipc.h
client/src/session/local/attribute.cc
| ... | ... | @@ -114,6 +114,23 @@ |
| 114 | 114 | return (attr.getInt32() != 0); |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | + if(worker->set) { | |
| 118 | + | |
| 119 | + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { | |
| 120 | + | |
| 121 | + const struct Worker * w = (const struct Worker *) worker; | |
| 122 | + w->methods->set(w->hSession,(int) value); | |
| 123 | + | |
| 124 | + }; | |
| 125 | + | |
| 126 | + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { | |
| 127 | + | |
| 128 | + const struct Worker * w = (const struct Worker *) worker; | |
| 129 | + w->methods->set(w->hSession,(int) value); | |
| 130 | + | |
| 131 | + }; | |
| 132 | + | |
| 133 | + } | |
| 117 | 134 | |
| 118 | 135 | } |
| 119 | 136 | |
| ... | ... | @@ -151,6 +168,23 @@ |
| 151 | 168 | return (attr.getInt32() != 0); |
| 152 | 169 | }; |
| 153 | 170 | |
| 171 | + if(worker->set) { | |
| 172 | + | |
| 173 | + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { | |
| 174 | + | |
| 175 | + const struct Worker * w = (const struct Worker *) worker; | |
| 176 | + w->methods->set(w->hSession,(int) value); | |
| 177 | + | |
| 178 | + }; | |
| 179 | + | |
| 180 | + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { | |
| 181 | + | |
| 182 | + const struct Worker * w = (const struct Worker *) worker; | |
| 183 | + w->methods->set(w->hSession,(int) value); | |
| 184 | + | |
| 185 | + }; | |
| 186 | + | |
| 187 | + } | |
| 154 | 188 | |
| 155 | 189 | } |
| 156 | 190 | |
| ... | ... | @@ -188,6 +222,24 @@ |
| 188 | 222 | return (attr.getUint32() != 0); |
| 189 | 223 | }; |
| 190 | 224 | |
| 225 | + if(worker->set) { | |
| 226 | + | |
| 227 | + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { | |
| 228 | + | |
| 229 | + const struct Worker * w = (const struct Worker *) worker; | |
| 230 | + w->methods->set(w->hSession,(unsigned int) value); | |
| 231 | + | |
| 232 | + }; | |
| 233 | + | |
| 234 | + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { | |
| 235 | + | |
| 236 | + const struct Worker * w = (const struct Worker *) worker; | |
| 237 | + w->methods->set(w->hSession,(unsigned int) value); | |
| 238 | + | |
| 239 | + }; | |
| 240 | + | |
| 241 | + } | |
| 242 | + | |
| 191 | 243 | } |
| 192 | 244 | }; |
| 193 | 245 | |
| ... | ... | @@ -224,6 +276,31 @@ |
| 224 | 276 | throw std::system_error(errno, std::system_category()); |
| 225 | 277 | }; |
| 226 | 278 | |
| 279 | + if(worker->set) { | |
| 280 | + | |
| 281 | + set.asString = [](const Attribute & attr, const void *worker, const char *value) { | |
| 282 | + | |
| 283 | + const struct Worker * w = (const struct Worker *) worker; | |
| 284 | + w->methods->set(w->hSession,value); | |
| 285 | + | |
| 286 | + }; | |
| 287 | + | |
| 288 | + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { | |
| 289 | + | |
| 290 | + const struct Worker * w = (const struct Worker *) worker; | |
| 291 | + w->methods->set(w->hSession,std::to_string(value).c_str()); | |
| 292 | + | |
| 293 | + }; | |
| 294 | + | |
| 295 | + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { | |
| 296 | + | |
| 297 | + const struct Worker * w = (const struct Worker *) worker; | |
| 298 | + w->methods->set(w->hSession,std::to_string(value).c_str()); | |
| 299 | + | |
| 300 | + }; | |
| 301 | + | |
| 302 | + } | |
| 303 | + | |
| 227 | 304 | |
| 228 | 305 | } |
| 229 | 306 | }; | ... | ... |
client/src/testprogram/testprogram.cc
| ... | ... | @@ -194,7 +194,18 @@ |
| 194 | 194 | cout << "Session: " << session << endl; |
| 195 | 195 | |
| 196 | 196 | //testHost(session); |
| 197 | - testAttributes(session); | |
| 197 | + //testAttributes(session); | |
| 198 | + | |
| 199 | + { | |
| 200 | + TN3270::Host host{"",nullptr,10}; | |
| 201 | + | |
| 202 | + cout << "pre: " << host["url"] << endl; | |
| 203 | + | |
| 204 | + host["url"] = "http://www.google.com.br"; | |
| 205 | + | |
| 206 | + cout << "post: " << host["url"] << endl; | |
| 207 | + } | |
| 208 | + | |
| 198 | 209 | |
| 199 | 210 | /* |
| 200 | 211 | for(auto attribute : TN3270::getAttributes()) { | ... | ... |