From cfb1d808cc4779b424a9bb819cae20b5c585f1b7 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 18 Aug 2012 14:20:52 +0200 Subject: [PATCH] Added: #1440 Raw data to string --HG-- branch : build_pipeline_v3 --- .../nel/tools/pipeline/max/storage_object.cpp | 26 ++++++++++++++++++- code/nel/tools/pipeline/max_dump/main.cpp | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/pipeline/max/storage_object.cpp b/code/nel/tools/pipeline/max/storage_object.cpp index 2de47052b..2b43b5a09 100644 --- a/code/nel/tools/pipeline/max/storage_object.cpp +++ b/code/nel/tools/pipeline/max/storage_object.cpp @@ -211,7 +211,31 @@ void CStorageRaw::toString(std::ostream &ostream, const std::string &pad) // Moo: (Foo) "What" } // only increase pad when multi-lining sub-items ostream << "(" << getClassName() << ") { "; - + ostream << "\n" << pad << "Size: " << Value.size(); + bool isString = true; + ostream << "\n" << pad << "String: "; + for (TType::size_type i = 0; i < Value.size(); ++i) + { + char c = Value[i]; + if (c == 0) ostream << "."; + else if (c >= 32 && c <= 126) ostream << c; + else + { + ostream << "."; + isString = false; + } + } + ostream << " "; + if (!isString) + { + ostream << "\n" << pad << "Hex: "; + for (TType::size_type i = 0; i < Value.size(); ++i) + { + std::stringstream ss; + ss << std::hex << std::setfill('0') << std::setw(2) << (int)Value[i]; + ostream << ss.str() << " "; + } + } ostream << "} "; } diff --git a/code/nel/tools/pipeline/max_dump/main.cpp b/code/nel/tools/pipeline/max_dump/main.cpp index e7669306f..5afb062c5 100644 --- a/code/nel/tools/pipeline/max_dump/main.cpp +++ b/code/nel/tools/pipeline/max_dump/main.cpp @@ -310,6 +310,7 @@ int main(int argc, char **argv) PIPELINE::MAX::CStorageContainer ctr; ctr.serial(instream); ctr.toString(std::cout); + std::cout << "\n"; //ctr.dump(""); }