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/StringPool.h b/tools/aapt2/StringPool.h
index 5f88543..72ae9d1 100644
--- a/tools/aapt2/StringPool.h
+++ b/tools/aapt2/StringPool.h
@@ -30,13 +30,13 @@
namespace aapt {
struct Span {
- std::u16string name;
+ std::string name;
uint32_t firstChar;
uint32_t lastChar;
};
struct StyleString {
- std::u16string str;
+ std::string str;
std::vector<Span> spans;
};
@@ -56,8 +56,8 @@
~Ref();
Ref& operator=(const Ref& rhs);
- const std::u16string* operator->() const;
- const std::u16string& operator*() const;
+ const std::string* operator->() const;
+ const std::string& operator*() const;
size_t getIndex() const;
const Context& getContext() const;
@@ -95,7 +95,7 @@
class Entry {
public:
- std::u16string value;
+ std::string value;
Context context;
size_t index;
@@ -136,14 +136,14 @@
* Adds a string to the pool, unless it already exists. Returns
* a reference to the string in the pool.
*/
- Ref makeRef(const StringPiece16& str);
+ Ref makeRef(const StringPiece& str);
/**
* Adds a string to the pool, unless it already exists, with a context
* object that can be used when sorting the string pool. Returns
* a reference to the string in the pool.
*/
- Ref makeRef(const StringPiece16& str, const Context& context);
+ Ref makeRef(const StringPiece& str, const Context& context);
/**
* Adds a style to the string pool and returns a reference to it.
@@ -195,11 +195,11 @@
static bool flatten(BigBuffer* out, const StringPool& pool, bool utf8);
- Ref makeRefImpl(const StringPiece16& str, const Context& context, bool unique);
+ Ref makeRefImpl(const StringPiece& str, const Context& context, bool unique);
std::vector<std::unique_ptr<Entry>> mStrings;
std::vector<std::unique_ptr<StyleEntry>> mStyles;
- std::unordered_multimap<StringPiece16, Entry*> mIndexedStrings;
+ std::unordered_multimap<StringPiece, Entry*> mIndexedStrings;
};
//