QGIS API Documentation 3.37.0-Master (df6056bf1be)
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
QgsRange< T > Class Template Reference

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

#include <qgsrange.h>

Public Member Functions

 QgsRange (T lower, T upper, bool includeLower=true, bool includeUpper=true)
 Constructor for QgsRange.
 
 QgsRange (T lower, T upper, Qgis::RangeLimits limits)
 Constructor for QgsRange.
 
bool contains (const QgsRange< T > &other) const
 Returns true if this range contains another range.
 
bool contains (T element) const
 Returns true if this range contains a specified element.
 
bool includeLower () const
 Returns true if the lower bound is inclusive, or false if the lower bound is exclusive.
 
bool includeUpper () const
 Returns true if the upper bound is inclusive, or false if the upper bound is exclusive.
 
bool 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.
 
bool isSingleton () const
 Returns true if the range consists only of a single value or instant.
 
lower () const
 Returns the lower bound of the range.
 
bool operator!= (const QgsRange< T > &other) const
 
bool operator== (const QgsRange< T > &other) const
 
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.
 
upper () const
 Returns the upper bound of the range.
 

Protected Attributes

bool mIncludeLower = true
 
bool mIncludeUpper = true
 
mLower
 
mUpper
 

Detailed Description

template<typename T>
class QgsRange< T >

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.

See also
QgsDoubleRange
QgsIntRange
Note
not available in Python bindings (but class provided for template-based inheritance)

Definition at line 45 of file qgsrange.h.

Constructor & Destructor Documentation

◆ QgsRange() [1/2]

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

Constructor for QgsRange.

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

Definition at line 53 of file qgsrange.h.

◆ QgsRange() [2/2]

template<typename T >
QgsRange< T >::QgsRange ( lower,
upper,
Qgis::RangeLimits  limits 
)
inline

Constructor for QgsRange.

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

Since
QGIS 3.38

Definition at line 66 of file qgsrange.h.

Member Function Documentation

◆ contains() [1/2]

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

Returns true if this range contains another range.

See also
overlaps()

Definition at line 137 of file qgsrange.h.

◆ contains() [2/2]

template<typename T >
bool QgsRange< T >::contains ( element) const
inline

Returns true if this range contains a specified element.

Definition at line 157 of file qgsrange.h.

◆ includeLower()

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

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

See also
lower()
includeUpper()

Definition at line 93 of file qgsrange.h.

◆ includeUpper()

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

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

See also
upper()
includeLower()

Definition at line 101 of file qgsrange.h.

◆ isEmpty()

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

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

See also
isSingleton()

Definition at line 125 of file qgsrange.h.

◆ isSingleton()

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

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

See also
isEmpty()

Definition at line 131 of file qgsrange.h.

◆ lower()

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

Returns the lower bound of the range.

See also
upper()
includeLower()

Definition at line 78 of file qgsrange.h.

◆ operator!=()

template<typename T >
bool QgsRange< T >::operator!= ( const QgsRange< T > &  other) const
inline

Definition at line 208 of file qgsrange.h.

◆ operator==()

template<typename T >
bool QgsRange< T >::operator== ( const QgsRange< T > &  other) const
inline

Definition at line 200 of file qgsrange.h.

◆ overlaps()

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

Returns true if this range overlaps another range.

See also
contains()

Definition at line 176 of file qgsrange.h.

◆ rangeLimits()

template<typename T >
Qgis::RangeLimits QgsRange< T >::rangeLimits ( ) const
inline

Returns the limit handling of the range.

Since
QGIS 3.38

Definition at line 108 of file qgsrange.h.

◆ upper()

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

Returns the upper bound of the range.

See also
lower()
includeUpper()

Definition at line 85 of file qgsrange.h.

Member Data Documentation

◆ mIncludeLower

template<typename T >
bool QgsRange< T >::mIncludeLower = true
protected

Definition at line 217 of file qgsrange.h.

◆ mIncludeUpper

template<typename T >
bool QgsRange< T >::mIncludeUpper = true
protected

Definition at line 218 of file qgsrange.h.

◆ mLower

template<typename T >
T QgsRange< T >::mLower
protected

Definition at line 215 of file qgsrange.h.

◆ mUpper

template<typename T >
T QgsRange< T >::mUpper
protected

Definition at line 216 of file qgsrange.h.


The documentation for this class was generated from the following file: