diff options
-rw-r--r-- | project2/ice/slice2Rows.cpp | 18 | ||||
-rw-r--r-- | project2/ice/slice2Task.cpp | 15 |
2 files changed, 24 insertions, 9 deletions
diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp index 9646f17..a90b643 100644 --- a/project2/ice/slice2Rows.cpp +++ b/project2/ice/slice2Rows.cpp @@ -49,15 +49,23 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o) fprintf(code, "ice @ %%p\", \n"); fprintf(code, "\t\t\t\t\t\t\t\t__PRETTY_FUNCTION__, "); BOOST_FOREACH(const auto & p, o->parameters()) { - fprintf(code, "%s(ec).as<std::string>(), ", p->name().c_str()); + fprintf(code, "%s(ec), ", p->name().c_str()); } fprintf(code, "ice);\n"); fprintf(code, "\t\t\t\t\t\tIce::Context ctx;\n"); BOOST_FOREACH(const auto & p, o->parameters()) { - fprintf(code, "\t\t\t\t\t\tauto _%s = IceConvert< %s >::FromVariable(%s(ec));\n", - p->name().c_str(), - Slice::typeToString(p->type()).c_str(), - p->name().c_str()); + if (p->optional()) { + fprintf(code, "\t\t\t\t\t\tauto _%s = IceConvert< ::IceUtil::Optional< %s > >::FromVariable(%s(ec));\n", + p->name().c_str(), + Slice::typeToString(p->type()).c_str(), + p->name().c_str()); + } + else { + fprintf(code, "\t\t\t\t\t\tauto _%s = IceConvert< %s >::FromVariable(%s(ec));\n", + p->name().c_str(), + Slice::typeToString(p->type()).c_str(), + p->name().c_str()); + } } fprintf(code, "\t\t\t\t\t\tIceRowState<decltype(service->%s(", o->name().c_str()); BOOST_FOREACH(const auto & p, o->parameters()) { diff --git a/project2/ice/slice2Task.cpp b/project2/ice/slice2Task.cpp index 53ad8b4..54f05a8 100644 --- a/project2/ice/slice2Task.cpp +++ b/project2/ice/slice2Task.cpp @@ -50,15 +50,22 @@ Slice2Task::visitOperation(const Slice::OperationPtr & o) fprintf(code, "ice @ %%p\", \n"); fprintf(code, "\t\t\t\t\t\t\t\t__PRETTY_FUNCTION__, "); BOOST_FOREACH(const auto & p, o->parameters()) { - fprintf(code, "%s(ec).as<std::string>(), ", p->name().c_str()); + fprintf(code, "%s(ec), ", p->name().c_str()); } fprintf(code, "ice);\n"); fprintf(code, "\t\t\t\t\t\tIce::Context ctx;\n"); fprintf(code, "\t\t\t\t\t\tservice->%s(", o->name().c_str()); BOOST_FOREACH(const auto & p, o->parameters()) { - fprintf(code, "IceConvert< %s >::ToVariable(%s(ec)), ", - Slice::typeToString(p->type()).c_str(), - p->name().c_str()); + if (p->optional()) { + fprintf(code, "IceConvert< ::IceUtil::Optional< %s > >::FromVariable(%s(ec)), ", + Slice::typeToString(p->type()).c_str(), + p->name().c_str()); + } + else { + fprintf(code, "IceConvert< %s >::FromVariable(%s(ec)), ", + Slice::typeToString(p->type()).c_str(), + p->name().c_str()); + } } fprintf(code, "ctx);\n"); fprintf(code, "\t\t\t\t\t}\n\n"); |