summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-25 13:22:55 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-02-19 18:16:38 +0000
commit1da975cdc5297ddde584981c4bf301b288ccaca9 (patch)
tree188ad7a00c8f1f8a53f627a59f7664013ce603fc /src/corelib/tools/qstring.cpp
parent342acf66fe640c72e1a7c8837ba5cdefae06f9c9 (diff)
QLatin1String: add at()/op[]/mid()/right()/left()
QLatin1String can be used as a string-view-like type. When attempting to do so in uic, mid() and at() were found to be missing. Added the others for completeness. Use the new functions in uic, for which they were originally conceived. [ChangeLog][QtCore][QLatin1String] Added at(), operator[](), mid(), right(), left(). Change-Id: I4cfe3e9ed1157dedee754b2012d9678fe72b161e Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r--src/corelib/tools/qstring.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 24d43dad88..18435c3009 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -8328,6 +8328,78 @@ QString &QString::setRawData(const QChar *unicode, int size)
Returns the size of the Latin-1 string stored in this object.
*/
+/*! \fn QLatin1Char QLatin1String::at(int pos) const
+ \since 5.8
+
+ Returns the character at position \a pos in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+
+ \sa operator[]()
+*/
+
+/*! \fn QLatin1Char QLatin1String::operator[](int pos) const
+ \since 5.8
+
+ Returns the character at position \a pos in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+
+ \sa at()
+*/
+
+/*! \fn QLatin1String QLatin1String::mid(int start) const
+ \since 5.8
+
+ Returns the substring starting at position \a start in this object,
+ and extending to the end of the string.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a start < 0 or \a start > size().
+
+ \sa left(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::mid(int start, int length) const
+ \since 5.8
+ \overload
+
+ Returns the substring of length \a length starting at position
+ \a start in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a start < 0, \length < 0,
+ or \a start + \a length > size().
+
+ \sa left(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::left(int length) const
+ \since 5.8
+
+ Returns the substring of length \a length starting at position
+ 0 in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \length < 0 or \a length > size().
+
+ \sa mid(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::right(int length) const
+ \since 5.8
+
+ Returns the substring of length \a length starting at position
+ size() - \a length in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \length < 0 or \a length > size().
+
+ \sa mid(), left()
+*/
+
/*! \fn bool QLatin1String::operator==(const QString &other) const
Returns \c true if this string is equal to string \a other;