diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-04-06 19:36:47 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-04-07 08:32:32 +0000 |
commit | 399ab058c94978b40876e42b5b677d392f2e33f5 (patch) | |
tree | ae1d0920f45e63d9c65fb91c0a765c981c45cde9 /src/corelib/tools/qbytearray.cpp | |
parent | 5dc1e08c8c602738f6a827cea0de44683c7bbd0b (diff) |
Add front()/back() to QString, QStringRef, QByteArray and QLatin1String
These STL-compatibility functions are present on our generic
containers, but not on the string classes.
[ChangeLog][QtCore][QString/QStringRef/QByteArray/QLatin1String] Added
front() and back() for STL compatibility.
Change-Id: I536019396b319abd1e2daf9c64ebab4e7a35b334
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 329cc358d4..6be28fea5f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1446,6 +1446,66 @@ QByteArray &QByteArray::operator=(const char *str) \overload */ +/*! + \fn char QByteArray::front() const + \since 5.10 + + Returns the first character in the byte array. + Same as \c{at(0)}. + + This function is provided for STL compatibility. + + \warning Calling this function on an empty byte array constitutes + undefined behavior. + + \sa back(), at(), operator[]() +*/ + +/*! + \fn char QByteArray::back() const + \since 5.10 + + Returns the last character in the byte array. + Same as \c{at(size() - 1)}. + + This function is provided for STL compatibility. + + \warning Calling this function on an empty byte array constitutes + undefined behavior. + + \sa front(), at(), operator[]() +*/ + +/*! + \fn QByteRef QByteArray::front() + \since 5.10 + + Returns a reference to the first character in the byte array. + Same as \c{operator[](0)}. + + This function is provided for STL compatibility. + + \warning Calling this function on an empty byte array constitutes + undefined behavior. + + \sa back(), at(), operator[]() +*/ + +/*! + \fn QByteRef QByteArray::back() + \since 5.10 + + Returns a reference to the last character in the byte array. + Same as \c{operator[](size() - 1)}. + + This function is provided for STL compatibility. + + \warning Calling this function on an empty byte array constitutes + undefined behavior. + + \sa front(), at(), operator[]() +*/ + /*! \fn bool QByteArray::contains(const QByteArray &ba) const Returns \c true if the byte array contains an occurrence of the byte |