Linux fixes for UnicodeConverter

This commit is contained in:
Aleksandar Fabijanic
2012-08-02 05:01:00 +00:00
parent 416cc7a630
commit 0bcf08b3f7
4 changed files with 15 additions and 12 deletions

View File

@@ -67,9 +67,9 @@ namespace Poco {
typedef UInt32 UTF32Char;
typedef std::basic_string<UInt32> UTF32String;
#elif (__SIZEOF_WCHAR_T__ == 4)
typedef Poco::Uint16 UTF16Char;
typedef Poco::UInt16 UTF16Char;
typedef std::basic_string<UInt16> UTF16String;
typedef UInt32 UTF32Char;
typedef wchar_t UTF32Char;
typedef std::wstring UTF32String;
#endif
#else // default to 32-bit wchar_t
@@ -79,7 +79,7 @@ namespace Poco {
typedef std::wstring UTF32String;
#endif //POCO_OS_FAMILY_WINDOWS
//#endif // POCO_ENABLE_CPP11
#endif POCO_NO_WSTRING
#endif //POCO_NO_WSTRING
} // namespace Poco

View File

@@ -43,6 +43,7 @@
#include "Poco/UTF8Encoding.h"
#include "Poco/UTF16Encoding.h"
#include "Poco/UTF32Encoding.h"
#include <cstring>
namespace Poco {

View File

@@ -30,10 +30,10 @@
//
#include "Poco/UnicodeConverter.h"
#include "UnicodeConverterTest.h"
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "Poco/UnicodeConverter.h"
#include "Poco/UTFString.h"

View File

@@ -38,6 +38,8 @@
#include "Poco/Foundation.h"
#include "CppUnit/TestCase.h"
#include "Poco/UnicodeConverter.h"
#include <cstring>
class UnicodeConverterTest: public CppUnit::TestCase
@@ -63,9 +65,9 @@ private:
// Convert from UTF-8 to wide
T wtext, wtext2, wtext3;
UnicodeConverter::convert(text, wtext);
UnicodeConverter::convert((const char*) supp, strlen((const char*) supp), wtext2);
UnicodeConverter::convert((const char*) supp, wtext3);
Poco::UnicodeConverter::convert(text, wtext);
Poco::UnicodeConverter::convert((const char*) supp, strlen((const char*) supp), wtext2);
Poco::UnicodeConverter::convert((const char*) supp, wtext3);
std::string text2, text3, text4;
@@ -74,9 +76,9 @@ private:
assert (text != text4);
// Convert from wide to UTF-8
UnicodeConverter::convert(wtext, text2);
UnicodeConverter::convert(wtext2, text3);
UnicodeConverter::convert(wtext3, text4);
Poco::UnicodeConverter::convert(wtext, text2);
Poco::UnicodeConverter::convert(wtext2, text3);
Poco::UnicodeConverter::convert(wtext3, text4);
assert (text == text2);
assert (text == text3);