AAPT2: Remove usage of u16string
For legacy reasons, we kept around the use of UTF-16 internally
in AAPT2. We don't need this and this CL removes all instances of
std::u16string and StringPiece16. The only places still needed
are when interacting with the ResTable APIs that only operate in
UTF16.
Change-Id: I492475b84bb9014fa13bf992cff447ee7a5fe588
diff --git a/tools/aapt2/compile/Compile.cpp b/tools/aapt2/compile/Compile.cpp
index 5d11c40..39e4489 100644
--- a/tools/aapt2/compile/Compile.cpp
+++ b/tools/aapt2/compile/Compile.cpp
@@ -43,8 +43,8 @@
struct ResourcePathData {
Source source;
- std::u16string resourceDir;
- std::u16string name;
+ std::string resourceDir;
+ std::string name;
std::string extension;
// Original config str. We keep this because when we parse the config, we may add on
@@ -96,8 +96,8 @@
return ResourcePathData{
Source(path),
- util::utf8ToUtf16(dirStr),
- util::utf8ToUtf16(name),
+ dirStr.toString(),
+ name.toString(),
extension.toString(),
configStr.toString(),
config
@@ -127,7 +127,7 @@
}
static bool isHidden(const StringPiece& filename) {
- return util::stringStartsWith<char>(filename, ".");
+ return util::stringStartsWith(filename, ".");
}
/**
@@ -200,7 +200,7 @@
parserOptions.errorOnPositionalArguments = !options.legacyMode;
// If the filename includes donottranslate, then the default translatable is false.
- parserOptions.translatable = pathData.name.find(u"donottranslate") == std::string::npos;
+ parserOptions.translatable = pathData.name.find("donottranslate") == std::string::npos;
ResourceParser resParser(context->getDiagnostics(), &table, pathData.source,
pathData.config, parserOptions);
@@ -440,8 +440,8 @@
return nullptr;
}
- const std::u16string& getCompilationPackage() override {
- static std::u16string empty;
+ const std::string& getCompilationPackage() override {
+ static std::string empty;
return empty;
}
@@ -530,7 +530,7 @@
context.getDiagnostics()->note(DiagMessage(pathData.source) << "processing");
}
- if (pathData.resourceDir == u"values") {
+ if (pathData.resourceDir == "values") {
// Overwrite the extension.
pathData.extension = "arsc";