| 145 | } |
| 146 | |
| 147 | std::string TD_TL_writer_cpp::gen_fetch_class_name(const tl::tl_tree_type *tree_type) const { |
| 148 | const tl::tl_type *t = tree_type->type; |
| 149 | const std::string &name = t->name; |
| 150 | |
| 151 | if (name == "#" || name == "Int32") { |
| 152 | return "ton::TlFetchInt"; |
| 153 | } |
| 154 | if (name == "Int53" || name == "Int64") { |
| 155 | return "ton::TlFetchLong"; |
| 156 | } |
| 157 | if (name == "True" || name == "Bool" || name == "Int" || name == "Long" || name == "Double" || name == "Int128" || |
| 158 | name == "Int256") { |
| 159 | return "ton::TlFetch" + name; |
| 160 | } |
| 161 | if (name == "String" || name == "SecureString") { |
| 162 | return "ton::TlFetchString<" + string_type + ">"; |
| 163 | } |
| 164 | if (name == "Bytes" || name == "SecureBytes") { |
| 165 | return "ton::TlFetchBytes<" + bytes_type + ">"; |
| 166 | } |
| 167 | if (name == "Object") { |
| 168 | return "ton::TlFetchObject<" + gen_base_type_class_name(0) + ">"; |
| 169 | } |
| 170 | if (name == "Function") { |
| 171 | return "ton::TlFetchObject<" + gen_base_function_class_name() + ">"; |
| 172 | } |
| 173 | |
| 174 | if (name == "Vector") { |
| 175 | assert(t->arity == 1); |
| 176 | assert(tree_type->children.size() == 1); |
| 177 | assert(tree_type->children[0]->get_type() == tl::NODE_TYPE_TYPE); |
| 178 | const tl::tl_tree_type *child = static_cast<const tl::tl_tree_type *>(tree_type->children[0]); |
| 179 | |
| 180 | return "ton::TlFetchVector<" + gen_full_fetch_class_name(child) + ">"; |
| 181 | } |
| 182 | |
| 183 | assert(!is_built_in_simple_type(name) && !is_built_in_complex_type(name)); |
| 184 | for (std::size_t i = 0; i < tree_type->children.size(); i++) { |
| 185 | assert(tree_type->children[i]->get_type() == tl::NODE_TYPE_NAT_CONST); |
| 186 | } |
| 187 | |
| 188 | assert(tree_type->children.empty()); |
| 189 | return "ton::TlFetchObject<" + gen_main_class_name(t) + ">"; |
| 190 | } |
| 191 | |
| 192 | std::string TD_TL_writer_cpp::gen_full_fetch_class_name(const tl::tl_tree_type *tree_type) const { |
| 193 | const tl::tl_type *t = tree_type->type; |
nothing calls this directly
no outgoing calls
no test coverage detected