69 ,
mIncludeLower( limits ==
Qgis::RangeLimits::IncludeLowerExcludeUpper || limits ==
Qgis::RangeLimits::IncludeBoth )
70 ,
mIncludeUpper( limits ==
Qgis::RangeLimits::ExcludeLowerIncludeUpper || limits ==
Qgis::RangeLimits::IncludeBoth )
210 return ( !
operator==( other ) );
255 double upper = std::numeric_limits< double >::max(),
256 bool includeLower =
true,
bool includeUpper =
true )
257 :
QgsRange( lower, upper, includeLower, includeUpper )
267 bool includeLower =
true,
bool includeUpper =
true )
268 :
QgsRange( lower, upper, includeLower, includeUpper )
277 :
QgsRange( std::numeric_limits< double >::lowest(), std::numeric_limits< double >::max(), true, true )
287 return lower() == std::numeric_limits< double >::lowest() &&
upper() == std::numeric_limits< double >::max();
291 SIP_PYOBJECT __repr__();
293 QString
str = QStringLiteral(
"<QgsDoubleRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral(
"[" ) : QStringLiteral(
"(" ) )
294 .arg( sipCpp->lower() )
295 .arg( sipCpp->upper() )
296 .arg( sipCpp->includeUpper() ? QStringLiteral(
"]" ) : QStringLiteral(
")" ) );
297 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
311 return ( !
operator==( other ) );
351 int upper = std::numeric_limits< int >::max(),
352 bool includeLower =
true,
bool includeUpper =
true )
353 :
QgsRange( lower, upper, includeLower, includeUpper )
363 bool includeLower =
true,
bool includeUpper =
true )
364 :
QgsRange( lower, upper, includeLower, includeUpper )
373 :
QgsRange( std::numeric_limits< int >::lowest(), std::numeric_limits< int >::max(), true, true )
383 return lower() == std::numeric_limits< int >::lowest() && upper() == std::numeric_limits< int >::max();
387 SIP_PYOBJECT __repr__();
389 QString
str = QStringLiteral(
"<QgsIntRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral(
"[" ) : QStringLiteral(
"(" ) )
390 .arg( sipCpp->lower() )
391 .arg( sipCpp->upper() )
392 .arg( sipCpp->includeUpper() ? QStringLiteral(
"]" ) : QStringLiteral(
")" ) );
393 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
451 T
end()
const {
return mUpper; }
473 bool isInstant()
const {
return mLower.isValid() && mUpper.isValid() && mLower == mUpper && ( mIncludeLower || mIncludeUpper ); }
482 return !mLower.isValid() && !mUpper.isValid();
492 if ( !mLower.isValid() && !mUpper.isValid() )
495 if ( mLower.isValid() != mUpper.isValid() )
498 if ( mLower > mUpper )
501 if ( mLower == mUpper && !( mIncludeLower || mIncludeUpper ) )
512 if ( !other.mLower.isValid() && mLower.isValid() )
515 if ( mLower.isValid() )
517 const bool lowerOk = ( mIncludeLower && mLower <= other.mLower )
518 || ( !mIncludeLower && mLower < other.mLower )
519 || ( !mIncludeLower && !other.mIncludeLower && mLower <= other.mLower );
524 if ( !other.mUpper.isValid() && mUpper.isValid() )
527 if ( mUpper.isValid() )
529 const bool upperOk = ( mIncludeUpper && mUpper >= other.mUpper )
530 || ( !mIncludeUpper && mUpper > other.mUpper )
531 || ( !mIncludeUpper && !other.mIncludeUpper && mUpper >= other.mUpper );
544 if ( !element.isValid() )
547 if ( mLower.isValid() )
549 const bool lowerOk = ( mIncludeLower && mLower <= element )
550 || ( !mIncludeLower && mLower < element );
555 if ( mUpper.isValid() )
557 const bool upperOk = ( mIncludeUpper && mUpper >= element )
558 || ( !mIncludeUpper && mUpper > element );
571 if ( !mUpper.isValid() && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
574 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
575 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
578 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
579 && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
582 if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
583 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
586 if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
587 && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
590 if ( mLower == other.mLower && mUpper == other.mUpper )
612 mLower = other.
begin();
613 mUpper = other.
end();
620 bool changed {
false };
623 if ( ! other.
begin().isValid()
624 || (
begin().isValid() && other.
begin() < mLower ) )
626 mLower = other.
begin();
632 mIncludeLower =
true;
637 if ( ! other.
end().isValid()
638 || (
end().isValid() && other.
end() > mUpper ) )
640 mUpper = other.
end();
644 else if ( other.
end() == mUpper && other.
includeEnd() && ! mIncludeUpper )
646 mIncludeUpper =
true;
669 if ( ranges.empty() )
672 QList< QgsTemporalRange<T > > sortedRanges = ranges;
675 QList< QgsTemporalRange<T>> res;
676 res.reserve( sortedRanges.size() );
679 auto it = sortedRanges.constBegin();
681 for ( ; it != sortedRanges.constEnd(); ++it )
700 return mLower == other.mLower &&
701 mUpper == other.mUpper &&
708 return ( !
operator==( other ) );
715 bool mIncludeLower =
true;
716 bool mIncludeUpper =
true;
The Qgis class provides global constants for use throughout the application.
RangeLimits
Describes how the limits of a range are handled.
@ ExcludeLowerIncludeUpper
Lower value is excluded from the range, upper value in inccluded.
@ IncludeBoth
Both lower and upper values are included in the range.
@ ExcludeBoth
Both lower and upper values are excluded from the range.
@ IncludeLowerExcludeUpper
Lower value is included in the range, upper value is excluded.
QgsRange which stores a range of double values.
QgsDoubleRange(double lower, double upper, Qgis::RangeLimits limits)
Constructor for QgsDoubleRange.
QgsDoubleRange(double lower=std::numeric_limits< double >::lowest(), double upper=std::numeric_limits< double >::max(), bool includeLower=true, bool includeUpper=true)
Constructor for QgsDoubleRange.
bool operator==(const QgsDoubleRange &other) const
bool isInfinite() const
Returns true if the range consists of all possible values.
bool operator!=(const QgsDoubleRange &other) const
QgsRange which stores a range of integer values.
bool isInfinite() const
Returns true if the range consists of all possible values.
QgsIntRange(int lower, int upper, Qgis::RangeLimits limits)
Constructor for QgsIntRange.
QgsIntRange(int lower=std::numeric_limits< int >::lowest(), int upper=std::numeric_limits< int >::max(), bool includeLower=true, bool includeUpper=true)
Constructor for QgsIntRange.
A template based class for storing ranges (lower to upper values).
QgsRange(T lower, T upper, Qgis::RangeLimits limits)
Constructor for QgsRange.
bool includeUpper() const
Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.
bool overlaps(const QgsRange< T > &other) const
Returns true if this range overlaps another range.
Qgis::RangeLimits rangeLimits() const
Returns the limit handling of the range.
QgsRange(T lower, T upper, bool includeLower=true, bool includeUpper=true)
Constructor for QgsRange.
bool contains(const QgsRange< T > &other) const
Returns true if this range contains another range.
T lower() const
Returns the lower bound of the range.
bool includeLower() const
Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.
T upper() const
Returns the upper bound of the range.
bool isSingleton() const
Returns true if the range consists only of a single value or instant.
bool operator!=(const QgsRange< T > &other) const
bool contains(T element) const
Returns true if this range contains a specified element.
bool operator==(const QgsRange< T > &other) const
bool isEmpty() const
Returns true if the range is empty, ie the lower bound equals (or exceeds) the upper bound and either...
A template based class for storing temporal ranges (beginning to end values).
bool contains(const T &element) const
Returns true if this range contains a specified element.
T begin() const
Returns the beginning of the range.
bool contains(const QgsTemporalRange< T > &other) const
Returns true if this range contains another range.
bool extend(const QgsTemporalRange< T > &other)
Extends the range in place by extending this range out to include an other range.
T end() const
Returns the upper bound of the range.
bool isInstant() const
Returns true if the range consists only of a single instant.
bool operator!=(const QgsTemporalRange< T > &other) const
QgsTemporalRange(const T &begin=T(), const T &end=T(), bool includeBeginning=true, bool includeEnd=true)
Constructor for QgsTemporalRange.
bool operator==(const QgsTemporalRange< T > &other) const
bool overlaps(const QgsTemporalRange< T > &other) const
Returns true if this range overlaps another range.
bool includeEnd() const
Returns true if the end is inclusive, or false if the end is exclusive.
bool includeBeginning() const
Returns true if the beginning is inclusive, or false if the beginning is exclusive.
bool isEmpty() const
Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bo...
static QList< QgsTemporalRange< T > > mergeRanges(const QList< QgsTemporalRange< T > > &ranges)
Merges a list of temporal ranges.
bool isInfinite() const
Returns true if the range consists of all possible values.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QgsTemporalRange< QDate > QgsDateRange
QgsRange which stores a range of dates.