diff options
author | Bernard Normier <bernard@zeroc.com> | 2008-01-09 15:35:52 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2008-01-09 15:35:52 -0500 |
commit | 344c8faef1486841fdccdf088aa706404117d016 (patch) | |
tree | 914aa55b8d59e993aa543090bbc50e0dc0cb6b10 /cpp/demo/Ice/converter/Client.cpp | |
parent | MCPP_RPATH_LINK addition (diff) | |
download | ice-344c8faef1486841fdccdf088aa706404117d016.tar.bz2 ice-344c8faef1486841fdccdf088aa706404117d016.tar.xz ice-344c8faef1486841fdccdf088aa706404117d016.zip |
Removed dependency on IceUtil/StringUtil.h (escapeString)
Diffstat (limited to 'cpp/demo/Ice/converter/Client.cpp')
-rw-r--r-- | cpp/demo/Ice/converter/Client.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/cpp/demo/Ice/converter/Client.cpp b/cpp/demo/Ice/converter/Client.cpp index a32ef58f731..d7c50184ad2 100644 --- a/cpp/demo/Ice/converter/Client.cpp +++ b/cpp/demo/Ice/converter/Client.cpp @@ -8,7 +8,6 @@ // ********************************************************************** #include <IceUtil/IceUtil.h> -#include <IceUtil/StringUtil.h> #include <Ice/Ice.h> #include <Echo.h> #include <StringConverterI.h> @@ -28,6 +27,24 @@ menu() "?: help\n"; } +string decodeString(const string& str) +{ + ostringstream result; + for(string::const_iterator p = str.begin(); p != str.end(); ++p) + { + if(isprint(*p)) + { + result << *p; + } + else + { + result << "\\" + << oct << (unsigned int)(unsigned char)(*p); + } + } + return result.str(); +} + int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator1, const Ice::CommunicatorPtr& communicator2) { @@ -66,12 +83,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator1, const Ice if(c == 't') { string ret = echo1->echoString(greeting); - cout << "Received (LATIN-1): \"" << IceUtilInternal::escapeString(ret, "") << '\"' << endl; + cout << "Received: \"" << decodeString(ret) << '\"' << endl; } else if(c == 'u') { string ret = echo2->echoString(greeting); - cout << "Received (LATIN-1): \"" << IceUtilInternal::escapeString(ret, "") << '\"' << endl; + cout << "Received: \"" << decodeString(ret) << '\"' << endl; } else if(c == 's') { |