22 #include "qgis_core.h" 62 T
lower()
const {
return mLower; }
69 T
upper()
const {
return mUpper; }
92 bool isEmpty()
const {
return mLower > mUpper || ( mUpper == mLower && !( mIncludeLower || mIncludeUpper ) ); }
98 bool isSingleton()
const {
return mLower == mUpper && ( mIncludeLower || mIncludeUpper ); }
106 bool lowerOk = ( mIncludeLower && mLower <= other.mLower )
107 || ( !mIncludeLower && mLower < other.mLower )
108 || ( !mIncludeLower && !other.mIncludeLower && mLower <= other.mLower );
112 bool upperOk = ( mIncludeUpper && mUpper >= other.mUpper )
113 || ( !mIncludeUpper && mUpper > other.mUpper )
114 || ( !mIncludeUpper && !other.mIncludeUpper && mUpper >= other.mUpper );
126 bool lowerOk = ( mIncludeLower && mLower <= element )
127 || ( !mIncludeLower && mLower < element );
131 bool upperOk = ( mIncludeUpper && mUpper >= element )
132 || ( !mIncludeUpper && mUpper > element );
145 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
146 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
149 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
150 && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
153 if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
154 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
157 if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
158 && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
161 if ( mLower == other.mLower && mUpper == other.mUpper )
172 bool mIncludeLower =
true;
173 bool mIncludeUpper =
true;
216 template <
typename T>
227 QgsTemporalRange(
const T &begin = T(),
const T &end = T(),
bool includeBeginning =
true,
bool includeEnd =
true )
230 , mIncludeLower( includeBeginning )
231 , mIncludeUpper( includeEnd )
234 QgsTemporalRange(
const T &begin,
const T &end,
bool includeBeginning =
true,
bool includeEnd =
true );
250 T
end()
const {
return mUpper; }
272 bool isInstant()
const {
return mLower.isValid() && mUpper.isValid() && mLower == mUpper && ( mIncludeLower || mIncludeUpper ); }
281 return !mLower.isValid() && !mUpper.isValid();
291 if ( !mLower.isValid() && !mUpper.isValid() )
294 if ( mLower.isValid() != mUpper.isValid() )
297 if ( mLower > mUpper )
300 if ( mLower == mUpper && !( mIncludeLower || mIncludeUpper ) )
311 if ( !other.mLower.isValid() && mLower.isValid() )
314 if ( mLower.isValid() )
316 bool lowerOk = ( mIncludeLower && mLower <= other.mLower )
317 || ( !mIncludeLower && mLower < other.mLower )
318 || ( !mIncludeLower && !other.mIncludeLower && mLower <= other.mLower );
323 if ( !other.mUpper.isValid() && mUpper.isValid() )
326 if ( mUpper.isValid() )
328 bool upperOk = ( mIncludeUpper && mUpper >= other.mUpper )
329 || ( !mIncludeUpper && mUpper > other.mUpper )
330 || ( !mIncludeUpper && !other.mIncludeUpper && mUpper >= other.mUpper );
343 if ( !element.isValid() )
346 if ( mLower.isValid() )
348 bool lowerOk = ( mIncludeLower && mLower <= element )
349 || ( !mIncludeLower && mLower < element );
354 if ( mUpper.isValid() )
356 bool upperOk = ( mIncludeUpper && mUpper >= element )
357 || ( !mIncludeUpper && mUpper > element );
370 if ( !mUpper.isValid() && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
373 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
374 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
377 if ( ( ( mIncludeLower && mLower <= other.mLower ) || ( !mIncludeLower && mLower < other.mLower ) )
378 && ( ( mIncludeUpper && mUpper >= other.mLower ) || ( !mIncludeUpper && mUpper > other.mLower ) ) )
381 if ( ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) )
382 && ( ( mIncludeUpper && mUpper >= other.mUpper ) || ( !mIncludeUpper && mUpper > other.mUpper ) ) )
385 if ( ( ( mIncludeLower && mLower >= other.mLower ) || ( !mIncludeLower && mLower > other.mLower ) )
386 && ( ( mIncludeLower && mLower <= other.mUpper ) || ( !mIncludeLower && mLower < other.mUpper ) ) )
389 if ( mLower == other.mLower && mUpper == other.mUpper )
397 return mLower == other.mLower &&
398 mUpper == other.mUpper &&
399 mIncludeLower == other.mIncludeLower &&
400 mIncludeUpper == other.mIncludeUpper;
407 bool mIncludeLower =
true;
408 bool mIncludeUpper =
true;
bool contains(const QgsTemporalRange< T > &other) const
Returns true if this range contains another range.
bool includeEnd() const
Returns true if the end is inclusive, or false if the end is exclusive.
bool isInfinite() const
Returns true if the range consists of all possible values.
A template based class for storing temporal ranges (beginning to end values).
bool overlaps(const QgsRange< T > &other) const
Returns true if this range overlaps another range.
T lower() const
Returns the lower bound of the range.
QgsTemporalRange(const T &begin=T(), const T &end=T(), bool includeBeginning=true, bool includeEnd=true)
Constructor for QgsTemporalRange.
bool isEmpty() const
Returns true if the range is empty, ie the lower bound equals (or exceeds) the upper bound and either...
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 isEmpty() const
Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bo...
QgsRange< double > QgsDoubleRange
QgsRange which stores a range of double values.
bool isSingleton() const
Returns true if the range consists only of a single value or instant.
bool contains(const QgsRange< T > &other) const
Returns true if this range contains another range.
bool isInstant() const
Returns true if the range consists only of a single instant.
bool operator==(const QgsTemporalRange< T > &other) const
bool overlaps(const QgsTemporalRange< T > &other) const
Returns true if this range overlaps another range.
bool includeUpper() const
Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.
bool includeBeginning() const
Returns true if the beginning is inclusive, or false if the beginning is exclusive.
bool includeLower() const
Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.
QgsTemporalRange< QDate > QgsDateRange SIP_DOC_TEMPLATE
QgsRange which stores a range of dates.
T upper() const
Returns the upper bound of the range.
QgsRange(T lower, T upper, bool includeLower=true, bool includeUpper=true)
Constructor for QgsRange.
A template based class for storing ranges (lower to upper values).
QgsRange< int > QgsIntRange
QgsRange which stores a range of integer values.
bool contains(T element) const
Returns true if this range contains a specified element.
T end() const
Returns the upper bound of the range.