missing noexcept keywords added

This commit is contained in:
Uwe Rathmann 2021-09-15 13:45:26 +02:00
parent 11451576e3
commit 295a964cd5

View File

@ -12,6 +12,13 @@
#include <qmetatype.h> #include <qmetatype.h>
#include <qvector.h> #include <qvector.h>
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
/*
since Qt >= 5.14 QColor has constexpr declarations and we could declare
several methods of QskGradientStop being constexpr as well. TODO ...
*/
#endif
class QDebug; class QDebug;
class QVariant; class QVariant;
@ -23,26 +30,26 @@ class QSK_EXPORT QskGradientStop
Q_PROPERTY( QColor color READ color WRITE setColor RESET resetColor ) Q_PROPERTY( QColor color READ color WRITE setColor RESET resetColor )
public: public:
QskGradientStop(); QskGradientStop() noexcept;
QskGradientStop( qreal position, const QColor& color ); QskGradientStop( qreal position, const QColor& color ) noexcept;
bool operator==( const QskGradientStop& ) const; bool operator==( const QskGradientStop& ) const noexcept;
bool operator!=( const QskGradientStop& ) const; bool operator!=( const QskGradientStop& ) const noexcept;
void setStop( qreal position, const QColor& color ); void setStop( qreal position, const QColor& color ) noexcept;
qreal position() const; qreal position() const noexcept;
void setPosition( qreal position ); void setPosition( qreal position ) noexcept;
void resetPosition(); void resetPosition() noexcept;
const QColor& color() const; const QColor& color() const noexcept;
void setColor( const QColor& color ); void setColor( const QColor& color ) noexcept;
void resetColor(); void resetColor() noexcept;
static QColor interpolated( static QColor interpolated(
const QskGradientStop&, const QskGradientStop&, qreal position ); const QskGradientStop&, const QskGradientStop&, qreal position ) noexcept;
uint hash( uint seed ) const; uint hash( uint seed ) const noexcept;
private: private:
qreal m_position; qreal m_position;
@ -155,33 +162,34 @@ inline QColor QskGradient::endColor() const
return ( m_stops.size() >= 2 ) ? m_stops.last().color() : QColor(); return ( m_stops.size() >= 2 ) ? m_stops.last().color() : QColor();
} }
inline QskGradientStop::QskGradientStop() inline QskGradientStop::QskGradientStop() noexcept
: m_position( -1.0 ) : m_position( -1.0 )
{ {
} }
inline QskGradientStop::QskGradientStop( qreal position, const QColor& color ) inline QskGradientStop::QskGradientStop(
qreal position, const QColor& color ) noexcept
: m_position( position ) : m_position( position )
, m_color( color ) , m_color( color )
{ {
} }
inline qreal QskGradientStop::position() const inline qreal QskGradientStop::position() const noexcept
{ {
return m_position; return m_position;
} }
inline const QColor& QskGradientStop::color() const inline const QColor& QskGradientStop::color() const noexcept
{ {
return m_color; return m_color;
} }
inline bool QskGradientStop::operator==( const QskGradientStop& other ) const inline bool QskGradientStop::operator==( const QskGradientStop& other ) const noexcept
{ {
return ( m_position == other.m_position ) && ( m_color == other.m_color ); return ( m_position == other.m_position ) && ( m_color == other.m_color );
} }
inline bool QskGradientStop::operator!=( const QskGradientStop& other ) const inline bool QskGradientStop::operator!=( const QskGradientStop& other ) const noexcept
{ {
return ( !( *this == other ) ); return ( !( *this == other ) );
} }