QStringBuilder: simplify QConcatenable<char[N]>

... by delegating to QConcatenable<const char[N]>.

The only thing that varied was the nested type alias 'type', which
therefore got retained.

Change-Id: I202f899034e1ddd23c6d1978a31be5eb7c195697
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2017-03-30 19:19:45 +02:00
parent a262837505
commit df43ef7b6d

View File

@ -277,25 +277,6 @@ template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
}
};
template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
{
typedef char type[N];
typedef QByteArray ConvertTo;
enum { ExactSize = false };
static int size(const char[N]) { return N - 1; }
#ifndef QT_NO_CAST_FROM_ASCII
static inline void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
{
QAbstractConcatenable::convertFromAscii(a, N - 1, out);
}
#endif
static inline void appendTo(const char a[N], char *&out)
{
while (*a)
*out++ = *a++;
}
};
template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
{
typedef const char type[N];
@ -315,6 +296,11 @@ template <int N> struct QConcatenable<const char[N]> : private QAbstractConcaten
}
};
template <int N> struct QConcatenable<char[N]> : QConcatenable<const char[N]>
{
typedef char type[N];
};
template <> struct QConcatenable<const char *> : private QAbstractConcatenable
{
typedef char const *type;