X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fposition.h;h=3c561d85c2b14b909b2f7e1fd2445bed662ff189;hb=0a20f4b0ee59f06732648f981fe4d3e387b5705a;hp=f904fe6616d7717d1f4983dbd77ef1148cc78c34;hpb=320a74efb8d9c8aacded2799459a92d5b7235d90;p=dcpomatic.git diff --git a/src/lib/position.h b/src/lib/position.h index f904fe661..3c561d85c 100644 --- a/src/lib/position.h +++ b/src/lib/position.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,11 +17,11 @@ */ -#ifndef DVDOMATIC_POSITION_H -#define DVDOMATIC_POSITION_H +#ifndef DCPOMATIC_POSITION_H +#define DCPOMATIC_POSITION_H /** @struct Position - * @brief A position. + * @brief A position (x and y coordinates) */ template class Position @@ -43,4 +43,32 @@ public: T y; }; +template +Position +operator+ (Position const & a, Position const & b) +{ + return Position (a.x + b.x, a.y + b.y); +} + +template +Position +operator- (Position const & a, Position const & b) +{ + return Position (a.x - b.x, a.y - b.y); +} + +template +bool +operator== (Position const & a, Position const & b) +{ + return a.x == b.x && a.y == b.y; +} + +template +bool +operator!= (Position const & a, Position const & b) +{ + return a.x != b.x || a.y != b.y; +} + #endif