src/corelib/tools/qstringbuilder.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    38 ** $QT_END_LICENSE$
    38 ** $QT_END_LICENSE$
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #include "qstringbuilder.h"
    42 #include "qstringbuilder.h"
       
    43 
       
    44 QT_BEGIN_NAMESPACE
    43 
    45 
    44 /*!
    46 /*!
    45     \class QLatin1Literal
    47     \class QLatin1Literal
    46     \internal
    48     \internal
    47     \reentrant
    49     \reentrant
   141 
   143 
   142 /*! \fn QStringBuilder::operator QString() const
   144 /*! \fn QStringBuilder::operator QString() const
   143  
   145  
   144     Converts the \c QLatin1Literal into a \c QString object.
   146     Converts the \c QLatin1Literal into a \c QString object.
   145 */
   147 */
       
   148 
       
   149 /*! \internal */
       
   150 void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out)
       
   151 {
       
   152 #ifndef QT_NO_TEXTCODEC
       
   153     if (QString::codecForCStrings) {
       
   154         QString tmp = QString::fromAscii(a);
       
   155         memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());
       
   156         out += tmp.length();
       
   157         return;
       
   158     }
       
   159 #endif
       
   160     if (len == -1) {
       
   161         while (*a)
       
   162             *out++ = QLatin1Char(*a++);
       
   163     } else {
       
   164         for (int i = 0; i < len - 1; ++i)
       
   165             *out++ = QLatin1Char(a[i]);
       
   166     }
       
   167 }
       
   168 
       
   169 QT_END_NAMESPACE