You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
651 B
Django/Jinja

#include "{{ cls.name }}.skeleton.h"
#include <sstream>
{{ cls.name }}Skeleton::{{ cls.name }}Skeleton({{ cls.name }}& o) : obj(o) {}
std::string {{ cls.name }}Skeleton::handleRequest(const std::string& req) {
std::istringstream in(req);
std::string method;
in >> method;
{% for m in cls.methods %}
if (method == "{{ m.name }}") {
{% for a in m.args %}int {{ a.name }}; in >> {{ a.name }};
{% endfor %}
int res = obj.{{ m.name }}({% for a in m.args %}{{ a.name }}{% if not loop.last %}, {% endif %}{% endfor %});
return std::to_string(res);
}
{% endfor %}
return std::string("ERR");
}