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/ResourceUtils.h b/tools/aapt2/ResourceUtils.h
index be493db..fe450a8 100644
--- a/tools/aapt2/ResourceUtils.h
+++ b/tools/aapt2/ResourceUtils.h
@@ -75,35 +75,33 @@
/**
* Convert an android::ResTable::resource_name to an aapt::ResourceName struct.
*/
-Maybe<ResourceName> ToResourceName(
- const android::ResTable::resource_name& name);
+std::optional<ResourceName> ToResourceName(const android::ResTable::resource_name& name);
/**
* Convert an android::AssetManager2::ResourceName to an aapt::ResourceName struct.
*/
-Maybe<ResourceName> ToResourceName(
- const android::AssetManager2::ResourceName& name_in);
+std::optional<ResourceName> ToResourceName(const android::AssetManager2::ResourceName& name_in);
/**
* Returns a boolean value if the string is equal to TRUE, true, True, FALSE,
* false, or False.
*/
-Maybe<bool> ParseBool(const android::StringPiece& str);
+std::optional<bool> ParseBool(const android::StringPiece& str);
/**
* Returns a uint32_t if the string is an integer.
*/
-Maybe<uint32_t> ParseInt(const android::StringPiece& str);
+std::optional<uint32_t> ParseInt(const android::StringPiece& str);
/**
* Returns an ID if it the string represented a valid ID.
*/
-Maybe<ResourceId> ParseResourceId(const android::StringPiece& str);
+std::optional<ResourceId> ParseResourceId(const android::StringPiece& str);
/**
* Parses an SDK version, which can be an integer, or a letter from A-Z.
*/
-Maybe<int> ParseSdkVersion(const android::StringPiece& str);
+std::optional<int> ParseSdkVersion(const android::StringPiece& str);
/*
* Returns a Reference, or None Maybe instance if the string `str` was parsed as
@@ -116,7 +114,8 @@
* ?[package:]style/<entry> or
* <package>:[style/]<entry>
*/
-Maybe<Reference> ParseStyleParentReference(const android::StringPiece& str, std::string* out_error);
+std::optional<Reference> ParseStyleParentReference(const android::StringPiece& str,
+ std::string* out_error);
/*
* Returns a Reference if the string `str` was parsed as a valid XML attribute
@@ -125,7 +124,7 @@
*
* package:entry
*/
-Maybe<Reference> ParseXmlAttributeName(const android::StringPiece& str);
+std::optional<Reference> ParseXmlAttributeName(const android::StringPiece& str);
/*
* Returns a Reference object if the string was parsed as a resource or