diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-10-10 09:42:41 +0200 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2017-11-28 18:41:40 +0000 |
commit | 984ad6124992c9831f57c2776aa2ed0a760149e6 (patch) | |
tree | 320236847752f32a56a1c6e18618a353172921f9 /src/corelib/tools/qstringview.cpp | |
parent | 8298956eb084d8f0e478240a674c5ae131c8be97 (diff) |
Improve readability of code that uses the Qt signed size typev5.10.0-rc2
During the container BoF session at the Qt Contributor Summit 2017 the
name of the signed size type became a subject of discussion in the
context of readability of code using this type and the intention of
using it for all length, size and count properties throughout the entire
framework in future versions of Qt.
This change proposes qsizetype as new name for qssize_t to emphasize the
readability of code over POSIX compatibility, the former being
potentially more relevant than the latter to the majority of users of
Qt.
Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/tools/qstringview.cpp')
-rw-r--r-- | src/corelib/tools/qstringview.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index 8eefc6d814..bb22239b66 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -131,9 +131,9 @@ QT_BEGIN_NAMESPACE /*! \typedef QStringView::size_type - Alias for qssize_t. Provided for compatibility with the STL. + Alias for qsizetype. Provided for compatibility with the STL. - Unlike other Qt classes, QStringView uses qssize_t as its \c size_type, to allow + Unlike other Qt classes, QStringView uses qsizetype as its \c size_type, to allow accepting data from \c{std::basic_string} without truncation. The Qt API functions, for example length(), return \c int, while the STL-compatible functions, for example size(), return \c size_type. @@ -224,7 +224,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView::QStringView(const Char *str, qssize_t len) + \fn QStringView::QStringView(const Char *str, qsizetype len) Constructs a string view on \a str with length \a len. @@ -486,7 +486,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn qssize_t QStringView::size() const + \fn qsizetype QStringView::size() const Returns the size of this string view, in UTF-16 code points (that is, surrogate pairs count as two for the purposes of this function, the same @@ -510,7 +510,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QChar QStringView::operator[](qssize_t n) const + \fn QChar QStringView::operator[](qsizetype n) const Returns the character at position \a n in this string view. @@ -520,7 +520,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QChar QStringView::at(qssize_t n) const + \fn QChar QStringView::at(qsizetype n) const Returns the character at position \a n in this string view. @@ -582,7 +582,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::mid(qssize_t start) const + \fn QStringView QStringView::mid(qsizetype start) const Returns the substring starting at position \a start in this object, and extending to the end of the string. @@ -593,7 +593,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::mid(qssize_t start, qssize_t length) const + \fn QStringView QStringView::mid(qsizetype start, qsizetype length) const \overload Returns the substring of length \a length starting at position @@ -606,7 +606,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::left(qssize_t length) const + \fn QStringView QStringView::left(qsizetype length) const Returns the substring of length \a length starting at position 0 in this object. @@ -617,7 +617,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::right(qssize_t length) const + \fn QStringView QStringView::right(qsizetype length) const Returns the substring of length \a length starting at position size() - \a length in this object. @@ -628,7 +628,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::chopped(qssize_t length) const + \fn QStringView QStringView::chopped(qsizetype length) const Returns the substring of length size() - \a length starting at the beginning of this object. @@ -641,7 +641,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QStringView::truncate(qssize_t length) + \fn void QStringView::truncate(qsizetype length) Truncates this string view to length \a length. @@ -653,7 +653,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QStringView::chop(qssize_t length) + \fn void QStringView::chop(qsizetype length) Truncates this string view by \a length characters. |