Merge master.
[dcpomatic.git] / src / lib / position.h
index f904fe6616d7717d1f4983dbd77ef1148cc78c34..345f7ab4a85bcd8b0cd7565543e4736f26e90968 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     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
 
 */
 
-#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 T>
 class Position
@@ -43,4 +43,25 @@ public:
        T y;
 };
 
+template<class T>
+Position<T>
+operator+ (Position<T> const & a, Position<T> const & b)
+{
+       return Position<T> (a.x + b.x, a.y + b.y);
+}
+
+template<class T>
+Position<T>
+operator- (Position<T> const & a, Position<T> const & b)
+{
+       return Position<T> (a.x - b.x, a.y - b.y);
+}
+
+template<class T>
+bool
+operator== (Position<T> const & a, Position<T> const & b)
+{
+       return a.x == b.x && a.y == b.y;
+}
+
 #endif