Added: #1440 Raw data to string

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 635092b0db
commit cfb1d808cc

@ -211,7 +211,31 @@ void CStorageRaw::toString(std::ostream &ostream, const std::string &pad)
// Moo: (Foo) "What" } // Moo: (Foo) "What" }
// only increase pad when multi-lining sub-items // only increase pad when multi-lining sub-items
ostream << "(" << getClassName() << ") { "; 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 << "} "; ostream << "} ";
} }

@ -310,6 +310,7 @@ int main(int argc, char **argv)
PIPELINE::MAX::CStorageContainer ctr; PIPELINE::MAX::CStorageContainer ctr;
ctr.serial(instream); ctr.serial(instream);
ctr.toString(std::cout); ctr.toString(std::cout);
std::cout << "\n";
//ctr.dump(""); //ctr.dump("");
} }

Loading…
Cancel
Save