summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2011-12-21 10:40:36 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-22 13:20:40 +0100
commitd868c9945a188d6ad22e0b7d6d24ac7fca00ab4e (patch)
tree0c09d67067b462a0b283fd6680e8847ebad46f8e
parentc02ca6752a1b6cb7d427e59594a600de3a46697d (diff)
Remove QT_NO_STL_WCHAR hack
We don't support gcc 2.95 any more. Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qglobal.h1
-rw-r--r--src/corelib/tools/qstring.h21
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp8
3 files changed, 4 insertions, 26 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 581bac9b0a..c60796ccf1 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -450,7 +450,6 @@ namespace QT_NAMESPACE {}
/* GCC 2.95 knows "using" but does not support it correctly */
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
# define Q_NO_USING_KEYWORD
-# define QT_NO_STL_WCHAR
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define Q_ALIGNOF(type) __alignof__(type)
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 427de85565..8f063dd1e8 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -49,12 +49,6 @@
#ifndef QT_NO_STL
# include <string>
-
-# ifndef QT_NO_STL_WCHAR
-// workaround for some headers not typedef'ing std::wstring
-typedef std::basic_string<wchar_t> QStdWString;
-# endif // QT_NO_STL_WCHAR
-
#endif // QT_NO_STL
#include <stdarg.h>
@@ -576,15 +570,8 @@ public:
#ifndef QT_NO_STL
static inline QString fromStdString(const std::string &s);
inline std::string toStdString() const;
-# ifdef qdoc
static inline QString fromStdWString(const std::wstring &s);
inline std::wstring toStdWString() const;
-# else
-# ifndef QT_NO_STL_WCHAR
- static inline QString fromStdWString(const QStdWString &s);
- inline QStdWString toStdWString() const;
-# endif // QT_NO_STL_WCHAR
-# endif // qdoc
#endif
// compatibility
@@ -1066,10 +1053,9 @@ inline std::string QString::toStdString() const
inline QString QString::fromStdString(const std::string &s)
{ return fromAscii(s.data(), int(s.size())); }
-# ifndef QT_NO_STL_WCHAR
-inline QStdWString QString::toStdWString() const
+inline std::wstring QString::toStdWString() const
{
- QStdWString str;
+ std::wstring str;
str.resize(length());
#if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -1081,9 +1067,8 @@ inline QStdWString QString::toStdWString() const
str.resize(toWCharArray(&(*str.begin())));
return str;
}
-inline QString QString::fromStdWString(const QStdWString &s)
+inline QString QString::fromStdWString(const std::wstring &s)
{ return fromWCharArray(s.data(), int(s.size())); }
-# endif
#endif
#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 80cbabeaf6..80e9984690 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -811,9 +811,6 @@ void tst_QString::constructorQByteArray()
void tst_QString::STL()
{
-#ifdef Q_CC_HPACC
- QSKIP("This test crashes on HP-UX with aCC");
-#endif
#ifndef QT_NO_STL
#ifndef QT_NO_CAST_TO_ASCII
QString qt( "QString" );
@@ -851,16 +848,13 @@ void tst_QString::STL()
QVERIFY( !stdstr3.length() );
#endif
-// Skip the rest of the test if glibc is not compiled with wide character support
-#if !(defined Q_CC_GNU && !defined _GLIBCPP_USE_WCHAR_T) && !defined QT_NO_STL_WCHAR
const wchar_t arr[] = {'h', 'e', 'l', 'l', 'o', 0};
- QStdWString stlStr = arr;
+ std::wstring stlStr = arr;
QString s = QString::fromStdWString(stlStr);
QCOMPARE(s, QString::fromLatin1("hello"));
QCOMPARE(stlStr, s.toStdWString());
-#endif
#else
QSKIP( "Not tested without STL support");
#endif