180 return ( !
operator==( other ) );
215 double upper = std::numeric_limits< double >::max(),
216 bool includeLower =
true,
bool includeUpper =
true )
217 :
QgsRange( lower, upper, includeLower, includeUpper )
227 bool includeLower =
true,
bool includeUpper =
true )
228 :
QgsRange( lower, upper, includeLower, includeUpper )
237 :
QgsRange( std::numeric_limits< double >::lowest(), std::numeric_limits< double >::max(), true, true )
247 return lower() == std::numeric_limits< double >::lowest() &&
upper() == std::numeric_limits< double >::max();
251 SIP_PYOBJECT __repr__();
253 QString
str = QStringLiteral(
"<QgsDoubleRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral(
"[" ) : QStringLiteral(
"(" ) )
254 .arg( sipCpp->lower() )
255 .arg( sipCpp->upper() )
256 .arg( sipCpp->includeUpper() ? QStringLiteral(
"]" ) : QStringLiteral(
")" ) );
257 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
271 return ( !
operator==( other ) );
299 int upper = std::numeric_limits< int >::max(),
300 bool includeLower =
true,
bool includeUpper =
true )
301 :
QgsRange( lower, upper, includeLower, includeUpper )
311 bool includeLower =
true,
bool includeUpper =
true )
312 :
QgsRange( lower, upper, includeLower, includeUpper )
321 :
QgsRange( std::numeric_limits< int >::lowest(), std::numeric_limits< int >::max(), true, true )
331 return lower() == std::numeric_limits< int >::lowest() &&
upper() == std::numeric_limits< int >::max();
335 SIP_PYOBJECT __repr__();
337 QString
str = QStringLiteral(
"<QgsIntRange: %1%2, %3%4>" ).arg( sipCpp->includeLower() ? QStringLiteral(
"[" ) : QStringLiteral(
"(" ) )
338 .arg( sipCpp->lower() )
339 .arg( sipCpp->upper() )
340 .arg( sipCpp->includeUpper() ? QStringLiteral(
"]" ) : QStringLiteral(
")" ) );
341 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
397 T
end()
const {
return mUpper; }
419 bool isInstant()
const {
return mLower.isValid() && mUpper.isValid() && mLower == mUpper && ( mIncludeLower || mIncludeUpper ); }
428 return !mLower.isValid() && !mUpper.isValid();
438 if ( !mLower.isValid() && !mUpper.isValid() )
441 if ( mLower.isValid() != mUpper.isValid() )
444 if ( mLower > mUpper )
447 if ( mLower == mUpper && !( mIncludeLower || mIncludeUpper ) )
458 if ( !other.mLower.isValid() && mLower.isValid() )
461 if ( mLower.isValid() )
463 const bool lowerOk = ( mIncludeLower && mLower <= other.mLower )
464 || ( !mIncludeLower && mLower < other.mLower )
465 || ( !mIncludeLower && !other.mIncludeLower && mLower <= other.mLower );
470 if ( !other.mUpper.isValid() && mUpper.isValid() )
473 if ( mUpper.isValid() )
475 const bool upperOk = ( mIncludeUpper && mUpper >= other.mUpper )
476 || ( !mIncludeUpper && mUpper > other.mUpper )
477 || ( !mIncludeUpper && !other.mIncludeUpper && mUpper >= other.mUpper );
490 if ( !element.isValid() )
493 if ( mLower.isValid() )
495 const bool lowerOk = ( mIncludeLower && mLower <= element )
496 || ( !mIncludeLower && mLower < element );
501 if ( mUpper.isValid() )
503 const bool upperOk = ( mIncludeUpper && mUpper >= element )
504 || ( !mIncludeUpper && mUpper > element );
517 if ( !mUpper.isValid() && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
520 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
521 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
524 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
525 && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
528 if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
529 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
532 if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
533 && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
536 if ( mLower == other.mLower && mUpper == other.mUpper )
558 mLower = other.
begin();
559 mUpper = other.
end();
566 bool changed {
false };
569 if ( ! other.
begin().isValid()
570 || (
begin().isValid() && other.
begin() < mLower ) )
572 mLower = other.
begin();
578 mIncludeLower =
true;
583 if ( ! other.
end().isValid()
584 || (
end().isValid() && other.
end() > mUpper ) )
586 mUpper = other.
end();
590 else if ( other.
end() == mUpper && other.
includeEnd() && ! mIncludeUpper )
592 mIncludeUpper =
true;
615 if ( ranges.empty() )
618 QList< QgsTemporalRange<T > > sortedRanges = ranges;
621 QList< QgsTemporalRange<T>> res;
622 res.reserve( sortedRanges.size() );
625 auto it = sortedRanges.constBegin();
627 for ( ; it != sortedRanges.constEnd(); ++it )
646 return mLower == other.mLower &&
647 mUpper == other.mUpper &&
654 return ( !
operator==( other ) );
661 bool mIncludeLower =
true;
662 bool mIncludeUpper =
true;
QgsRange which stores a range of double values.
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=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).
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.
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.