From d131abde59190ed5ea8673828bce13fff66c1e3a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 3 Aug 2014 02:08:29 +0200 Subject: [PATCH] QPixelFormat: implement some oneliners in the class body There's little point in duplicating the complex declaration (thanks to C++11), just define the relational operators and the default ctor where they're declared. Change-Id: Ie91545b2581c89edd434c911eb05705e2d16debe Reviewed-by: Laszlo Agocs --- src/gui/kernel/qpixelformat.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h index 40d58f285a..5bf64ac043 100644 --- a/src/gui/kernel/qpixelformat.h +++ b/src/gui/kernel/qpixelformat.h @@ -159,7 +159,7 @@ public: CurrentSystemEndian }; - Q_DECL_CONSTEXPR inline QPixelFormat() Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QPixelFormat() Q_DECL_NOTHROW : data(0) {} Q_DECL_CONSTEXPR inline QPixelFormat(ColorModel colorModel, uchar firstSize, uchar secondSize, @@ -221,8 +221,11 @@ private: private: quint64 data; - friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(const QPixelFormat &fmt1, const QPixelFormat &fmt2); - friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(const QPixelFormat &fmt1, const QPixelFormat &fmt2); + friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(const QPixelFormat &fmt1, const QPixelFormat &fmt2) + { return fmt1.data == fmt2.data; } + + friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(const QPixelFormat &fmt1, const QPixelFormat &fmt2) + { return !(fmt1 == fmt2); } }; Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64)); Q_DECLARE_TYPEINFO(QPixelFormat, Q_PRIMITIVE_TYPE); @@ -304,12 +307,6 @@ public: ByteOrder byteOrder = LittleEndian); }; -Q_DECL_CONSTEXPR -QPixelFormat::QPixelFormat() Q_DECL_NOTHROW - : data(0) -{ -} - Q_DECL_CONSTEXPR QPixelFormat::QPixelFormat(ColorModel mdl, uchar firstSize, @@ -341,12 +338,6 @@ QPixelFormat::QPixelFormat(ColorModel mdl, { } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(const QPixelFormat &fmt1, const QPixelFormat &fmt2) -{ return fmt1.data == fmt2.data; } - -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator!=(const QPixelFormat &fmt1, const QPixelFormat &fmt2) -{ return !(fmt1 == fmt2); } - Q_DECL_CONSTEXPR QPixelFormatRgb::QPixelFormatRgb(uchar red, uchar green,