Add QByteArray overload for the QLatin1String ctor.
This increases source compatibility when QT_NO_CAST_FROM_BYTEARRAY is used. Change-Id: Ie1a1cfa8acac2fa91aa8f217d91e22289be8b38f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
ded80cfc8a
commit
2c944d6b9d
@ -7164,6 +7164,17 @@ QString &QString::setRawData(const QChar *unicode, int size)
|
||||
\sa latin1()
|
||||
*/
|
||||
|
||||
/*! \fn QLatin1String::QLatin1String(const QByteArray &str)
|
||||
|
||||
Constructs a QLatin1String object that stores \a str.
|
||||
|
||||
The string data is \e not copied. The caller must be able to
|
||||
guarantee that \a str will not be deleted or modified as long as
|
||||
the QLatin1String object exists.
|
||||
|
||||
\sa latin1()
|
||||
*/
|
||||
|
||||
/*! \fn const char *QLatin1String::latin1() const
|
||||
|
||||
Returns the Latin-1 string stored in this object.
|
||||
|
@ -647,6 +647,7 @@ class QLatin1String
|
||||
public:
|
||||
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
|
||||
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) : m_size(sz), m_data(s) {}
|
||||
Q_DECL_CONSTEXPR inline explicit QLatin1String(const QByteArray &s) : m_size(strlen(s.constData())), m_data(s.constData()) {}
|
||||
|
||||
inline const char *latin1() const { return m_data; }
|
||||
inline int size() const { return m_size; }
|
||||
|
Loading…
Reference in New Issue
Block a user