17 #include <type_traits> 24 template <
typename ValueType>
27 return this->
getEnvironment()->convertProxyToObject(*this).convert<ValueType>();
37 typename std::enable_if<!std::is_same<T, Proxy>::value, T>::type
38 convertProxy(
const Proxy &p)
44 typename std::enable_if<std::is_same<T, Proxy>::value, T>::type
45 convertProxy(
const Proxy &p)
55 typename std::enable_if<!std::is_same<typename std::decay<T>::type,
Proxy>::value,
Proxy>::type
58 return env->makeProxy(std::forward<T>(value));
62 typename std::enable_if<std::is_same<typename std::decay<T>::type,
Proxy>::value,
Proxy>::type
70 template <
typename ValueType>
71 Proxy::operator ValueType(
void)
const 73 return this->convert<ValueType>();
76 template <
typename ReturnType,
typename... ArgsType>
77 ReturnType
Proxy::call(
const std::string &name, ArgsType&&... args)
const 79 Proxy ret = this->
call(name, std::forward<ArgsType>(args)...);
80 return Detail::convertProxy<ReturnType>(ret);
83 template <
typename... ArgsType>
86 const std::array<
Proxy,
sizeof...(ArgsType)> proxyArgs{{Detail::makeProxy(this->
getEnvironment(), std::forward<ArgsType>(args))...}};
89 return handle->call(name, proxyArgs.data(),
sizeof...(args));
92 template <
typename... ArgsType>
95 return this->
call(name, std::forward<ArgsType>(args)...);
98 template <
typename... ArgsType>
101 this->
call(name, std::forward<ArgsType>(args)...);
104 template <
typename ReturnType>
107 return this->call<ReturnType>(
"get:"+name);
110 template <
typename ValueType>
111 void Proxy::set(
const std::string &name, ValueType&& value)
const 113 this->
call(
"set:"+name, std::forward<ValueType>(value));
116 template <
typename... ArgsType>
119 return this->
call(
"()", std::forward<ArgsType>(args)...);
ReturnType call(const std::string &name, ArgsType &&... args) const
Call a method with a return type and variable args.
Definition: ProxyImpl.hpp:77
Definition: ArchiveEntry.hpp:20
std::shared_ptr< ProxyEnvironment > Sptr
Definition: Environment.hpp:46
std::shared_ptr< ProxyEnvironment > getEnvironment(void) const
ValueType convert(void) const
Definition: ProxyImpl.hpp:25
void callVoid(const std::string &name, ArgsType &&... args) const
Definition: ProxyImpl.hpp:99
Proxy callProxy(const std::string &name, ArgsType &&... args) const
Definition: ProxyImpl.hpp:93
void set(const std::string &name, ValueType &&value) const
Call a field setter.
Definition: ProxyImpl.hpp:111
ReturnType get(const std::string &name) const
Call a field getter with specified return type.
Definition: ProxyImpl.hpp:105
std::shared_ptr< ProxyHandle > getHandle(void) const
Get the handle held in this proxy object.
Proxy operator()(ArgsType &&... args) const
Call the function operator() with a Proxy return and variable args.
Definition: ProxyImpl.hpp:117