| 245 | "}\n" |
| 246 | |
| 247 | static bool is_map_entry(const google::protobuf::Descriptor* d) { |
| 248 | if (d->field_count() != 2 || |
| 249 | d->field(0)->name() != "key" || |
| 250 | d->field(0)->number() != 1 || |
| 251 | d->field(1)->name() != "value" || |
| 252 | d->field(1)->number() != 2) { |
| 253 | return false; |
| 254 | } |
| 255 | if (d->field(0)->is_repeated()) { |
| 256 | LOG(ERROR) << d->field(0)->full_name() << " must be required or optional"; |
| 257 | return false; |
| 258 | } |
| 259 | if (d->field(1)->is_repeated()) { |
| 260 | LOG(ERROR) << d->field(1)->full_name() << " must be required or optional"; |
| 261 | return false; |
| 262 | } |
| 263 | if (d->field(0)->cpp_type() != google::protobuf::FieldDescriptor::CPPTYPE_STRING) { |
| 264 | LOG(ERROR) << "key of idl map must be string"; |
| 265 | return false; |
| 266 | } |
| 267 | return true; |
| 268 | } |
| 269 | |
| 270 | static bool generate_parsing(const google::protobuf::Descriptor* d, |
| 271 | std::set<std::string> & ref_msgs, |
no test coverage detected