summaryrefslogtreecommitdiff
path: root/tools/aapt2/Resource.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-11-03 15:20:17 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-11-07 11:21:10 -0800
commit93190b79d11d874199cfe7258526a48cfc8399fc (patch)
tree3a7ae2b44c7f9693d54cdb0849e21338398de3d3 /tools/aapt2/Resource.cpp
parentb54be8de65b09c85992b30dbb1d52032f0498b6d (diff)
AAPT2: Better debugging output
Test: make aapt2_tests Change-Id: I7778b773201381538dc1f2e376abee4eb33e44c0
Diffstat (limited to 'tools/aapt2/Resource.cpp')
-rw-r--r--tools/aapt2/Resource.cpp25
1 files changed, 23 insertions, 2 deletions
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 <map>
+#include <sstream>
#include <string>
-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";