Replace Maybe with std::optional
With c++17, std::optional provides the functionality that Maybe
provided.
Bug: 183215655
Test: aapt2_tests
Change-Id: I62bb9c2fa4985dc5217a6ed153df92b85ad9a034
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
index ef3a62f..df444ba 100644
--- a/tools/aapt2/Debug.cpp
+++ b/tools/aapt2/Debug.cpp
@@ -280,8 +280,7 @@
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 @@
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 @@
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("=");