diff options
author | 2021-07-14 12:53:01 -0700 | |
---|---|---|
committer | 2021-07-15 13:42:13 -0700 | |
commit | 4382e44c42d2a1edf92a9ef11dbf34843025e64f (patch) | |
tree | f4b2855b1df909e526a298300ee55f79a65ccc79 /tools/aapt2/Debug.cpp | |
parent | 3947c9b56c2e79d76b6941fb5bdcdf25e359b0a4 (diff) |
Replace Maybe with std::optional
With c++17, std::optional provides the functionality that Maybe
provided.
Bug: 183215655
Test: aapt2_tests
Change-Id: I62bb9c2fa4985dc5217a6ed153df92b85ad9a034
Diffstat (limited to 'tools/aapt2/Debug.cpp')
-rw-r--r-- | tools/aapt2/Debug.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp index ef3a62f4efcc..df444ba7b169 100644 --- a/tools/aapt2/Debug.cpp +++ b/tools/aapt2/Debug.cpp @@ -280,8 +280,7 @@ void Debug::PrintTable(const ResourceTable& table, const DebugPrintTableOptions& printer->Indent(); for (const ResourceTableEntryView& entry : type.entries) { printer->Print("resource "); - printer->Print(ResourceId(package.id.value_or_default(0), type.id.value_or_default(0), - entry.id.value_or_default(0)) + printer->Print(ResourceId(package.id.value_or(0), type.id.value_or(0), entry.id.value_or(0)) .to_string()); printer->Print(" "); @@ -362,7 +361,7 @@ void Debug::PrintStyleGraph(ResourceTable* table, const ResourceName& target_sty continue; } - Maybe<ResourceTable::SearchResult> result = table->FindResource(style_name); + std::optional<ResourceTable::SearchResult> result = table->FindResource(style_name); if (result) { ResourceEntry* entry = result.value().entry; for (const auto& value : entry->values) { @@ -482,8 +481,7 @@ class XmlPrinter : public xml::ConstVisitor { if (attr.compiled_attribute) { printer_->Print("("); - printer_->Print( - attr.compiled_attribute.value().id.value_or_default(ResourceId(0)).to_string()); + printer_->Print(attr.compiled_attribute.value().id.value_or(ResourceId(0)).to_string()); printer_->Print(")"); } printer_->Print("="); |