|
1 |
| -class QgsDoubleRange |
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/qgsrange.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +template <T> class QgsRange |
2 | 13 | {
|
3 |
| -%TypeHeaderCode |
4 |
| -#include <qgsrange.h> |
5 |
| -%End |
| 14 | +%Docstring |
| 15 | + A template based class for storing ranges (lower to upper values). |
6 | 16 |
|
| 17 | + QgsRange classes represent a range of values of some element type. For instance, |
| 18 | + ranges of int might be used to represent integer ranges. |
| 19 | + |
| 20 | + Ranges can indicate whether the upper and lower values are inclusive or exclusive. |
| 21 | + The inclusivity or exclusivity of bounds is considered when determining things like |
| 22 | + whether ranges overlap or during calculation of range intersections. |
| 23 | + |
| 24 | +.. versionadded:: 3.0 |
| 25 | +.. seealso:: QgsDoubleRange |
| 26 | +.. seealso:: QgsIntRange |
| 27 | +.. note:: |
| 28 | + |
| 29 | + not available in Python bindings (but class provided for template-based inheritance) |
| 30 | +%End |
7 | 31 | public:
|
8 | 32 |
|
9 |
| - QgsDoubleRange( double lower, double upper, bool includeLower = true, bool includeUpper = true ); |
10 |
| - double lower() const; |
11 |
| - double upper() const; |
12 |
| - bool includeLower() const; |
13 |
| - bool includeUpper() const; |
14 |
| - bool isEmpty() const; |
15 |
| - bool isSingleton() const; |
16 |
| - bool contains( const QgsDoubleRange &other ) const; |
17 |
| - bool contains( double element ) const; |
18 |
| - bool overlaps( const QgsDoubleRange &other ) const; |
19 |
| -}; |
| 33 | + QgsRange( T lower, T upper, bool includeLower = true, bool includeUpper = true ); |
| 34 | +%Docstring |
| 35 | + Constructor for QgsRange. The ``lower`` and ``upper`` bounds are specified, |
| 36 | + and optionally whether or not these bounds are included in the range. |
| 37 | +%End |
20 | 38 |
|
21 |
| -class QgsIntRange |
22 |
| -{ |
23 |
| -%TypeHeaderCode |
24 |
| -#include <qgsrange.h> |
| 39 | + T lower() const; |
| 40 | +%Docstring |
| 41 | + Returns the lower bound of the range. |
| 42 | +.. seealso:: upper() |
| 43 | +.. seealso:: includeLower() |
| 44 | + :rtype: T |
25 | 45 | %End
|
26 | 46 |
|
27 |
| - public: |
| 47 | + T upper() const; |
| 48 | +%Docstring |
| 49 | + Returns the upper bound of the range. |
| 50 | +.. seealso:: lower() |
| 51 | +.. seealso:: includeUpper() |
| 52 | + :rtype: T |
| 53 | +%End |
28 | 54 |
|
29 |
| - QgsIntRange( int lower, int upper, bool includeLower = true, bool includeUpper = true ); |
30 |
| - int lower() const; |
31 |
| - int upper() const; |
32 | 55 | bool includeLower() const;
|
| 56 | +%Docstring |
| 57 | + Returns true if the lower bound is inclusive, or false if the lower |
| 58 | + bound is exclusive. |
| 59 | +.. seealso:: lower() |
| 60 | +.. seealso:: includeUpper() |
| 61 | + :rtype: bool |
| 62 | +%End |
| 63 | + |
33 | 64 | bool includeUpper() const;
|
| 65 | +%Docstring |
| 66 | + Returns true if the upper bound is inclusive, or false if the upper |
| 67 | + bound is exclusive. |
| 68 | +.. seealso:: upper() |
| 69 | +.. seealso:: includeLower() |
| 70 | + :rtype: bool |
| 71 | +%End |
| 72 | + |
34 | 73 | bool isEmpty() const;
|
| 74 | +%Docstring |
| 75 | + Returns true if the range is empty, ie the lower bound equals (or exceeds) the upper bound |
| 76 | + and either the bounds are exclusive. |
| 77 | +.. seealso:: isSingleton() |
| 78 | + :rtype: bool |
| 79 | +%End |
| 80 | + |
35 | 81 | bool isSingleton() const;
|
36 |
| - bool contains( const QgsIntRange &other ) const; |
37 |
| - bool contains( int element ) const; |
38 |
| - bool overlaps( const QgsIntRange &other ) const; |
39 |
| -}; |
| 82 | +%Docstring |
| 83 | + Returns true if the range consists only of a single value or instant. |
| 84 | +.. seealso:: isEmpty() |
| 85 | + :rtype: bool |
| 86 | +%End |
40 | 87 |
|
41 |
| -class QgsDateRange |
42 |
| -{ |
43 |
| -%TypeHeaderCode |
44 |
| -#include <qgsrange.h> |
| 88 | + bool contains( const QgsRange<T> &other ) const; |
| 89 | +%Docstring |
| 90 | + Returns true if this range contains another range. |
| 91 | +.. seealso:: overlaps() |
| 92 | + :rtype: bool |
| 93 | +%End |
| 94 | + |
| 95 | + bool contains( T element ) const; |
| 96 | +%Docstring |
| 97 | + Returns true if this range contains a specified ``element``. |
| 98 | + :rtype: bool |
| 99 | +%End |
| 100 | + |
| 101 | + bool overlaps( const QgsRange<T> &other ) const; |
| 102 | +%Docstring |
| 103 | + Returns true if this range overlaps another range. |
| 104 | +.. seealso:: contains() |
| 105 | + :rtype: bool |
45 | 106 | %End
|
46 | 107 |
|
47 |
| - public: |
48 | 108 |
|
49 |
| - QgsDateRange( const QDate &lower = QDate(), const QDate &upper = QDate(), bool includeLower = true, bool includeUpper = true ); |
50 |
| - QDate begin() const; |
51 |
| - QDate end() const; |
52 |
| - bool includeBeginning() const; |
53 |
| - bool includeEnd() const; |
54 |
| - bool isEmpty() const; |
55 |
| - bool isInstant() const; |
56 |
| - bool isInfinite() const; |
57 |
| - bool contains( const QgsDateRange &other ) const; |
58 |
| - bool contains( const QDate &element ) const; |
59 |
| - bool overlaps( const QgsDateRange &other ) const; |
60 | 109 | };
|
61 | 110 |
|
62 |
| -class QgsDateTimeRange |
| 111 | + |
| 112 | +typedef QgsRange< double > QgsDoubleRange; |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | +typedef QgsRange< int > QgsIntRange; |
| 118 | + |
| 119 | + |
| 120 | +template <T> class QgsTemporalRange |
63 | 121 | {
|
64 |
| -%TypeHeaderCode |
65 |
| -#include <qgsrange.h> |
66 |
| -%End |
| 122 | +%Docstring |
| 123 | + A template based class for storing temporal ranges (beginning to end values). |
| 124 | + |
| 125 | + QgsTemporalRange classes represent a range of values of some temporal type. For instance, |
| 126 | + ranges of QDateTime might be used to represent datetime ranges. |
| 127 | + |
| 128 | + Ranges can indicate whether the upper and lower values are inclusive or exclusive. |
| 129 | + The inclusivity or exclusivity of bounds is considered when determining things like |
| 130 | + whether ranges overlap or during calculation of range intersections. |
67 | 131 |
|
| 132 | +.. versionadded:: 3.0 |
| 133 | +.. seealso:: QgsDateRange |
| 134 | +.. note:: |
| 135 | + |
| 136 | + not available in Python bindings (but class provided for template-based inheritance) |
| 137 | +%End |
68 | 138 | public:
|
69 | 139 |
|
70 |
| - QgsDateTimeRange( const QDateTime &lower = QDateTime(), const QDateTime &upper = QDateTime(), bool includeLower = true, bool includeUpper = true ); |
71 |
| - QDateTime begin() const; |
72 |
| - QDateTime end() const; |
| 140 | + QgsTemporalRange( const T &begin, const T &end, bool includeBeginning = true, bool includeEnd = true ); |
| 141 | +%Docstring |
| 142 | + Constructor for QgsTemporalRange. The ``begin`` and ``end`` are specified, |
| 143 | + and optionally whether or not these bounds are included in the range. |
| 144 | +.. note:: |
| 145 | + |
| 146 | + in Python ``begin`` and ``end`` must be provided. |
| 147 | +%End |
| 148 | + // default constructor as default value for templates is not handled in SIP |
| 149 | + |
| 150 | + T begin() const; |
| 151 | +%Docstring |
| 152 | + Returns the beginning of the range. |
| 153 | +.. seealso:: end() |
| 154 | +.. seealso:: includeBeginning() |
| 155 | + :rtype: T |
| 156 | +%End |
| 157 | + |
| 158 | + T end() const; |
| 159 | +%Docstring |
| 160 | + Returns the upper bound of the range. |
| 161 | +.. seealso:: begin() |
| 162 | +.. seealso:: includeEnd() |
| 163 | + :rtype: T |
| 164 | +%End |
| 165 | + |
73 | 166 | bool includeBeginning() const;
|
| 167 | +%Docstring |
| 168 | + Returns true if the beginning is inclusive, or false if the beginning |
| 169 | + is exclusive. |
| 170 | +.. seealso:: begin() |
| 171 | +.. seealso:: includeEnd() |
| 172 | + :rtype: bool |
| 173 | +%End |
| 174 | + |
74 | 175 | bool includeEnd() const;
|
75 |
| - bool isEmpty() const; |
| 176 | +%Docstring |
| 177 | + Returns true if the end is inclusive, or false if the end is exclusive. |
| 178 | +.. seealso:: end() |
| 179 | +.. seealso:: includeBeginning() |
| 180 | + :rtype: bool |
| 181 | +%End |
| 182 | + |
76 | 183 | bool isInstant() const;
|
| 184 | +%Docstring |
| 185 | + Returns true if the range consists only of a single instant. |
| 186 | +.. seealso:: isEmpty() |
| 187 | +.. seealso:: isInfinite() |
| 188 | + :rtype: bool |
| 189 | +%End |
| 190 | + |
77 | 191 | bool isInfinite() const;
|
78 |
| - bool contains( const QgsDateTimeRange &other ) const; |
79 |
| - bool contains( const QDateTime &element ) const; |
80 |
| - bool overlaps( const QgsDateTimeRange &other ) const; |
| 192 | +%Docstring |
| 193 | + Returns true if the range consists of all possible values. |
| 194 | +.. seealso:: isEmpty() |
| 195 | +.. seealso:: isInstant() |
| 196 | + :rtype: bool |
| 197 | +%End |
| 198 | + |
| 199 | + bool isEmpty() const; |
| 200 | +%Docstring |
| 201 | + Returns true if the range is empty, ie the beginning equals (or exceeds) the end |
| 202 | + and either of the bounds are exclusive. |
| 203 | + A range with both invalid beginning and end is considered infinite and not empty. |
| 204 | + :rtype: bool |
| 205 | +%End |
| 206 | + |
| 207 | + bool contains( const QgsTemporalRange<T> &other ) const; |
| 208 | +%Docstring |
| 209 | + Returns true if this range contains another range. |
| 210 | + :rtype: bool |
| 211 | +%End |
| 212 | + |
| 213 | + bool contains( const T &element ) const; |
| 214 | +%Docstring |
| 215 | + Returns true if this range contains a specified ``element``. |
| 216 | + :rtype: bool |
| 217 | +%End |
| 218 | + |
| 219 | + bool overlaps( const QgsTemporalRange<T> &other ) const; |
| 220 | +%Docstring |
| 221 | + Returns true if this range overlaps another range. |
| 222 | + :rtype: bool |
| 223 | +%End |
| 224 | + |
81 | 225 | };
|
82 | 226 |
|
| 227 | + |
| 228 | +typedef QgsTemporalRange< QDate > QgsDateRange; |
| 229 | + |
| 230 | +typedef QgsTemporalRange< QDateTime > QgsDateTimeRange; |
| 231 | + |
| 232 | +/************************************************************************ |
| 233 | + * This file has been generated automatically from * |
| 234 | + * * |
| 235 | + * src/core/qgsrange.h * |
| 236 | + * * |
| 237 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 238 | + ************************************************************************/ |
0 commit comments