diff options
author | 2017-11-08 00:20:40 +0000 | |
---|---|---|
committer | 2017-11-08 00:20:40 +0000 | |
commit | 2dd3953ae00068a71da9f0a0d4e2fb9d8517424c (patch) | |
tree | 4b345841dfdcf6e51b6636292efb3f7aa4c3123a /tools/aapt2/Resource.cpp | |
parent | f450f6dfe43daf1c06c54f32feb5aae7b453710c (diff) | |
parent | 93190b79d11d874199cfe7258526a48cfc8399fc (diff) |
Merge "AAPT2: Better debugging output"
Diffstat (limited to 'tools/aapt2/Resource.cpp')
-rw-r--r-- | tools/aapt2/Resource.cpp | 25 |
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"; |