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/xml/XmlDom.h b/tools/aapt2/xml/XmlDom.h
index a5b2d10..5d31804 100644
--- a/tools/aapt2/xml/XmlDom.h
+++ b/tools/aapt2/xml/XmlDom.h
@@ -65,12 +65,12 @@
};
struct AaptAttribute {
- explicit AaptAttribute(const ::aapt::Attribute& attr, const Maybe<ResourceId>& resid = {})
+ explicit AaptAttribute(const ::aapt::Attribute& attr, const std::optional<ResourceId>& resid = {})
: attribute(attr), id(resid) {
}
aapt::Attribute attribute;
- Maybe<ResourceId> id;
+ std::optional<ResourceId> id;
};
// An XML attribute.
@@ -79,7 +79,7 @@
std::string name;
std::string value;
- Maybe<AaptAttribute> compiled_attribute;
+ std::optional<AaptAttribute> compiled_attribute;
std::unique_ptr<Item> compiled_value;
};
@@ -235,7 +235,8 @@
public:
using Visitor::Visit;
- Maybe<ExtractedPackage> TransformPackageAlias(const android::StringPiece& alias) const override;
+ std::optional<ExtractedPackage> TransformPackageAlias(
+ const android::StringPiece& alias) const override;
protected:
PackageAwareVisitor() = default;