diff options
Diffstat (limited to 'project2/ice/slice2Rows.cpp')
-rw-r--r-- | project2/ice/slice2Rows.cpp | 18 |
1 files changed, 13 insertions, 5 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()) { |