diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-08-19 12:16:49 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-08-19 13:29:40 -0700 |
commit | 8197cc460e02c6445434eace435e3d38ebe475c6 (patch) | |
tree | 4d3a76e6bf511d3f6ef331fc9dcd89ebf1ebd0fe /tools/aapt2/Resource.h | |
parent | aa0255da28675431c93593a8dd2d225538cbb3ac (diff) |
AAPT2: Merge Styleables instead of overriding them
Styleables merge in AAPT. Preserve this behavior.
Bug:30970091
Change-Id: Ie68ca675aeecd873c0648682182e2fc574e329a0
Diffstat (limited to 'tools/aapt2/Resource.h')
-rw-r--r-- | tools/aapt2/Resource.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h index 09a04e0f2afb..2969b8ccbc40 100644 --- a/tools/aapt2/Resource.h +++ b/tools/aapt2/Resource.h @@ -82,6 +82,8 @@ struct ResourceName { ResourceName() : type(ResourceType::kRaw) {} ResourceName(const StringPiece& p, ResourceType t, const StringPiece& e); + int compare(const ResourceName& other) const; + bool isValid() const; std::string toString() const; }; @@ -258,6 +260,15 @@ inline ResourceName::ResourceName(const StringPiece& p, ResourceType t, const St package(p.toString()), type(t), entry(e.toString()) { } +inline int ResourceName::compare(const ResourceName& other) const { + int cmp = package.compare(other.package); + if (cmp != 0) return cmp; + cmp = static_cast<int>(type) - static_cast<int>(other.type); + if (cmp != 0) return cmp; + cmp = entry.compare(other.entry); + return cmp; +} + inline bool ResourceName::isValid() const { return !package.empty() && !entry.empty(); } |