diff options
Diffstat (limited to 'tools/aapt2/Debug.cpp')
-rw-r--r-- | tools/aapt2/Debug.cpp | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp index 82da24959521..351e4202af65 100644 --- a/tools/aapt2/Debug.cpp +++ b/tools/aapt2/Debug.cpp @@ -256,53 +256,35 @@ class ValueBodyPrinter : public ConstValueVisitor { void Debug::PrintTable(const ResourceTable& table, const DebugPrintTableOptions& options, Printer* printer) { - for (const auto& package : table.packages) { - ValueHeadlinePrinter headline_printer(package->name, printer); - ValueBodyPrinter body_printer(package->name, printer); + const auto table_view = table.GetPartitionedView(); + for (const auto& package : table_view.packages) { + ValueHeadlinePrinter headline_printer(package.name, printer); + ValueBodyPrinter body_printer(package.name, printer); printer->Print("Package name="); - printer->Print(package->name); - if (package->id) { - printer->Print(StringPrintf(" id=%02x", package->id.value())); + printer->Print(package.name); + if (package.id) { + printer->Print(StringPrintf(" id=%02x", package.id.value())); } printer->Println(); printer->Indent(); - for (const auto& type : package->types) { + for (const auto& type : package.types) { printer->Print("type "); - printer->Print(to_string(type->type)); - if (type->id) { - printer->Print(StringPrintf(" id=%02x", type->id.value())); - } - printer->Println(StringPrintf(" entryCount=%zd", type->entries.size())); - - std::vector<const ResourceEntry*> sorted_entries; - for (const auto& entry : type->entries) { - auto iter = std::lower_bound( - sorted_entries.begin(), sorted_entries.end(), entry.get(), - [](const ResourceEntry* a, const ResourceEntry* b) -> bool { - if (a->id && b->id) { - return a->id.value() < b->id.value(); - } else if (a->id) { - return true; - } else { - return false; - } - }); - sorted_entries.insert(iter, entry.get()); + printer->Print(to_string(type.type)); + if (type.id) { + printer->Print(StringPrintf(" id=%02x", type.id.value())); } + printer->Println(StringPrintf(" entryCount=%zd", type.entries.size())); printer->Indent(); - for (const ResourceEntry* entry : sorted_entries) { - const ResourceId id(package->id.value_or_default(0), type->id.value_or_default(0), - entry->id.value_or_default(0)); - + for (const ResourceEntry* entry : type.entries) { printer->Print("resource "); - printer->Print(id.to_string()); + printer->Print(entry->id.value_or_default(0).to_string()); printer->Print(" "); // Write the name without the package (this is obvious and too verbose). - printer->Print(to_string(type->type)); + printer->Print(to_string(type.type)); printer->Print("/"); printer->Print(entry->name); |