Skip to content

Commit 82029f9

Browse files
committed
Allow some frequently used methods to be inlined
1 parent 9be7293 commit 82029f9

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/core/raster/qgsrasterrange.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,7 @@ QgsRasterRange::QgsRasterRange( double min, double max, BoundsType bounds )
2424
{
2525
}
2626

27-
bool QgsRasterRange::contains( double value ) const
28-
{
29-
return ( value > mMin
30-
|| ( !std::isnan( mMin ) && qgsDoubleNear( value, mMin ) && ( mType == IncludeMinAndMax || mType == IncludeMin ) )
31-
|| std::isnan( mMin ) )
32-
&&
33-
( value < mMax
34-
|| ( !std::isnan( mMax ) && qgsDoubleNear( value, mMax ) && ( mType == IncludeMinAndMax || mType == IncludeMax ) )
35-
|| std::isnan( mMax ) );
36-
}
3727

38-
bool QgsRasterRange::contains( double value, const QgsRasterRangeList &rangeList )
39-
{
40-
for ( QgsRasterRange range : rangeList )
41-
{
42-
if ( range.contains( value ) )
43-
{
44-
return true;
45-
}
46-
}
47-
return false;
48-
}
28+
29+
4930

src/core/raster/qgsrasterrange.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,34 @@ class CORE_EXPORT QgsRasterRange
111111
* Returns true if this range contains the specified \a value.
112112
* \since QGIS 3.2
113113
*/
114-
bool contains( double value ) const;
114+
bool contains( double value ) const
115+
{
116+
return ( value > mMin
117+
|| ( !std::isnan( mMin ) && qgsDoubleNear( value, mMin ) && ( mType == IncludeMinAndMax || mType == IncludeMin ) )
118+
|| std::isnan( mMin ) )
119+
&&
120+
( value < mMax
121+
|| ( !std::isnan( mMax ) && qgsDoubleNear( value, mMax ) && ( mType == IncludeMinAndMax || mType == IncludeMax ) )
122+
|| std::isnan( mMax ) );
123+
}
115124

116125
/**
117126
* \brief Tests if a \a value is within the list of ranges
118127
* \param value value
119128
* \param rangeList list of ranges
120129
* \returns true if value is in at least one of ranges
121130
*/
122-
static bool contains( double value, const QgsRasterRangeList &rangeList );
131+
static bool contains( double value, const QgsRasterRangeList &rangeList )
132+
{
133+
for ( QgsRasterRange range : rangeList )
134+
{
135+
if ( range.contains( value ) )
136+
{
137+
return true;
138+
}
139+
}
140+
return false;
141+
}
123142

124143
private:
125144
double mMin = std::numeric_limits<double>::quiet_NaN();

0 commit comments

Comments
 (0)