QStringRef: add constBegin() and constEnd()

These methods were missing in the API. constBegin, constEnd
are the more Qt-ish names.

Also it makes porting client code from QString to QStringRef easier.

Change-Id: I3fce1d206073d26259fe0fa44d0f7ca718504ec3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Anton Kudryavtsev 2016-10-18 22:40:26 +03:00
parent 7437ede145
commit 9c02bfdb73
2 changed files with 23 additions and 4 deletions

View File

@ -8940,7 +8940,7 @@ ownership of it, no memory is freed when instances are destroyed.
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in
the string.
\sa cbegin(), end(), rbegin(), rend()
\sa cbegin(), constBegin(), end(), constEnd(), rbegin(), rend()
*/
/*!
@ -8949,7 +8949,16 @@ ownership of it, no memory is freed when instances are destroyed.
Same as begin().
\sa begin(), cend(), rbegin(), rend()
\sa begin(), constBegin(), cend(), constEnd(), rbegin(), rend()
*/
/*!
\fn QStringRef::const_iterator QStringRef::constBegin() const
\since 5.9
Same as begin().
\sa begin(), cend(), constEnd(), rbegin(), rend()
*/
/*!
@ -8959,7 +8968,7 @@ ownership of it, no memory is freed when instances are destroyed.
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
character after the last character in the list.
\sa cbegin(), end(), rbegin(), rend()
\sa cbegin(), constBegin(), end(), constEnd(), rbegin(), rend()
*/
/*! \fn QStringRef::const_iterator QStringRef::cend() const
@ -8967,7 +8976,15 @@ ownership of it, no memory is freed when instances are destroyed.
Same as end().
\sa end(), cbegin(), rbegin(), rend()
\sa end(), constEnd(), cbegin(), constBegin(), rbegin(), rend()
*/
/*! \fn QStringRef::const_iterator QStringRef::constEnd() const
\since 5.9
Same as end().
\sa end(), cend(), cbegin(), constBegin(), rbegin(), rend()
*/
/*!

View File

@ -1473,8 +1473,10 @@ public:
inline const_iterator begin() const { return unicode(); }
inline const_iterator cbegin() const { return unicode(); }
inline const_iterator constBegin() const { return unicode(); }
inline const_iterator end() const { return unicode() + size(); }
inline const_iterator cend() const { return unicode() + size(); }
inline const_iterator constEnd() const { return unicode() + size(); }
inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
inline const_reverse_iterator crbegin() const { return rbegin(); }
inline const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }