From d5083f6f6b9bc76bbe64052bcec639eee752a321 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Mon, 16 Jan 2017 15:07:21 -0800 Subject: Move StringPiece to libandroidfw libandroidfw needs to make use of StringPiece, so move it to libandroidfw and update all code referencing StringPiece in aapt2. Test: make libandroidfw_tests libaapt2_tests Change-Id: I68d7f0fc7c651b048d9d1f5e7971f10ef5349fa1 --- tools/aapt2/Resource.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tools/aapt2/Resource.h') diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h index 13330b548d2c..1950ea35a652 100644 --- a/tools/aapt2/Resource.h +++ b/tools/aapt2/Resource.h @@ -24,11 +24,11 @@ #include #include +#include "androidfw/StringPiece.h" #include "utils/JenkinsHash.h" #include "ConfigDescription.h" #include "Source.h" -#include "util/StringPiece.h" namespace aapt { @@ -63,13 +63,13 @@ enum class ResourceType { kXml, }; -StringPiece ToString(ResourceType type); +android::StringPiece ToString(ResourceType type); /** * Returns a pointer to a valid ResourceType, or nullptr if * the string was invalid. */ -const ResourceType* ParseResourceType(const StringPiece& str); +const ResourceType* ParseResourceType(const android::StringPiece& str); /** * A resource's name. This can uniquely identify @@ -81,7 +81,7 @@ struct ResourceName { std::string entry; ResourceName() = default; - ResourceName(const StringPiece& p, ResourceType t, const StringPiece& e); + ResourceName(const android::StringPiece& p, ResourceType t, const android::StringPiece& e); int compare(const ResourceName& other) const; @@ -96,15 +96,15 @@ struct ResourceName { * of the original string. */ struct ResourceNameRef { - StringPiece package; + android::StringPiece package; ResourceType type = ResourceType::kRaw; - StringPiece entry; + android::StringPiece entry; ResourceNameRef() = default; ResourceNameRef(const ResourceNameRef&) = default; ResourceNameRef(ResourceNameRef&&) = default; ResourceNameRef(const ResourceName& rhs); // NOLINT(implicit) - ResourceNameRef(const StringPiece& p, ResourceType t, const StringPiece& e); + ResourceNameRef(const android::StringPiece& p, ResourceType t, const android::StringPiece& e); ResourceNameRef& operator=(const ResourceNameRef& rhs) = default; ResourceNameRef& operator=(ResourceNameRef&& rhs) = default; ResourceNameRef& operator=(const ResourceName& rhs); @@ -258,9 +258,9 @@ inline ::std::ostream& operator<<(::std::ostream& out, // ResourceName implementation. // -inline ResourceName::ResourceName(const StringPiece& p, ResourceType t, - const StringPiece& e) - : package(p.ToString()), type(t), entry(e.ToString()) {} +inline ResourceName::ResourceName(const android::StringPiece& p, ResourceType t, + const android::StringPiece& e) + : package(p.to_string()), type(t), entry(e.to_string()) {} inline int ResourceName::compare(const ResourceName& other) const { int cmp = package.compare(other.package); @@ -311,8 +311,8 @@ inline std::string ResourceName::ToString() const { inline ResourceNameRef::ResourceNameRef(const ResourceName& rhs) : package(rhs.package), type(rhs.type), entry(rhs.entry) {} -inline ResourceNameRef::ResourceNameRef(const StringPiece& p, ResourceType t, - const StringPiece& e) +inline ResourceNameRef::ResourceNameRef(const android::StringPiece& p, ResourceType t, + const android::StringPiece& e) : package(p), type(t), entry(e) {} inline ResourceNameRef& ResourceNameRef::operator=(const ResourceName& rhs) { -- cgit v1.2.3-59-g8ed1b