diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-07-18 11:27:58 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-07-18 11:27:58 -0400 |
commit | 0eb13ae23f4d69a73651a762d146c7d7408fbecc (patch) | |
tree | 261955664407de08b5b0e09af24f841ad4e5541f | |
parent | build fix (diff) | |
download | ice-0eb13ae23f4d69a73651a762d146c7d7408fbecc.tar.bz2 ice-0eb13ae23f4d69a73651a762d146c7d7408fbecc.tar.xz ice-0eb13ae23f4d69a73651a762d146c7d7408fbecc.zip |
Added default ctor
-rw-r--r-- | cpp/include/Ice/IconvStringConverter.h | 16 | ||||
-rw-r--r-- | cpp/test/Ice/stringConverter/Client.cpp | 20 |
2 files changed, 28 insertions, 8 deletions
diff --git a/cpp/include/Ice/IconvStringConverter.h b/cpp/include/Ice/IconvStringConverter.h index 7070f9eb378..e8b401dff68 100644 --- a/cpp/include/Ice/IconvStringConverter.h +++ b/cpp/include/Ice/IconvStringConverter.h @@ -15,6 +15,10 @@ #include <algorithm> #include <iconv.h> +#ifndef _WIN32 +#include <langinfo.h> +#endif + #if defined(_LIBICONV_VERSION) || (defined(__sun) && !defined(_XPG6)) // // See http://sourceware.org/bugzilla/show_bug.cgi?id=2962 @@ -44,14 +48,17 @@ class IconvStringConverter : public Ice::BasicStringConverter<charT> { public: - IconvStringConverter(const char* internalCode); +#ifdef _WIN32 + IconvStringConverter(const char*); +#else + IconvStringConverter(const char* = nl_langinfo(CODESET)); +#endif virtual ~IconvStringConverter(); - virtual Ice::Byte* toUTF8(const charT* sourceStart, const charT* sourceEnd, Ice::UTF8Buffer& buf) const; + virtual Ice::Byte* toUTF8(const charT*, const charT*, Ice::UTF8Buffer&) const; - virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd, - std::basic_string<charT>& target) const; + virtual void fromUTF8(const Ice::Byte*, const Ice::Byte*, std::basic_string<charT>&) const; private: @@ -66,7 +73,6 @@ private: #else mutable pthread_key_t _key; #endif - const char* _internalCode; }; diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index f7355aef4c1..67767701e80 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -12,6 +12,7 @@ #include <Test.h> #include <Ice/IconvStringConverter.h> #include <iostream> +#include <locale.h> using namespace std; @@ -51,14 +52,27 @@ int main(int argc, char* argv[]) { Client app; - + + // + // Switch to French locale + // (we just used the codeset for as default internal code for + // initData.stringConverter below) + // + setlocale(LC_ALL, "fr_FR.ISO8859-15"); + Ice::InitializationData initData; #if defined(__hpux) initData.stringConverter = new Ice::IconvStringConverter<char>("iso815"); initData.wstringConverter = new Ice::IconvStringConverter<wchar_t>("ucs4"); -#else - initData.stringConverter = new Ice::IconvStringConverter<char>("ISO-8859-15"); +#else + +#ifdef _WIN32 + initData.stringConverter = new Ice::IconvStringConverter<char>("ISO8859-15"); +#else + initData.stringConverter = new Ice::IconvStringConverter<char>; +#endif + if(sizeof(wchar_t) == 4) { #ifdef ICE_BIG_ENDIAN |