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.
25 lines
812 B
Django/Jinja
25 lines
812 B
Django/Jinja
#pragma once
|
|
|
|
#include "{{ cls.name }}.h"
|
|
|
|
// Шаблонный прокси, который зависит только от контракта Impl:
|
|
// Impl должен предоставлять метод
|
|
// template<typename Ret, typename... Args>
|
|
// Ret callTyped(const std::string& method, const Args&... args);
|
|
template<typename Impl>
|
|
class {{ cls.name }}Proxy {
|
|
public:
|
|
explicit {{ cls.name }}Proxy(Impl& impl)
|
|
: impl(impl) {}
|
|
|
|
{% for m in cls.methods %}
|
|
{{ m.return_type }} {{ m.name }}({% for a in m.args %}{{ a.type }} {{ a.name }}{% if not loop.last %}, {% endif %}{% endfor %}) {
|
|
return impl.template callTyped<{{ m.return_type }}>("{{ cls.name }}.{{ m.name }}"{% for a in m.args %}, {{ a.name }}{% endfor %});
|
|
}
|
|
{% endfor %}
|
|
|
|
private:
|
|
Impl& impl;
|
|
};
|
|
|