#include <qrange.h>
Public Member Functions | |
| QRange ()=default | |
| Constructs a null range. Null ranges are also considered zero. | |
| ~QRange ()=default | |
| QRange (T start, T end) | |
| QRange(T start, T end) - the constructor with 2 parameters. | |
| QRange (std::pair< T, T > start_end) | |
| QRange(std::pair<T, T> start_end) - A constructor that creates a range based on a pair of set values, where the first element of the pair is the beginning of the range, and the second is the end. | |
| QRange (QString start, QString end, uint8_t first_base, uint8_t second_base=0) | |
| QRange(QString start, QString end, uint8_t first_base, uint8_t second_base = 0) - A constructor that works with different calculus systems where: | |
| QRange (QString start, T offset, uint8_t base) | |
| QRange - A constructor that takes the beginning of the range in a defined calculus systems, the calculus system itself and offset from the beginning. | |
| T | start () const |
| Gets the start of the range. | |
| T | end () const |
| Gets the end of the range. | |
| T | lower () const |
| Gets the lower bound of the range. | |
| T | upper () const |
| Gets the upper bound of the range. | |
| T | middle () const |
| Gets the midpoint of the range. | |
| double | middleAccurate () const |
| Gets the exact center of the range, regardless of its generic type. | |
| T | length () const |
| Gets the length of the range. | |
| QRangeDirection | direction () const |
| Gets the direction of the range. | |
| std::pair< QString, QString > | toAnotherBase (uint8_t base) const |
| Gets the range in another base. | |
| void | setStart (const T start) |
| Sets the start of the range. | |
| void | setEnd (const T end) |
| Sets the end of the range. | |
| void | setDirection (const QRangeDirection &direction) |
| Sets the direction of the range by swapping the start and end. | |
| void | setDirection (int direction) |
| void | reverse (const QRangeDirection &direction=QRangeDirection::Zero) |
| This method changes the values of the start and end of the range relative to the x-axis. | |
| void | reverse (int direction) |
| bool | isPositive (QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| isPositive property. Checks the beginning and end of the range relative to the x-axis. | |
| bool | isNegative (QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| isNegative property. Checks the beginning and end of the range relative to the x-axis. | |
| bool | isMixed () const |
| isMixed property. Checks the beginning and end of the range relative to the x-axis. | |
| bool | isZero () const |
| isZero property. | |
| bool | contains (T number, QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| This method checks whether a number is contained within the range. | |
| bool | contains (const QRange &range, QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| This method checks whether an external range is contained within the source range. | |
| bool | in (const QRange &range, QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| This method checks whether the source range is contained within the external range. | |
| bool | overlays (const QRange &range, QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) const |
| This method checks whether one range overlaps with another. | |
| QRange | operator+ (T number) const |
| Operators +, -, *, /, % perform the appropriate mathematical operations with the start and the end of the range. | |
| QRange | operator- (T number) const |
| QRange | operator* (T number) const |
| QRange | operator/ (T number) const |
| QRange | operator% (T number) const |
| std::pair< QRange, QRange > | operator+ (const QRange &range) const |
| Operator + works the same way as the set union operator. | |
| std::pair< QRange, QRange > | operator- (const QRange &range) const |
| Operator - works the same way as the set difference operator. | |
| QRange | operator* (const QRange &range) const |
| Operator * works the same way as the set intersection operator. | |
| std::pair< QRange, QRange > | operator/ (const QRange &range) const |
| Operator / works the same way as the set complement operator. | |
| bool | operator> (const QRange &range) const |
| Operators >, <. | |
| bool | operator< (const QRange &range) const |
| bool | operator== (const QRange &range) const |
| Operators ==, !=. | |
| bool | operator!= (const QRange &range) const |
| bool | operator>= (const QRange &range) const |
| Operators >=, <=. | |
| bool | operator<= (const QRange &range) const |
Static Public Member Functions | |
| template<typename... Args> | |
| static QRange | min (const Args &... ranges) |
| This method finds the minimum length range from a set of ranges. | |
| template<typename... Args> | |
| static QRange | max (const Args &... ranges) |
| This method finds the maximum length range from a set of ranges. | |
| template<typename... Args> | |
| static QRange | minX (const Args &... ranges) |
| This method finds the minimum range on the x-axis from a set of ranges. | |
| template<typename... Args> | |
| static QRange | maxX (const Args &... ranges) |
| This method finds the maximum range on the x-axis from a set of ranges. | |
| template<typename... Args> | |
| static QRange | minMidX (const Args &... ranges) |
| This method finds the range that is closest to minus infinity on the x-axis. | |
| template<typename... Args> | |
| static QRange | maxMidX (const Args &... ranges) |
| This method finds the range that is closest to plus infinity on the x-axis. | |
| static QList< T > | brake (const QList< QRange > &ranges) |
| Method converts all ranges in the list to a number list. | |
| static QList< QRange > | merge (const QList< T > &numbers) |
| Method converts a list of numbers to the list of ranges. If there is an even number of elements, it will take each 2 numbers and create QRanges, where the first number will be the start of the range and the second will be the end. If there is an odd number of elements, the last QRange will start and end with the value of the last element. | |
| static QList< QRange > | cut (const QRange &range, int number) |
| Method cuts the range into equal parts, the number of which is determined by. | |
| static QRange | combine (const QList< QRange > &ranges, QRangeSensitivity sensitivity=QRangeSensitivity::Sensitive) |
| Method connects ranges from a QList to a single range. | |
Protected Types | |
| using | ArgsType |
| QRange also has several functions with a variable number of parameters. These functions use the alias ArgsType. This allows you to pass in functions (such as QRange::min()) both single objects and arrays. That is, you can simultaneously pass QRange and QList<QRange> to the QRange::min() function and it will calculate the result correctly. | |
Protected Attributes | |
| T | m_start { 0 } |
| T | m_end { 0 } |
| QRangeDirection | m_direction { Zero } |
Static Protected Attributes | |
| static const bool | is_normal_v |
| The library works with certain types of numeric data described below: | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const QRange &range) |
| QDebug | operator<< (QDebug dbg, const QRange &range) |
|
protected |
QRange also has several functions with a variable number of parameters. These functions use the alias ArgsType. This allows you to pass in functions (such as QRange::min()) both single objects and arrays. That is, you can simultaneously pass QRange and QList<QRange> to the QRange::min() function and it will calculate the result correctly.
Constructs a null range. Null ranges are also considered zero.
QRange(T start, T end) - the constructor with 2 parameters.
| start | - the beginning of the range. |
| end | - the end of the range. |
QRange(std::pair<T, T> start_end) - A constructor that creates a range based on a pair of set values, where the first element of the pair is the beginning of the range, and the second is the end.
|
inlineexplicit |
QRange(QString start, QString end, uint8_t first_base, uint8_t second_base = 0) - A constructor that works with different calculus systems where:
| start | - QString value in a certain calculus systems of the beginning of the range. |
| end | - QString value in a certain calculus systems of the end of the range. |
| first_base | - the calculus systems base for the beginning of the range. |
| second_base | - the calculus systems base for the end of the range. |
QRange - A constructor that takes the beginning of the range in a defined calculus systems, the calculus system itself and offset from the beginning.
| start | - QString value in a certain calculus systems of the beginning of the range. |
| offset | - offset from the beginning of the range. |
| base | - the calculus system base for the beginning of the range. |
|
inlinestatic |
Method converts all ranges in the list to a number list.
| ranges | QList of ranges. |
|
inlinestatic |
Method connects ranges from a QList to a single range.
| ranges | |
| sensitivity. | If QRangeSensitivity::Insensitive is set, the resulting range will have the same direction as most ranges with the same direction. |
|
inline |
This method checks whether an external range is contained within the source range.
| range | The external range to check. |
| sensitivity | Sensitivity level for the check. |
|
inline |
This method checks whether a number is contained within the range.
| number | The number to check. |
| sensitivity | Sensitivity level for the check. |
|
inlinestatic |
Method cuts the range into equal parts, the number of which is determined by.
| number. | |
| range | The QRange that should be cut. |
|
inline |
|
inline |
Gets the end of the range.
|
inline |
This method checks whether the source range is contained within the external range.
| range | The external range to check against. |
| sensitivity | Sensitivity level for the check. |
|
inline |
isMixed property. Checks the beginning and end of the range relative to the x-axis.
|
inline |
isNegative property. Checks the beginning and end of the range relative to the x-axis.
| sensitivity | The sensitivity level for the check. |
|
inline |
isPositive property. Checks the beginning and end of the range relative to the x-axis.
| sensitivity | The sensitivity level for the check. |
|
inline |
isZero property.
|
inline |
Gets the length of the range.
|
inline |
Gets the lower bound of the range.
|
inlinestatic |
This method finds the range that is closest to plus infinity on the x-axis.
| ranges | A collection of QRanges in formats described by ArgsType. |
|
inlinestatic |
Method converts a list of numbers to the list of ranges. If there is an even number of elements, it will take each 2 numbers and create QRanges, where the first number will be the start of the range and the second will be the end. If there is an odd number of elements, the last QRange will start and end with the value of the last element.
| numbers |
|
inline |
Gets the midpoint of the range.
|
inline |
Gets the exact center of the range, regardless of its generic type.
|
inlinestatic |
This method finds the range that is closest to minus infinity on the x-axis.
| ranges | A collection of QRanges in formats described by ArgsType. |
Operator * works the same way as the set intersection operator.
| range |
|
inline |
Operator + works the same way as the set union operator.
| range |
Operators +, -, *, /, % perform the appropriate mathematical operations with the start and the end of the range.
| number |
|
inline |
Operator - works the same way as the set difference operator.
| range |
|
inline |
Operator / works the same way as the set complement operator.
| range |
Operators ==, !=.
| range |
Operators >, <.
| range |
Operators >=, <=.
| range |
|
inline |
This method checks whether one range overlaps with another.
| range | The range to check for overlap. |
| sensitivity | Sensitivity level for the check. |
|
inline |
This method changes the values of the start and end of the range relative to the x-axis.
| direction | The direction to reverse the range. QRange<int> r{-1, 10};
r.reverse(Zero); // r == QRange<int>{1, -10}
r.reverse(Minus); // r == QRange<int>{-1, -10}
r.reverse(Plus); // r == QRange<int>{1, 10}
|
|
inline |
|
inline |
Sets the direction of the range by swapping the start and end.
| direction | The QRangeDirection parameter. |
|
inline |
|
inline |
Sets the end of the range.
| end | The end of the range. |
|
inline |
Sets the start of the range.
| start | The beginning of the range. |
|
inline |
Gets the start of the range.
|
inline |
Gets the range in another base.
| base | The base for the calculus system of the beginning and end of the range. |
|
inline |
Gets the upper bound of the range.
|
friend |
|
friend |
|
staticprotected |
The library works with certain types of numeric data described below:
|
protected |
|
protected |
|
protected |