- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps. Tests were already moved by Fireball to rostests.

svn path=/trunk/; revision=26033
This commit is contained in:
Alex Ionescu 2007-03-08 19:00:15 +00:00
parent ad07a1e58f
commit 1e3d5d70e9
420 changed files with 78215 additions and 0 deletions

View file

@ -0,0 +1,49 @@
// binary2cstr.cpp
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif//_MSC_VER
#include "binary2cstr.h"
using std::string;
string binary2cstr ( const string& src )
{
string dst;
for ( int i = 0; i < src.size(); i++ )
{
char c = src[i];
switch ( c )
{
case '\n':
dst += "\\n";
break;
case '\r':
dst += "\\r";
break;
case '\t':
dst += "\\t";
break;
case '\v':
dst += "\\v";
break;
case '\"':
dst += "\x22";
break;
default:
if ( isprint ( c ) )
dst += c;
else
{
dst += "\\x";
char tmp[16];
_snprintf ( tmp, sizeof(tmp)-1, "%02X", (unsigned)(unsigned char)c );
tmp[sizeof(tmp)-1] = '\0';
dst += tmp;
}
break;
}
}
return dst;
}