From 93190b79d11d874199cfe7258526a48cfc8399fc Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 3 Nov 2017 15:20:17 -0700 Subject: AAPT2: Better debugging output Test: make aapt2_tests Change-Id: I7778b773201381538dc1f2e376abee4eb33e44c0 --- tools/aapt2/Resource.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tools/aapt2/Resource.cpp') diff --git a/tools/aapt2/Resource.cpp b/tools/aapt2/Resource.cpp index a9f5f298e019..b78f48ce7f17 100644 --- a/tools/aapt2/Resource.cpp +++ b/tools/aapt2/Resource.cpp @@ -17,13 +17,34 @@ #include "Resource.h" #include +#include #include -using android::StringPiece; +#include "android-base/stringprintf.h" + +using ::android::StringPiece; +using ::android::base::StringPrintf; namespace aapt { -StringPiece ToString(ResourceType type) { +std::string ResourceId::to_string() const { + return StringPrintf("0x%08x", id); +} + +std::string ResourceName::to_string() const { + return ResourceNameRef(*this).to_string(); +} + +std::string ResourceNameRef::to_string() const { + std::ostringstream str_stream; + if (!package.empty()) { + str_stream << package << ":"; + } + str_stream << type << "/" << entry; + return str_stream.str(); +} + +StringPiece to_string(ResourceType type) { switch (type) { case ResourceType::kAnim: return "anim"; -- cgit v1.2.3-59-g8ed1b