src/corelib/tools/qstringbuilder.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/corelib/tools/qstringbuilder.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/corelib/tools/qstringbuilder.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -41,6 +41,8 @@
 
 #include "qstringbuilder.h"
 
+QT_BEGIN_NAMESPACE
+
 /*!
     \class QLatin1Literal
     \internal
@@ -143,3 +145,25 @@
  
     Converts the \c QLatin1Literal into a \c QString object.
 */
+
+/*! \internal */
+void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out)
+{
+#ifndef QT_NO_TEXTCODEC
+    if (QString::codecForCStrings) {
+        QString tmp = QString::fromAscii(a);
+        memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());
+        out += tmp.length();
+        return;
+    }
+#endif
+    if (len == -1) {
+        while (*a)
+            *out++ = QLatin1Char(*a++);
+    } else {
+        for (int i = 0; i < len - 1; ++i)
+            *out++ = QLatin1Char(a[i]);
+    }
+}
+
+QT_END_NAMESPACE