Restyled geometry.h

Wed, 20 Jul 2016 15:07:57 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Wed, 20 Jul 2016 15:07:57 +0300
changeset 144
e8d58327cd7f
parent 143
b9993733952a
child 145
d0aedc9be448

Restyled geometry.h

sources/geometry.h file | annotate | diff | comparison | revisions
--- a/sources/geometry.h	Wed Jul 20 15:07:03 2016 +0300
+++ b/sources/geometry.h	Wed Jul 20 15:07:57 2016 +0300
@@ -30,90 +30,91 @@
 
 #pragma once
 #include "basics.h"
+
 BEGIN_ZFC_NAMESPACE
 
+
 struct Position
 {
 	int x;
 	int y;
 
-	Position (int x, int y) :
-		x (x),
-		y (y) {}
+	Position(int x, int y) :
+		x(x),
+		y(y) {}
 
 	Position() :
-		x (0),
-		y (0) {}
+		x(0),
+		y(0) {}
 
-	bool operator< (const Position& other) const
+	bool operator<(const Position& other) const
 	{
 		if (y != other.y)
 			return y < other.y;
-
-		return x < other.x;
+		else
+			return x < other.x;
 	}
 
-	bool operator> (const Position& other) const
+	bool operator>(const Position& other) const
 	{
 		if (y != other.y)
 			return y > other.y;
-
-		return x > other.x;
+		else
+			return x > other.x;
 	}
 
-	bool operator== (const Position& other) const
+	bool operator==(const Position& other) const
 	{
 		return y == other.y and x == other.x;
 	}
 
-	bool operator!= (const Position& other) const
+	bool operator!=(const Position& other) const
 	{
-		return not operator== (other);
+		return not operator==(other);
 	}
 
-	bool operator<= (const Position& other) const
+	bool operator<=(const Position& other) const
 	{
-		return not operator> (other);
+		return not operator>(other);
 	}
 
-	bool operator>= (const Position& other) const
+	bool operator>=(const Position& other) const
 	{
-		return not operator< (other);
+		return not operator<(other);
 	}
 };
 
-// -------------------------------------------------------------------------------------------------
 
 struct Size
 {
 	int width;
 	int height;
 
-	Size (int width, int height) :
-		width (width),
-		height (height) {}
+	Size(int width, int height) :
+		width(width),
+		height(height) {}
 
 	Size() :
-		width (0),
-		height (0) {}
+		width(0),
+		height(0) {}
 
-	auto area() const -> int
+	int area() const
 	{
 		return width * height;
 	}
 };
 
-// -------------------------------------------------------------------------------------------------
 
 struct Rectangle : Position, Size
 {
-	Rectangle (int x, int y, int width, int height) :
-		Position (x, y),
-		Size (width, height) {}
+	Rectangle(int x, int y, int width, int height) :
+		Position(x, y),
+		Size(width, height) {}
 
 	Rectangle() :
 		Position(),
 		Size() {}
 };
 
+
 END_ZFC_NAMESPACE

mercurial