diff --git a/client/src/session/remote/attribute.cc b/client/src/session/remote/attribute.cc index 7bf57ec..72d83cd 100644 --- a/client/src/session/remote/attribute.cc +++ b/client/src/session/remote/attribute.cc @@ -110,6 +110,41 @@ return (attr.getInt32() != 0); }; + if(worker->set) { + + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + } } @@ -145,6 +180,40 @@ return value; }; + if(worker->set) { + + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + set.asBoolean = [](const Attribute & attr, const void *worker, const bool value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + } } @@ -181,6 +250,41 @@ return (attr.getUint32() != 0); }; + if(worker->set) { + + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + } } }; @@ -191,7 +295,6 @@ get.asString = [](const Attribute & attr, const void *worker) { - const struct Worker * w = (const struct Worker *) worker; string value; @@ -216,6 +319,57 @@ }; + if(worker->set) { + + set.asString = [](const Attribute & attr, const void *worker, const char *value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(value) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + set.asInt32 = [](const Attribute & attr, const void *worker, const int32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(std::to_string(value).c_str()) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + set.asUint32 = [](const Attribute & attr, const void *worker, const uint32_t value) { + + const struct Worker * w = (const struct Worker *) worker; + int32_t rc; + + IPC::Request(*w->session,true,w->methods->name) + .push(std::to_string(value).c_str()) + .call() + .pop(rc); + + if(rc) { + throw std::system_error((int) rc, std::system_category()); + } + + }; + + } } }; diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index a60c9ef..377bb86 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -197,13 +197,13 @@ //testAttributes(session); { - TN3270::Host host{"",nullptr,10}; + TN3270::Host host{":a",nullptr,10}; cout << "pre: " << host["url"] << endl; - host["url"] = "http://www.google.com.br"; + // host["url"] = "http://www.google.com.br"; - cout << "post: " << host["url"] << endl; + // cout << "post: " << host["url"] << endl; } -- libgit2 0.21.2