more C++11 specifier

This commit is contained in:
Uwe Rathmann 2020-05-03 13:59:27 +02:00
parent bbf648b8bd
commit 5cbeca4921

View File

@ -16,18 +16,18 @@ namespace QskVertex
class QSK_EXPORT Color
{
public:
constexpr Color();
constexpr Color() noexcept;
constexpr Color( unsigned char red, unsigned char green,
unsigned char blue, unsigned char alpha );
unsigned char blue, unsigned char alpha ) noexcept;
Color( QRgb );
Color( QRgb ) noexcept;
Color( const QColor& );
Color interpolatedTo( Color, double ratio ) const;
Color interpolatedTo( Color, double ratio ) const noexcept;
bool operator==( const Color& ) const;
bool operator!=( const Color& ) const;
constexpr bool operator==( const Color& ) const noexcept;
constexpr bool operator!=( const Color& ) const noexcept;
unsigned char r, g, b, a;
};
@ -35,23 +35,23 @@ namespace QskVertex
class QSK_EXPORT Line
{
public:
inline void setLine( float x1, float y1, float x2, float y2 )
inline void setLine( float x1, float y1, float x2, float y2 ) noexcept
{
p1.set( x1, y1 );
p2.set( x2, y2 );
}
inline void setHLine( float x1, float x2, float y )
inline void setHLine( float x1, float x2, float y ) noexcept
{
setLine( x1, y, x2, y );
}
inline void setVLine( float x, float y1, float y2 )
inline void setVLine( float x, float y1, float y2 ) noexcept
{
setLine( x, y1, x, y2 );
}
inline void setLine( float x1, float y1, float x2, float y2, Color )
inline void setLine( float x1, float y1, float x2, float y2, Color ) noexcept
{
/* The color parameter makes no sense, but is useful
when being using from templated code
@ -67,23 +67,23 @@ namespace QskVertex
{
public:
inline void setLine( float x1, float y1, Color c1,
float x2, float y2, Color c2 )
float x2, float y2, Color c2 ) noexcept
{
p1.set( x1, y1, c1.r, c1.g, c1.b, c1.a );
p2.set( x2, y2, c2.r, c2.g, c2.b, c2.a );
}
inline void setLine( float x1, float y1, float x2, float y2, Color color )
inline void setLine( float x1, float y1, float x2, float y2, Color color ) noexcept
{
setLine( x1, y1, color, x2, y2, color );
}
inline void setHLine( qreal x1, qreal x2, qreal y, Color color )
inline void setHLine( qreal x1, qreal x2, qreal y, Color color ) noexcept
{
setLine( x1, y, color, x2, y, color );
}
inline void setVLine( qreal x, qreal y1, qreal y2, Color color )
inline void setVLine( qreal x, qreal y1, qreal y2, Color color ) noexcept
{
setLine( x, y1, color, x, y2, color );
}
@ -101,7 +101,7 @@ namespace QskVertex
void QSK_EXPORT debugGeometry( const QSGGeometry& );
inline constexpr Color::Color()
inline constexpr Color::Color() noexcept
: r( 0 )
, g( 0 )
, b( 0 )
@ -110,7 +110,7 @@ namespace QskVertex
}
inline constexpr Color::Color( unsigned char red, unsigned char green,
unsigned char blue, unsigned char alpha )
unsigned char blue, unsigned char alpha ) noexcept
: r( red )
, g( green )
, b( blue )
@ -118,7 +118,7 @@ namespace QskVertex
{
}
inline Color::Color( QRgb rgb )
inline Color::Color( QRgb rgb ) noexcept
{
r = qRed( rgb );
g = qGreen( rgb );
@ -140,7 +140,7 @@ namespace QskVertex
{
}
inline Color Color::interpolatedTo( Color colorTo, double ratio ) const
inline Color Color::interpolatedTo( Color colorTo, double ratio ) const noexcept
{
if ( ratio <= 0.0 )
return *this;
@ -155,19 +155,20 @@ namespace QskVertex
rt * b + t * colorTo.b, rt * a + t * colorTo.a );
}
inline bool Color::operator==( const Color& other ) const
inline constexpr bool Color::operator==( const Color& other ) const noexcept
{
return ( r == other.r ) && ( g == other.g )
&& ( b == other.b ) && ( a == other.a );
}
inline bool Color::operator!=( const Color& other ) const
inline constexpr bool Color::operator!=( const Color& other ) const noexcept
{
return !( *this == other );
}
}
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
QDebug operator<<( QDebug debug, QskVertex::Color );
QDebug operator<<( QDebug debug, QskVertex::ColoredLine );
QDebug operator<<( QDebug debug, QskVertex::Line );