diff options
-rw-r--r-- | src/corelib/tools/qstring.cpp | 18 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 66ce29c859..61eccbf1dd 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -8366,6 +8366,24 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the size of the Latin-1 string stored in this object. */ +/*! \fn bool QLatin1String::isNull() const + \since 5.10 + + Returns whether the Latin-1 string stored in this object is null + (\c{data() == nullptr}) or not. + + \sa isEmpty(), data() +*/ + +/*! \fn bool QLatin1String::isEmpty() const + \since 5.10 + + Returns whether the Latin-1 string stored in this object is empty + (\c{size() == 0}) or not. + + \sa isNull(), size() +*/ + /*! \fn QLatin1Char QLatin1String::at(int pos) const \since 5.8 diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 08242bff11..87d9c07a8b 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -97,6 +97,9 @@ public: Q_DECL_CONSTEXPR int size() const Q_DECL_NOTHROW { return m_size; } Q_DECL_CONSTEXPR const char *data() const Q_DECL_NOTHROW { return m_data; } + Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW { return !data(); } + Q_DECL_CONSTEXPR bool isEmpty() const Q_DECL_NOTHROW { return !size(); } + Q_DECL_CONSTEXPR QLatin1Char at(int i) const { return QLatin1Char(m_data[i]); } Q_DECL_CONSTEXPR QLatin1Char operator[](int i) const { return at(i); } |