00001 #ifndef KDE__POINT_H
00002 #define KDE__POINT_H
00003
00004 #include <faith/tools.h>
00005
00006 namespace Faith
00007 {
00008
00009 class FAITH_TOOLS_EXPORT Point
00010 {
00011 int mX, mY;
00012 public:
00013 Point(int x, int y)
00014 : mX(x), mY(y)
00015 { }
00016 Point()
00017 : mX(0), mY(0)
00018 { }
00019
00020 bool operator ==(const Point &other) const
00021 {
00022 return
00023 other.mX == mX
00024 && other.mY == mY;
00025 }
00026
00027 Faith::Point &operator +=(const Faith::Point &other)
00028 {
00029 mX += other.mX;
00030 mY += other.mY;
00031 return *this;
00032 }
00033
00034 Faith::Point &operator -=(const Faith::Point &other)
00035 {
00036 mX -= other.mX;
00037 mY -= other.mY;
00038 return *this;
00039 }
00040
00041 Faith::Point operator -() const
00042 {
00043 return Point(-mX, -mY);
00044 }
00045
00046 inline int x() const { return mX; }
00047 inline int y() const { return mY; }
00048
00049 inline void setX(int x) { mX = x; }
00050 inline void setY(int y) { mY = y; }
00051 };
00052
00053 inline Point operator +(Point a, const Point &b)
00054 {
00055 return a += b;
00056 }
00057
00058 inline Point operator -(Point a, const Point &b)
00059 {
00060 return a -= b;
00061 }
00062
00063 }
00064
00065 #endif