MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / gen_additional_proxy_function_begin

Method gen_additional_proxy_function_begin

tl/generate/tl_writer_hpp.cpp:202–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202std::string TD_TL_writer_hpp::gen_additional_proxy_function_begin(const std::string &function_name,
203 const tl::tl_type *type,
204 const std::string &class_name, int arity,
205 bool is_function) const {
206 if (function_name == "downcast_call") {
207 return "/**\n"
208 " * Calls specified function object with the specified object downcasted to the most-derived type.\n"
209 " * \\param[in] obj Object to pass as an argument to the function object.\n"
210 " * \\param[in] func Function object to which the object will be passed.\n"
211 " * \\returns whether function object call has happened. Should always return true for correct parameters.\n"
212 " */\n"
213 "template <class T>\n"
214 "bool downcast_call(" +
215 class_name +
216 " &obj, const T &func) {\n"
217 " switch (obj.get_id()) {\n";
218 }
219 if (function_name == "downcast_construct") {
220 return "/**\n"
221 "* Constructs tl_object_ptr with the object of the same type as the specified object, calls the specified "
222 "function.\n"
223 " * \\param[in] obj Object to get the type from.\n"
224 " * \\param[in] func Function object to which the new object will be passed.\n"
225 " * \\returns whether function object call has happened. Should always return true for correct parameters.\n"
226 "*/"
227 "template <class T>\n"
228 "bool downcast_construct(" +
229 class_name +
230 " &obj, const T &func) {\n"
231 "switch (obj.get_id()) {";
232 }
233 assert(false);
234}
235
236std::string TD_TL_writer_hpp::gen_additional_proxy_function_case(const std::string &function_name,
237 const tl::tl_type *type, const std::string &class_name,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected