diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-08-01 10:09:48 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-08-01 10:09:48 -0400 |
commit | 4aa7ae5129a9cb66f5ea26165310e96603af576c (patch) | |
tree | f8ee6859ad547b59cc28eadb1212f403f51dfff7 /cpp/test | |
parent | Do not initialize OpenSSL locks if already done by other library. (diff) | |
download | ice-4aa7ae5129a9cb66f5ea26165310e96603af576c.tar.bz2 ice-4aa7ae5129a9cb66f5ea26165310e96603af576c.tar.xz ice-4aa7ae5129a9cb66f5ea26165310e96603af576c.zip |
Move StringConverter API to namespace Ice
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Ice/custom/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/custom/Collocated.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/custom/Server.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/custom/ServerAMD.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/custom/StringConverterI.cpp | 10 | ||||
-rw-r--r-- | cpp/test/Ice/custom/StringConverterI.h | 14 | ||||
-rw-r--r-- | cpp/test/Ice/logger/Client2.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/logger/Client4.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/stringConverter/Client.cpp | 28 | ||||
-rw-r--r-- | cpp/test/Ice/stringConverter/Server.cpp | 8 | ||||
-rw-r--r-- | cpp/test/IceGrid/deployer/Server.cpp | 6 | ||||
-rw-r--r-- | cpp/test/IceUtil/stacktrace/Client.cpp | 8 | ||||
-rw-r--r-- | cpp/test/IceUtil/unicode/Client.cpp | 22 | ||||
-rw-r--r-- | cpp/test/uwp/MainPage.xaml.cpp | 14 |
14 files changed, 67 insertions, 67 deletions
diff --git a/cpp/test/Ice/custom/Client.cpp b/cpp/test/Ice/custom/Client.cpp index 06cb8042fef..0ab1c20d832 100644 --- a/cpp/test/Ice/custom/Client.cpp +++ b/cpp/test/Ice/custom/Client.cpp @@ -37,8 +37,8 @@ main(int argc, char** argv) try { - IceUtil::setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); - IceUtil::setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); + setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); + setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); communicator = Ice::initialize(argc, argv); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/custom/Collocated.cpp b/cpp/test/Ice/custom/Collocated.cpp index 5f17fb0c7e4..6eda30c718a 100644 --- a/cpp/test/Ice/custom/Collocated.cpp +++ b/cpp/test/Ice/custom/Collocated.cpp @@ -43,8 +43,8 @@ main(int argc, char** argv) try { - IceUtil::setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); - IceUtil::setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); + setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); + setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); communicator = Ice::initialize(argc, argv); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/custom/Server.cpp b/cpp/test/Ice/custom/Server.cpp index be7e8adf81b..c6361f7c0c5 100644 --- a/cpp/test/Ice/custom/Server.cpp +++ b/cpp/test/Ice/custom/Server.cpp @@ -44,8 +44,8 @@ main(int argc, char** argv) try { - IceUtil::setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); - IceUtil::setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); + setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); + setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); communicator = Ice::initialize(argc, argv); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/custom/ServerAMD.cpp b/cpp/test/Ice/custom/ServerAMD.cpp index 954a2035ab2..c64aca0aac4 100644 --- a/cpp/test/Ice/custom/ServerAMD.cpp +++ b/cpp/test/Ice/custom/ServerAMD.cpp @@ -44,8 +44,8 @@ main(int argc, char** argv) try { - IceUtil::setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); - IceUtil::setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); + setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); + setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); communicator = Ice::initialize(argc, argv); status = run(argc, argv, communicator); diff --git a/cpp/test/Ice/custom/StringConverterI.cpp b/cpp/test/Ice/custom/StringConverterI.cpp index f86f1e54bed..5ac09fcf2e6 100644 --- a/cpp/test/Ice/custom/StringConverterI.cpp +++ b/cpp/test/Ice/custom/StringConverterI.cpp @@ -10,10 +10,10 @@ #include <StringConverterI.h> using namespace std; -using namespace IceUtil; +using namespace Ice; Byte* -Test::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, IceUtil::UTF8Buffer& buffer) const +Test::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, UTF8Buffer& buffer) const { size_t size = static_cast<size_t>(sourceEnd - sourceStart); Byte* targetStart = buffer.getMoreBytes(size, 0); @@ -44,10 +44,10 @@ Test::StringConverterI::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, Byte* -Test::WstringConverterI::toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd, IceUtil::UTF8Buffer& buffer) const +Test::WstringConverterI::toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd, UTF8Buffer& buffer) const { wstring ws(sourceStart, sourceEnd); - string s = IceUtil::wstringToString(ws); + string s = wstringToString(ws); size_t size = s.size(); Byte* targetStart = buffer.getMoreBytes(size, 0); @@ -75,6 +75,6 @@ Test::WstringConverterI::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd s[i] = sourceStart[--j]; } - target = IceUtil::stringToWstring(s); + target = stringToWstring(s); } diff --git a/cpp/test/Ice/custom/StringConverterI.h b/cpp/test/Ice/custom/StringConverterI.h index f50e7f74fb8..bf52bbb0f36 100644 --- a/cpp/test/Ice/custom/StringConverterI.h +++ b/cpp/test/Ice/custom/StringConverterI.h @@ -10,7 +10,7 @@ #ifndef STRING_CONVERTER_I_H #define STRING_CONVERTER_I_H -#include <IceUtil/StringConverter.h> +#include <Ice/StringConverter.h> // // Simple contrived string converters which simply reverse the order of the @@ -20,21 +20,21 @@ namespace Test { -class StringConverterI : public IceUtil::StringConverter +class StringConverterI : public Ice::StringConverter { public: - virtual IceUtil::Byte* toUTF8(const char*, const char*, IceUtil::UTF8Buffer&) const; - virtual void fromUTF8(const IceUtil::Byte* sourceStart, const IceUtil::Byte* sourceEnd, + virtual Ice::Byte* toUTF8(const char*, const char*, Ice::UTF8Buffer&) const; + virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, std::string& target) const; }; -class WstringConverterI : public IceUtil::WstringConverter +class WstringConverterI : public Ice::WstringConverter { public: - virtual IceUtil::Byte* toUTF8(const wchar_t*, const wchar_t*, IceUtil::UTF8Buffer&) const; - virtual void fromUTF8(const IceUtil::Byte* sourceStart, const IceUtil::Byte* sourceEnd, + virtual Ice::Byte* toUTF8(const wchar_t*, const wchar_t*, Ice::UTF8Buffer&) const; + virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, std::wstring& target) const; }; diff --git a/cpp/test/Ice/logger/Client2.cpp b/cpp/test/Ice/logger/Client2.cpp index d893e899ee6..24255c71566 100644 --- a/cpp/test/Ice/logger/Client2.cpp +++ b/cpp/test/Ice/logger/Client2.cpp @@ -42,9 +42,9 @@ main(int argc, char* argv[]) // 28605 == ISO 8859-15 codepage // SetConsoleOutputCP(28605); - IceUtil::setProcessStringConverter(IceUtil::createWindowsStringConverter(1250)); + setProcessStringConverter(Ice::createWindowsStringConverter(1250)); #else - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>("ISO8859-15")); + setProcessStringConverter(Ice::createIconvStringConverter<char>("ISO8859-15")); #endif Ice::InitializationData id; id.properties = Ice::createProperties(); diff --git a/cpp/test/Ice/logger/Client4.cpp b/cpp/test/Ice/logger/Client4.cpp index a8307816269..bce810c457f 100644 --- a/cpp/test/Ice/logger/Client4.cpp +++ b/cpp/test/Ice/logger/Client4.cpp @@ -41,9 +41,9 @@ main(int argc, char* argv[]) // int cp = GetConsoleOutputCP(); SetConsoleOutputCP(CP_UTF8); - IceUtil::setProcessStringConverter(IceUtil::createWindowsStringConverter(28605)); + setProcessStringConverter(Ice::createWindowsStringConverter(28605)); #else - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>("ISO8859-15")); + setProcessStringConverter(Ice::createIconvStringConverter<char>("ISO8859-15")); #endif Ice::InitializationData id; id.properties = Ice::createProperties(); diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index 6593f7f818f..e0f82d4130b 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -48,19 +48,19 @@ main(int argc, char* argv[]) // // 28605 == ISO 8859-15 codepage // - IceUtil::setProcessStringConverter(IceUtil::createWindowsStringConverter(28605)); + setProcessStringConverter(Ice::createWindowsStringConverter(28605)); useIconv = false; #elif defined(__hpux) if(useLocale) { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>); + setProcessStringConverter(Ice::createIconvStringConverter<char>); } else { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>("iso815")); + setProcessStringConverter(Ice::createIconvStringConverter<char>("iso815")); } - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("ucs4")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("ucs4")); #elif defined(_AIX) @@ -68,46 +68,46 @@ main(int argc, char* argv[]) if(useLocale) { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>()); + setProcessStringConverter(Ice::createIconvStringConverter<char>()); } else { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>("ISO8859-15")); + setProcessStringConverter(Ice::createIconvStringConverter<char>("ISO8859-15")); } if(sizeof(wchar_t) == 4) { - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-32")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-32")); } else { - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-16")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-16")); } #else if(useLocale) { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>()); + setProcessStringConverter(Ice::createIconvStringConverter<char>()); } else { - IceUtil::setProcessStringConverter(IceUtil::createIconvStringConverter<char>("ISO8859-15")); + setProcessStringConverter(Ice::createIconvStringConverter<char>("ISO8859-15")); } if(sizeof(wchar_t) == 4) { # ifdef ICE_BIG_ENDIAN - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-32BE")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-32BE")); # else - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-32LE")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-32LE")); # endif } else { # ifdef ICE_BIG_ENDIAN - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-16BE")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-16BE")); # else - IceUtil::setProcessWstringConverter(IceUtil::createIconvStringConverter<wchar_t>("UTF-16LE")); + setProcessWstringConverter(Ice::createIconvStringConverter<wchar_t>("UTF-16LE")); # endif } #endif diff --git a/cpp/test/Ice/stringConverter/Server.cpp b/cpp/test/Ice/stringConverter/Server.cpp index 3e3b6e17541..e82f6caf0ab 100644 --- a/cpp/test/Ice/stringConverter/Server.cpp +++ b/cpp/test/Ice/stringConverter/Server.cpp @@ -24,14 +24,14 @@ public: virtual wstring widen(ICE_IN(string) msg, const Ice::Current&) { - return IceUtil::stringToWstring(msg, IceUtil::getProcessStringConverter(), - IceUtil::getProcessWstringConverter()); + return stringToWstring(msg, Ice::getProcessStringConverter(), + Ice::getProcessWstringConverter()); } virtual string narrow(ICE_IN(wstring) wmsg, const Ice::Current&) { - return IceUtil::wstringToString(wmsg, IceUtil::getProcessStringConverter(), - IceUtil::getProcessWstringConverter()); + return wstringToString(wmsg, Ice::getProcessStringConverter(), + Ice::getProcessWstringConverter()); } virtual void shutdown(const Ice::Current& current) diff --git a/cpp/test/IceGrid/deployer/Server.cpp b/cpp/test/IceGrid/deployer/Server.cpp index 5c5f6f821db..1e18105beb7 100644 --- a/cpp/test/IceGrid/deployer/Server.cpp +++ b/cpp/test/IceGrid/deployer/Server.cpp @@ -80,13 +80,13 @@ main(int argc, char* argv[]) #if defined(_WIN32) wchar_t* value2 = _wgetenv(L"MY_ENV_UNICODE_VARIABLE"); - test(value2 != 0 && wstring(value2) == IceUtil::stringToWstring(unicodeVar)); + test(value2 != 0 && wstring(value2) == Ice::stringToWstring(unicodeVar)); - wchar_t* value3 = _wgetenv(IceUtil::stringToWstring(varname1).c_str()); + wchar_t* value3 = _wgetenv(Ice::stringToWstring(varname1).c_str()); test(value3 != 0 && wstring(value3) == L"2"); // Environment variables are case insensitive on Windows. - wchar_t* value4 = _wgetenv(IceUtil::stringToWstring(varname1).c_str()); + wchar_t* value4 = _wgetenv(Ice::stringToWstring(varname1).c_str()); test(value4 != 0 && wstring(value4) == L"2"); char* value5 = getenv("MY_WINDOWS_COMPOSED_VARIABLE"); diff --git a/cpp/test/IceUtil/stacktrace/Client.cpp b/cpp/test/IceUtil/stacktrace/Client.cpp index e1baffabb6d..503d83ccdcf 100644 --- a/cpp/test/IceUtil/stacktrace/Client.cpp +++ b/cpp/test/IceUtil/stacktrace/Client.cpp @@ -73,7 +73,7 @@ getIceHome() { vector<wchar_t> buf(256); DWORD ret = GetEnvironmentVariableW(L"ICE_HOME", &buf[0], static_cast<DWORD>(buf.size())); - string iceHome = (ret > 0 && ret < buf.size()) ? IceUtil::wstringToString(&buf[0]) : string(""); + string iceHome = (ret > 0 && ret < buf.size()) ? wstringToString(&buf[0]) : string(""); if(!iceHome.empty()) { return iceHome; @@ -83,7 +83,7 @@ getIceHome() HKEY hKey; string key = string("SOFTWARE\\ZeroC\\Ice ") + ICE_STRING_VERSION; - const wstring keyName = IceUtil::stringToWstring(key); + const wstring keyName = stringToWstring(key); if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName.c_str(), 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) { @@ -96,7 +96,7 @@ getIceHome() { return ""; } - return IceUtil::wstringToString(wstring(buf)); + return wstringToString(wstring(buf)); } } #endif @@ -151,7 +151,7 @@ int main(int argc, char* argv[]) bool binDist = false; vector<wchar_t> buf(256); DWORD ret = GetEnvironmentVariableW(L"USE_BIN_DIST", &buf[0], static_cast<DWORD>(buf.size())); - string valstr = (ret > 0 && ret < buf.size()) ? IceUtil::wstringToString(&buf[0]) : string(""); + string valstr = (ret > 0 && ret < buf.size()) ? wstringToString(&buf[0]) : string(""); binDist = valstr == "yes"; if(binDist) diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index 64c8fe5f0dd..4e028ca1bd0 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -50,7 +50,7 @@ main(int argc, char* argv[]) # ifdef __MINGW32__ dir = argv[1]; # else - dir = IceUtil::wstringToString(argv[1]); + dir = wstringToString(argv[1]); # endif dir += "\\"; #else @@ -207,11 +207,11 @@ main(int argc, char* argv[]) // With UTF-16 encoding, that's 8 and the first 2 euros will use the first 6 // bytes of the initial buffer. - string ns = IceUtil::wstringToString(ws); + string ns = wstringToString(ws); const string good = "\xE2\x82\xAC\xE2\x82\xAC\xF0\x90\x90\xB7"; test(ns == good); - test(ws == IceUtil::stringToWstring(ns)); + test(ws == stringToWstring(ns)); cout << "ok" << endl; @@ -246,15 +246,15 @@ main(int argc, char* argv[]) const long iterations = 5000000; const wstring ws = L"abcdefghijklmnopqrstuvwxyz+\u20ac\u20ac\U00010437"; - const string ns = IceUtil::wstringToString(ws); - test(IceUtil::stringToWstring(ns) == ws); + const string ns = wstringToString(ws); + test(stringToWstring(ns) == ws); cout << "testing performance with " << iterations << " iterations... "; IceUtil::Time toU8 = IceUtil::Time::now(IceUtil::Time::Monotonic); for(long i = 0; i < iterations; ++i) { - test(IceUtil::wstringToString(ws) == ns); + test(wstringToString(ws) == ns); } IceUtil::Time now = IceUtil::Time::now(IceUtil::Time::Monotonic); toU8 = now - toU8; @@ -262,7 +262,7 @@ main(int argc, char* argv[]) IceUtil::Time fromU8 = now; for(long i = 0; i < iterations; ++i) { - test(IceUtil::stringToWstring(ns) == ws); + test(stringToWstring(ns) == ws); } fromU8 = IceUtil::Time::now(IceUtil::Time::Monotonic) - fromU8; @@ -295,11 +295,11 @@ main(int argc, char* argv[]) { try { - wstring ws = IceUtil::stringToWstring(badUTF8[i]); + wstring ws = stringToWstring(badUTF8[i]); wcerr << L"Unexpected: " << ws << endl; test(false); } - catch(const IceUtil::IllegalConversionException&) + catch(const IllegalConversionException&) {} } @@ -319,10 +319,10 @@ main(int argc, char* argv[]) { try { - string s = IceUtil::wstringToString(badWstring[i]); + string s = wstringToString(badWstring[i]); test(false); } - catch(const IceUtil::IllegalConversionException&) + catch(const IllegalConversionException&) {} } #endif diff --git a/cpp/test/uwp/MainPage.xaml.cpp b/cpp/test/uwp/MainPage.xaml.cpp index 75a6b07381c..3a466ebfcdd 100644 --- a/cpp/test/uwp/MainPage.xaml.cpp +++ b/cpp/test/uwp/MainPage.xaml.cpp @@ -488,7 +488,7 @@ TestRunner::printToConsoleOutput(const std::string& message) for(vector<string>::const_iterator i = lines.begin(); i != lines.end(); ++i) { - _page->printToConsoleOutput(ref new String(IceUtil::stringToWstring(*i).c_str()), i != lines.begin()); + _page->printToConsoleOutput(ref new String(Ice::stringToWstring(*i).c_str()), i != lines.begin()); } } @@ -564,15 +564,15 @@ TestRunner::run() } catch (Test::Common::ServerFailedException& ex) { - _page->failed(ref new String(IceUtil::stringToWstring("Server failed to start:\n\n" + ex.reason).c_str())); + _page->failed(ref new String(Ice::stringToWstring("Server failed to start:\n\n" + ex.reason).c_str())); } catch(const std::exception& ex) { - _page->failed(ref new String(IceUtil::stringToWstring(ex.what()).c_str())); + _page->failed(ref new String(Ice::stringToWstring(ex.what()).c_str())); } catch(const string& ex) { - _page->failed(ref new String(IceUtil::stringToWstring(ex).c_str())); + _page->failed(ref new String(Ice::stringToWstring(ex).c_str())); } catch(...) { @@ -776,7 +776,7 @@ DllCache::loadDll(const std::string& name) { return p->second; } - HINSTANCE hnd = LoadPackagedLibrary(IceUtil::stringToWstring(name).c_str(), 0); + HINSTANCE hnd = LoadPackagedLibrary(Ice::stringToWstring(name).c_str(), 0); _dlls.insert(make_pair(name, hnd)); return hnd; @@ -929,7 +929,7 @@ MainPage::runSelectedTest() config.ipv6 = _ipv6->IsChecked->Value; config.server = selectedLanguage(); - config.host = IceUtil::wstringToString(_host->Text->Data()); + config.host = Ice::wstringToString(_host->Text->Data()); TestRunnerPtr t = new TestRunner(_allTests[_tests->SelectedIndex], config, this, communicator(), _dlls); t->start(); @@ -944,7 +944,7 @@ TestSuite::MainPage::initializeSupportedTests() for(vector<TestCasePtr>::const_iterator i = _allTests.begin(); i != _allTests.end(); ++i) { TestCasePtr test = *i; - _names->Append(ref new String(IceUtil::stringToWstring(test->name).c_str())); + _names->Append(ref new String(Ice::stringToWstring(test->name).c_str())); } _tests->SelectedIndex = 0; } |