@@ -330,9 +330,9 @@ template<class Object> inline QgsSignalBlocker<Object> whileBlocking( Object* ob
330
330
return QgsSignalBlocker<Object>( object );
331
331
}
332
332
333
- //
334
- // return a string representation of a double
335
- //
333
+ // ! Returns a string representation of a double
334
+ // ! @param a double value
335
+ // ! @param precision number of decimal places to retain
336
336
inline QString qgsDoubleToString ( double a, int precision = 17 )
337
337
{
338
338
if ( precision )
@@ -341,18 +341,17 @@ inline QString qgsDoubleToString( double a, int precision = 17 )
341
341
return QString::number ( a, ' f' , precision );
342
342
}
343
343
344
- //
345
- // compare two doubles (but allow some difference)
346
- //
344
+ // ! Compare two doubles (but allow some difference)
345
+ // ! @param a first double
346
+ // ! @param b second double
347
+ // ! @param epsilon maximum difference allowable between doubles
347
348
inline bool qgsDoubleNear ( double a, double b, double epsilon = 4 * DBL_EPSILON )
348
349
{
349
350
const double diff = a - b;
350
351
return diff > -epsilon && diff <= epsilon;
351
352
}
352
353
353
- //
354
- // compare two doubles using specified number of significant digits
355
- //
354
+ // ! Compare two doubles using specified number of significant digits
356
355
inline bool qgsDoubleNearSig ( double a, double b, int significantDigits = 10 )
357
356
{
358
357
// The most simple would be to print numbers as %.xe and compare as strings
@@ -368,17 +367,23 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
368
367
qRound ( ar * pow ( 10.0 , significantDigits ) ) == qRound ( br * pow ( 10.0 , significantDigits ) );
369
368
}
370
369
371
- //
372
- // a round function which returns a double to guard against overflows
373
- //
370
+ // ! A round function which returns a double to guard against overflows
374
371
inline double qgsRound ( double x )
375
372
{
376
373
return x < 0.0 ? std::ceil ( x - 0.5 ) : std::floor ( x + 0.5 );
377
374
}
378
375
379
- bool qgsVariantLessThan ( const QVariant& lhs, const QVariant& rhs );
380
-
381
- bool qgsVariantGreaterThan ( const QVariant& lhs, const QVariant& rhs );
376
+ // ! Compares two QVariant values and returns whether the first is less than the second.
377
+ // ! Useful for sorting lists of variants, correctly handling sorting of the various
378
+ // ! QVariant data types (such as strings, numeric values, dates and times)
379
+ // ! @see qgsVariantGreaterThan()
380
+ CORE_EXPORT bool qgsVariantLessThan ( const QVariant& lhs, const QVariant& rhs );
381
+
382
+ // ! Compares two QVariant values and returns whether the first is greater than the second.
383
+ // ! Useful for sorting lists of variants, correctly handling sorting of the various
384
+ // ! QVariant data types (such as strings, numeric values, dates and times)
385
+ // ! @see qgsVariantLessThan()
386
+ CORE_EXPORT bool qgsVariantGreaterThan ( const QVariant& lhs, const QVariant& rhs );
382
387
383
388
CORE_EXPORT QString qgsVsiPrefix ( const QString& path );
384
389
0 commit comments