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/util/Files.h b/tools/aapt2/util/Files.h
index 481a4cd..877cd56 100644
--- a/tools/aapt2/util/Files.h
+++ b/tools/aapt2/util/Files.h
@@ -18,6 +18,7 @@
#define AAPT_FILES_H
#include <memory>
+#include <optional>
#include <string>
#include <unordered_set>
#include <vector>
@@ -27,7 +28,6 @@
#include "utils/FileMap.h"
#include "Diagnostics.h"
-#include "Maybe.h"
#include "Source.h"
namespace aapt {
@@ -43,7 +43,7 @@
enum class FileType {
kUnknown = 0,
- kNonexistant,
+ kNonExistant,
kRegular,
kDirectory,
kCharDev,
@@ -81,7 +81,7 @@
std::string PackageToPath(const android::StringPiece& package);
// Creates a FileMap for the file at path.
-Maybe<android::FileMap> MmapPath(const std::string& path, std::string* out_error);
+std::optional<android::FileMap> MmapPath(const std::string& path, std::string* out_error);
// Reads the file at path and appends each line to the outArgList vector.
bool AppendArgsFromFile(const android::StringPiece& path, std::vector<std::string>* out_arglist,
@@ -124,8 +124,9 @@
// Returns a list of files relative to the directory identified by `path`.
// An optional FileFilter filters out any files that don't pass.
-Maybe<std::vector<std::string>> FindFiles(const android::StringPiece& path, IDiagnostics* diag,
- const FileFilter* filter = nullptr);
+std::optional<std::vector<std::string>> FindFiles(const android::StringPiece& path,
+ IDiagnostics* diag,
+ const FileFilter* filter = nullptr);
} // namespace file
} // namespace aapt