From 70802b63320582f0afa8229659ea9fe4a21d02ec Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 13 Jul 2012 00:18:06 +0200 Subject: WinRT support --- cpp/src/Ice/Exception.cpp | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'cpp/src/Ice/Exception.cpp') diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 04ac02bfad3..7f070b537c5 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -12,12 +12,35 @@ #include #include #include +#ifdef ICE_OS_WINRT +# include +#endif #include using namespace std; using namespace Ice; using namespace IceInternal; +namespace +{ + +inline string +socketErrorToString(int error) +{ + if(error == 0) + { + return "unknown error"; + } +#ifdef ICE_OS_WINRT + return IceUtil::wstringToString( + static_cast(error).ToString()->Data()); +#else + return IceUtilInternal::errorToString(error); +#endif +} + +}; + namespace IceInternal { @@ -283,15 +306,7 @@ void Ice::SocketException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nsocket exception: "; - if(error == 0) - { - out << "unknown error"; - } - else - { - out << IceUtilInternal::errorToString(error); - } + out << ":\nsocket exception: " << socketErrorToString(error); } void @@ -317,14 +332,14 @@ void Ice::ConnectFailedException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nconnect failed: " << IceUtilInternal::errorToString(error); + out << ":\nconnect failed: " << socketErrorToString(error); } void Ice::ConnectionRefusedException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nconnection refused: " << IceUtilInternal::errorToString(error); + out << ":\nconnection refused: " << socketErrorToString(error); } void @@ -338,7 +353,7 @@ Ice::ConnectionLostException::ice_print(ostream& out) const } else { - out << IceUtilInternal::errorToString(error); + out << socketErrorToString(error); } } @@ -346,7 +361,13 @@ void Ice::DNSException::ice_print(ostream& out) const { Exception::ice_print(out); - out << ":\nDNS error: " << errorToStringDNS(error) << "\nhost: " << host; + out << ":\nDNS error: "; +#ifdef ICE_OS_WINRT + out << socketErrorToString(error); +#else + out << errorToStringDNS(error); +#endif + out << "\nhost: " << host; } void -- cgit v1.2.3