QLatin1String: add toString()
For symmetry with other views. [ChangeLog][QtCore][QLatin1String] Added toString(). Change-Id: I4a0677e2dbd009e8da097f4cb0dbb27a6baf5469 Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
d9b2115060
commit
ce5931aaf2
|
|
@ -9098,6 +9098,16 @@ QString &QString::setRawData(const QChar *unicode, int size)
|
|||
\sa latin1()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QLatin1String::toString() const
|
||||
\since 6.0
|
||||
|
||||
Converts this Latin-1 string into a QString. Equivalent to
|
||||
\code
|
||||
return QString(*this);
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*! \fn const char *QLatin1String::latin1() const
|
||||
|
||||
Returns the Latin-1 string stored in this object.
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ public:
|
|||
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) noexcept : m_size(sz), m_data(s) {}
|
||||
inline explicit QLatin1String(const QByteArray &s) noexcept : m_size(int(qstrnlen(s.constData(), s.size()))), m_data(s.constData()) {}
|
||||
|
||||
inline QString toString() const;
|
||||
|
||||
Q_DECL_CONSTEXPR const char *latin1() const noexcept { return m_data; }
|
||||
Q_DECL_CONSTEXPR int size() const noexcept { return m_size; }
|
||||
Q_DECL_CONSTEXPR const char *data() const noexcept { return m_data; }
|
||||
|
|
@ -1057,6 +1059,12 @@ public:
|
|||
inline DataPointer &data_ptr() { return d; }
|
||||
};
|
||||
|
||||
//
|
||||
// QLatin1String inline members that require QString:
|
||||
//
|
||||
|
||||
QString QLatin1String::toString() const { return *this; }
|
||||
|
||||
//
|
||||
// QStringView inline members that require QString:
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue