Mark QTextStreamManipulator ctors constexpr nothrow

And use Q_NULLPTR and the ctor-init-list.

Found while looking into QTBUG-45291.

Change-Id: Ie6db7c2ffe4e054781f0666da593df898b8000e0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2015-06-30 22:12:54 +02:00
parent 48d7a53abf
commit ef0778d097

View File

@ -205,8 +205,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument
class Q_CORE_EXPORT QTextStreamManipulator
{
public:
QTextStreamManipulator(QTSMFI m, int a) { mf = m; mc = 0; arg = a; }
QTextStreamManipulator(QTSMFC m, QChar c) { mf = 0; mc = m; ch = c; arg = -1; }
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(Q_NULLPTR), arg(a), ch() {}
Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(Q_NULLPTR), mc(m), arg(-1), ch(c) {}
void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
private: