| 40 | template <class WriterCpp = td::TD_TL_writer_cpp, class WriterH = td::TD_TL_writer_h, |
| 41 | class WriterHpp = td::TD_TL_writer_hpp> |
| 42 | static void generate_cpp(const std::string &directory, const std::string &tl_name, const std::string &string_type, |
| 43 | const std::string &bytes_type, const std::string &secure_string_type, |
| 44 | const std::string &secure_bytes_type, const std::vector<std::string> &ext_cpp_includes, |
| 45 | const std::vector<std::string> &ext_h_includes) { |
| 46 | std::string path = directory + "/" + tl_name; |
| 47 | td::tl::tl_config config = td::tl::read_tl_config_from_file("scheme/" + tl_name + ".tlo"); |
| 48 | td::tl::write_tl_to_file( |
| 49 | config, path + ".cpp", |
| 50 | WriterCpp(tl_name, string_type, bytes_type, secure_string_type, secure_bytes_type, ext_cpp_includes)); |
| 51 | td::tl::write_tl_to_file( |
| 52 | config, path + ".h", |
| 53 | WriterH(tl_name, string_type, bytes_type, secure_string_type, secure_bytes_type, ext_h_includes)); |
| 54 | td::tl::write_tl_to_file(config, path + ".hpp", |
| 55 | WriterHpp(tl_name, string_type, bytes_type, secure_string_type, secure_bytes_type)); |
| 56 | } |
| 57 | |
| 58 | int main() { |
| 59 | generate_cpp("auto/tl", "cocoon_api", "std::string", "td::BufferSlice", "std::string", "td::BufferSlice", |