|
AMRange
201909
String localization library
|
Range and set of range operations. More...
#include <AMRange.h>
Public Member Functions | |
| AMRange () | |
| empty constructor Uses T() for init bounds. More... | |
| AMRange (T _from, T _to) | |
| empty constructor Uses T() for init bounds. More... | |
| bool | operator< (const AMRange &right) const |
| less operator Used namely for std::set container More... | |
| AMRange & | operator-= (const AMRange &right) |
| minus operator Cut part of range by intersect with right operand. If ranges are in disjunction, range is unchanged. If right range is inside left (and range will be splitted to two intervals), range become invalid. More... | |
| AMRange & | operator+= (const AMRange &right) |
| plus operator Cut part of range by intersect with right operand. If right range is inside left, range is unchanged. If ranges are in disjunction (and range will splitted to two), range become invalid. More... | |
| bool | operator== (const AMRange &right) const |
| comparison operator Tests both bounds for equality. More... | |
| bool | operator!= (const AMRange &right) const |
| comparison operator If at least one bound not equalt to rught bound. More... | |
| AMRange & | intersect (const AMRange &right) |
| intersect Intersection with right interval If ranges are in disjunction, range become empty More... | |
| bool | valid () const |
| test for validity Simply checks that from bound >= to bound More... | |
| bool | nonEmpty () const |
| test for validity and empty Simply checks that from bound > to bound More... | |
| bool | in (T num) const |
| check that number is inside Remember that interval is open from right, so if num == to, result => false More... | |
| bool | in (const AMRange &rng) const |
| check that number is inside Remember that interval is open from right, so if num == to, result => false More... | |
| bool | empty () const |
| test for empty Simply checks that from bound == to bound More... | |
Public Attributes | |
| T | from |
| left bound | |
| T | to |
| right bound | |
Range and set of range operations.
This range means interval closed from left and open from right < from, to ). Template parameter may be an integer or float types. Any other class as template parameter may works, however is not tested.
There are basic operations for set of ranges. Set of ranges means "interval with gaps" e.q. Second interval start above first ends , thirds interval start above second end etc... Operation with set produces such set of ranges and there is a pack function to ensure this.
| AMCore::AMRange< T >::AMRange |
empty constructor Uses T() for init bounds.
| This | function will not throw an exception. |
| AMCore::AMRange< T >::AMRange | ( | T | _from, |
| T | _to | ||
| ) |
empty constructor Uses T() for init bounds.
| _from | bound |
| _to | bound |
| This | function will not throw an exception. |
|
inline |
test for empty Simply checks that from bound == to bound
| This | function will not throw an exception. |
|
inline |
check that number is inside Remember that interval is open from right, so if num == to, result => false
| rng |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, and AMCore::AMRange< T >::to.
|
inline |
check that number is inside Remember that interval is open from right, so if num == to, result => false
| num |
| This | function will not throw an exception. |
|
inline |
intersect Intersection with right interval If ranges are in disjunction, range become empty
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, and AMCore::AMRange< T >::to.
Referenced by AMCore::intersect().
|
inline |
test for validity and empty Simply checks that from bound > to bound
| This | function will not throw an exception. |
Referenced by AMCore::operator-().
|
inline |
comparison operator If at least one bound not equalt to rught bound.
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, and AMCore::AMRange< T >::to.
|
inline |
plus operator Cut part of range by intersect with right operand. If right range is inside left, range is unchanged. If ranges are in disjunction (and range will splitted to two), range become invalid.
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, AMCore::AMRange< T >::to, AMCore::AMRange< T >::valid(), and AMCore::valid().
|
inline |
minus operator Cut part of range by intersect with right operand. If ranges are in disjunction, range is unchanged. If right range is inside left (and range will be splitted to two intervals), range become invalid.
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, AMCore::AMRange< T >::to, AMCore::AMRange< T >::valid(), and AMCore::valid().
|
inline |
less operator Used namely for std::set container
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, and AMCore::AMRange< T >::to.
|
inline |
comparison operator Tests both bounds for equality.
| right | operand |
| This | function will not throw an exception. |
References AMCore::AMRange< T >::from, and AMCore::AMRange< T >::to.
|
inline |
test for validity Simply checks that from bound >= to bound
| This | function will not throw an exception. |
Referenced by AMCore::AMRange< T >::operator+=(), AMCore::operator-(), AMCore::AMRange< T >::operator-=(), and AMCore::pack().
1.8.17