From 2c285b893caae37f132de75bcc77bf5471107689 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 8 Jul 2013 16:04:54 -0700 Subject: [PATCH] Add a few more typedefs to QString, for STL compatibility Task-number: QTBUG-22890 Change-Id: I457be6367e577dee30532383d10c519b2f2617b3 Reviewed-by: Robin Burchell --- src/corelib/tools/qstring.cpp | 32 +++++++++++++++++++++++++++++--- src/corelib/tools/qstring.h | 4 ++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 37d28b0904..36bd61098a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -819,18 +819,44 @@ const QString::Null QString::null = { }; \sa QString::const_iterator */ +/*! + \typedef QString::size_type + + The QString::size_type typedef provides an STL-style type for sizes (int). +*/ + +/*! + \typedef QString::difference_type + + The QString::size_type typedef provides an STL-style type for difference between pointers. +*/ + /*! \typedef QString::const_reference The QString::const_reference typedef provides an STL-style - const reference for QString. + const reference for a QString element (QChar). */ /*! \typedef QString::reference - The QString::const_reference typedef provides an STL-style - reference for QString. + The QString::reference typedef provides an STL-style + reference for a QString element (QChar). */ + +/*! + \typedef QString::const_pointer + + The QString::const_pointer typedef provides an STL-style + const pointer to a QString element (QChar). +*/ +/*! + \typedef QString::pointer + + The QString::const_pointer typedef provides an STL-style + pointer to a QString element (QChar). +*/ + /*! \typedef QString::value_type diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index d8aaa929dc..7010a954b4 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -657,8 +657,12 @@ public: const_iterator constEnd() const; // STL compatibility + typedef int size_type; + typedef qptrdiff difference_type; typedef const QChar & const_reference; typedef QChar & reference; + typedef QChar *pointer; + typedef const QChar *const_pointer; typedef QChar value_type; inline void push_back(QChar c) { append(c); } inline void push_back(const QString &s) { append(s); }