Add some missing STL typedefs and functions to QStringRef and QByteArray

These will be needed in some template code that is to come.

Change-Id: I5b93f4320313f7b15a6404de2c98f85485735fda
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Thiago Macieira 2014-08-06 11:57:31 -03:00
parent 04ba6fbed9
commit 6a237a4e76
4 changed files with 80 additions and 0 deletions

View File

@ -4425,6 +4425,14 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
\internal
*/
/*! \typedef QByteArray::size_type
\internal
*/
/*! \typedef QByteArray::difference_type
\internal
*/
/*! \typedef QByteArray::const_reference
\internal
*/
@ -4433,6 +4441,14 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
\internal
*/
/*! \typedef QByteArray::const_pointer
\internal
*/
/*! \typedef QByteArray::pointer
\internal
*/
/*! \typedef QByteArray::value_type
\internal
*/

View File

@ -389,8 +389,12 @@ public:
const_iterator constEnd() const;
// stl compatibility
typedef int size_type;
typedef qptrdiff difference_type;
typedef const char & const_reference;
typedef char & reference;
typedef char *pointer;
typedef const char *const_pointer;
typedef char value_type;
void push_back(char c);
void push_back(const char *c);

View File

@ -8370,6 +8370,30 @@ QDataStream &operator>>(QDataStream &in, QString &str)
\sa {Implicitly Shared Classes}
*/
/*!
\typedef QStringRef::size_type
\internal
*/
/*!
\typedef QStringRef::value_type
\internal
*/
/*!
\typedef QStringRef::const_pointer
\internal
*/
/*!
\typedef QStringRef::const_reference
\internal
*/
/*!
\typedef QStringRef::const_iterator
\internal
*/
/*!
\fn QStringRef::QStringRef()
@ -8492,6 +8516,32 @@ ownership of it, no memory is freed when instances are destroyed.
Same as unicode().
*/
/*!
\fn const QChar *QStringRef::begin() const
Same as unicode().
*/
/*!
\fn const QChar *QStringRef::cbegin() const
Same as unicode().
*/
/*!
\fn const QChar *QStringRef::end() const
Returns a pointer to one character past the last one in this string.
(It is the same as \c {unicode() + size()}.)
*/
/*!
\fn const QChar *QStringRef::cend() const
Returns a pointer to one character past the last one in this string.
(It is the same as \c {unicode() + size()}.)
*/
/*!
\fn const QChar *QStringRef::constData() const

View File

@ -1264,6 +1264,12 @@ class Q_CORE_EXPORT QStringRef {
int m_position;
int m_size;
public:
typedef QString::size_type size_type;
typedef QString::value_type value_type;
typedef QString::const_iterator const_iterator;
typedef QString::const_pointer const_pointer;
typedef QString::const_reference const_reference;
// ### Qt 6: make this constructor constexpr, after the destructor is made trivial
inline QStringRef():m_string(0), m_position(0), m_size(0){}
inline QStringRef(const QString *string, int position, int size);
@ -1333,6 +1339,10 @@ public:
}
inline const QChar *data() const { return unicode(); }
inline const QChar *constData() const { return unicode(); }
inline const QChar *begin() const { return unicode(); }
inline const QChar *cbegin() const { return unicode(); }
inline const QChar *end() const { return unicode() + size(); }
inline const QChar *cend() const { return unicode() + size(); }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED QByteArray toAscii() const Q_REQUIRED_RESULT