QStringView: clean up storage_type
Now that all supported compilers support char16_t, we don't need the storage_type == wchar_t hack for MSVC anymore. Remove it. Adapt docs. Change-Id: I55df6c8a9fa5a9c7e6f53ba89f3850956b369061 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
parent
353a6946b1
commit
afb8ba3fd2
@ -57,9 +57,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
The UTF-16 string may be represented as an array (or an array-compatible
|
The UTF-16 string may be represented as an array (or an array-compatible
|
||||||
data-structure such as QString,
|
data-structure such as QString,
|
||||||
std::basic_string, etc.) of QChar, \c ushort, \c char16_t (on compilers that
|
std::basic_string, etc.) of QChar, \c ushort, \c char16_t or
|
||||||
support C++11 Unicode strings) or (on platforms, such as Windows,
|
(on platforms, such as Windows, where it is a 16-bit type) \c wchar_t.
|
||||||
where it is a 16-bit type) \c wchar_t.
|
|
||||||
|
|
||||||
QStringView is designed as an interface type; its main use-case is
|
QStringView is designed as an interface type; its main use-case is
|
||||||
as a function parameter type. When QStringViews are used as automatic
|
as a function parameter type. When QStringViews are used as automatic
|
||||||
@ -115,8 +114,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
/*!
|
/*!
|
||||||
\typedef QStringView::storage_type
|
\typedef QStringView::storage_type
|
||||||
|
|
||||||
Alias for \c{char16_t} for non-Windows or if Q_COMPILER_UNICODE_STRINGS
|
Alias for \c{char16_t}.
|
||||||
is defined. Otherwise, alias for \c{wchar_t}.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -62,9 +62,7 @@ struct IsCompatibleCharTypeHelper
|
|||||||
: std::integral_constant<bool,
|
: std::integral_constant<bool,
|
||||||
std::is_same<Char, QChar>::value ||
|
std::is_same<Char, QChar>::value ||
|
||||||
std::is_same<Char, ushort>::value ||
|
std::is_same<Char, ushort>::value ||
|
||||||
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
|
||||||
std::is_same<Char, char16_t>::value ||
|
std::is_same<Char, char16_t>::value ||
|
||||||
#endif
|
|
||||||
(std::is_same<Char, wchar_t>::value && sizeof(wchar_t) == sizeof(QChar))> {};
|
(std::is_same<Char, wchar_t>::value && sizeof(wchar_t) == sizeof(QChar))> {};
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
struct IsCompatibleCharType
|
struct IsCompatibleCharType
|
||||||
@ -105,11 +103,7 @@ struct IsCompatibleStdBasicString
|
|||||||
class QStringView
|
class QStringView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_COMPILER_UNICODE_STRINGS)
|
|
||||||
typedef wchar_t storage_type;
|
|
||||||
#else
|
|
||||||
typedef char16_t storage_type;
|
typedef char16_t storage_type;
|
||||||
#endif
|
|
||||||
typedef const QChar value_type;
|
typedef const QChar value_type;
|
||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef qsizetype size_type;
|
typedef qsizetype size_type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user