diff options
-rw-r--r-- | src/utils/point.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/utils/point.h b/src/utils/point.h index 8436b8c4..4402aa09 100644 --- a/src/utils/point.h +++ b/src/utils/point.h @@ -22,8 +22,7 @@ #define POINT_H #include <algorithm> -#include <string> -#include <sstream> +#include <ostream> /** * A point in positive space. Usually represents pixel coordinates on a map. @@ -60,13 +59,6 @@ class Point { return (x != other.x || y != other.y); } - - std::string str() const - { - std::ostringstream ssPoint; - ssPoint << "(" << x << ", " << y << ")"; - return ssPoint.str(); - } }; /** @@ -96,4 +88,17 @@ class Rectangle } }; +inline std::ostream &operator <<(std::ostream &os, const Point &point) +{ + os << '(' << point.x << ", " << point.y << ')'; + return os; +} + +inline std::ostream &operator <<(std::ostream &os, const Rectangle &rect) +{ + os << '(' << rect.x << ',' << rect.y + << ' ' << rect.w << 'x' << rect.h << ')'; + return os; +} + #endif // POINT_H |