| 353 | } |
| 354 | |
| 355 | bool DescriptorDatabaseBuilder::build(std::vector<BytesView>& retainedBuffers, |
| 356 | DescriptorIndex::DescriptorIndex& descriptorIndex) { |
| 357 | DescriptorIndex::DescriptorIndex idx; |
| 358 | for (const auto& f : _files) { |
| 359 | auto* ff = idx.add_files(); |
| 360 | ff->set_file_name(f.fileName.slowToString()); |
| 361 | ff->set_data_offset(reinterpret_cast<uintptr_t>(f.data)); |
| 362 | ff->set_length(static_cast<uint32_t>(f.length)); |
| 363 | } |
| 364 | for (const auto& s : _symbols) { |
| 365 | auto* ss = idx.add_symbols(); |
| 366 | ss->set_full_name(s.fullName.toString()); |
| 367 | ss->set_file_index(static_cast<uint32_t>(s.fileIndex)); |
| 368 | } |
| 369 | for (const auto& p : _packages) { |
| 370 | auto* pp = idx.add_packages(); |
| 371 | pp->set_full_name(p.fullName.toString()); |
| 372 | for (const auto si : p.symbolIndexes) { |
| 373 | pp->add_symbol_indexes(static_cast<uint32_t>(si)); |
| 374 | } |
| 375 | for (const auto pi : p.nestedPackageIndexes) { |
| 376 | pp->add_nested_package_indexes(static_cast<uint32_t>(pi)); |
| 377 | } |
| 378 | } |
| 379 | retainedBuffers = _retainedBuffers; |
| 380 | descriptorIndex = std::move(idx); |
| 381 | return true; |
| 382 | } |
| 383 | |
| 384 | } // namespace Valdi::Protobuf |
no test coverage detected