MCPcopy Create free account
hub / github.com/Snapchat/Valdi / build

Method build

valdi_protobuf/src/valdi_protobuf/DescriptorDatabaseBuilder.cpp:355–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355bool 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

Calls 11

set_file_nameMethod · 0.80
slowToStringMethod · 0.80
set_data_offsetMethod · 0.80
set_lengthMethod · 0.80
add_symbolsMethod · 0.80
set_full_nameMethod · 0.80
set_file_indexMethod · 0.80
add_packagesMethod · 0.80
add_symbol_indexesMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected