X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fposition.h;h=3c561d85c2b14b909b2f7e1fd2445bed662ff189;hb=769c71b5c3e050ccfc1c13771d24328fbf76a495;hp=f904fe6616d7717d1f4983dbd77ef1148cc78c34;hpb=b655bd3359e9a014da68cd9f61e2a5b1d233247d;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