template<typename T>
QgsRange class

A template based class for storing ranges (lower to upper values).

QgsRange classes represent a range of values of some element type. For instance, ranges of int might be used to represent integer ranges.

Ranges can indicate whether the upper and lower values are inclusive or exclusive. The inclusivity or exclusivity of bounds is considered when determining things like whether ranges overlap or during calculation of range intersections.

Constructors, destructors, conversion operators

QgsRange(T lower, T upper, bool includeLower = true, bool includeUpper = true)
Constructor for QgsRange.

Public functions

auto contains(const QgsRange<T>& other) const -> bool
Returns true if this range contains another range.
auto contains(T element) const -> bool
Returns true if this range contains a specified element.
auto includeLower() const -> bool
Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.
auto includeUpper() const -> bool
Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.
auto isEmpty() const -> bool
Returns true if the range is empty, ie the lower bound equals (or exceeds) the upper bound and either the bounds are exclusive.
auto isSingleton() const -> bool
Returns true if the range consists only of a single value or instant.
auto lower() const -> T
Returns the lower bound of the range.
auto overlaps(const QgsRange<T>& other) const -> bool
Returns true if this range overlaps another range.
auto upper() const -> T
Returns the upper bound of the range.

Function documentation

template<typename T>
QgsRange<T>::QgsRange(T lower, T upper, bool includeLower = true, bool includeUpper = true)

Constructor for QgsRange.

The lower and upper bounds are specified, and optionally whether or not these bounds are included in the range.

template<typename T>
bool QgsRange<T>::contains(const QgsRange<T>& other) const

Returns true if this range contains another range.

template<typename T>
bool QgsRange<T>::includeLower() const

Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.

template<typename T>
bool QgsRange<T>::includeUpper() const

Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.

template<typename T>
bool QgsRange<T>::isEmpty() const

Returns true if the range is empty, ie the lower bound equals (or exceeds) the upper bound and either the bounds are exclusive.

template<typename T>
bool QgsRange<T>::isSingleton() const

Returns true if the range consists only of a single value or instant.

template<typename T>
T QgsRange<T>::lower() const

Returns the lower bound of the range.

template<typename T>
bool QgsRange<T>::overlaps(const QgsRange<T>& other) const

Returns true if this range overlaps another range.

template<typename T>
T QgsRange<T>::upper() const

Returns the upper bound of the range.