| 15 | |
| 16 | template<typename T> |
| 17 | struct TSize |
| 18 | { |
| 19 | T width{}; |
| 20 | T height{}; |
| 21 | |
| 22 | TSize() = default; |
| 23 | |
| 24 | TSize(T const& _width, T const& _height) : |
| 25 | width(_width), |
| 26 | height(_height) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | TSize& operator-=(TSize const& _obj) |
| 31 | { |
| 32 | width -= _obj.width; |
| 33 | height -= _obj.height; |
| 34 | return *this; |
| 35 | } |
| 36 | |
| 37 | TSize& operator+=(TSize const& _obj) |
| 38 | { |
| 39 | width += _obj.width; |
| 40 | height += _obj.height; |
| 41 | return *this; |
| 42 | } |
| 43 | |
| 44 | TSize operator-(TSize const& _obj) const |
| 45 | { |
| 46 | return TSize(width - _obj.width, height - _obj.height); |
| 47 | } |
| 48 | |
| 49 | TSize operator+(TSize const& _obj) const |
| 50 | { |
| 51 | return TSize(width + _obj.width, height + _obj.height); |
| 52 | } |
| 53 | |
| 54 | template<typename U> |
| 55 | TSize& operator=(TSize<U> const& _obj) |
| 56 | { |
| 57 | width = _obj.width; |
| 58 | height = _obj.height; |
| 59 | return *this; |
| 60 | } |
| 61 | |
| 62 | bool operator==(TSize const& _obj) const |
| 63 | { |
| 64 | return ((width == _obj.width) && (height == _obj.height)); |
| 65 | } |
| 66 | |
| 67 | bool operator!=(TSize const& _obj) const |
| 68 | { |
| 69 | return !((width == _obj.width) && (height == _obj.height)); |
| 70 | } |
| 71 | |
| 72 | void clear() |
| 73 | { |
| 74 | width = height = 0; |