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/java/ManifestClassGenerator.cpp b/tools/aapt2/java/ManifestClassGenerator.cpp
index 09ea03b..a0db41b 100644
--- a/tools/aapt2/java/ManifestClassGenerator.cpp
+++ b/tools/aapt2/java/ManifestClassGenerator.cpp
@@ -19,19 +19,17 @@
#include <algorithm>
#include "Source.h"
-#include "java/AnnotationProcessor.h"
#include "java/ClassDefinition.h"
#include "java/JavaClassGenerator.h"
#include "text/Unicode.h"
-#include "util/Maybe.h"
#include "xml/XmlDom.h"
using ::aapt::text::IsJavaIdentifier;
namespace aapt {
-static Maybe<std::string> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source,
- const std::string& value) {
+static std::optional<std::string> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source,
+ const std::string& value) {
std::string result = value;
size_t pos = value.rfind('.');
if (pos != std::string::npos) {
@@ -63,7 +61,7 @@
return false;
}
- Maybe<std::string> result =
+ std::optional<std::string> result =
ExtractJavaIdentifier(diag, source.WithLine(el->line_number), attr->value);
if (!result) {
return false;