]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/direction.hh
Issue 4548: eliminate flip(Direction*)
[lilypond.git] / flower / include / direction.hh
index 97c0f6d79bb59ee9f790c250a71f66c120df3a99..de13ef4ca8a6341ea7ce843f22fdc76e00f982bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -49,26 +49,9 @@ enum Direction
 };
 
 inline Direction
-other_dir (Direction const d)
+operator - (Direction d)
 {
-  return (Direction) (-d);
-}
-
-inline Direction
-operator - (Direction const d)
-{
-  return other_dir (d);
-}
-
-// to be deleted soon (after coping with issues 2491 and 2493
-inline Direction
-flip (Direction *i)
-{
-  if (*i == (Direction)1)
-    *i = (Direction) - 1;
-  else if (*i == (Direction) - 1)
-    *i = (Direction)1;
-  return *i;
+  return Direction (- static_cast<int> (d)); // cast avoids recursion
 }
 
 #define UP_and_DOWN(d) \
@@ -80,7 +63,6 @@ flip (Direction *i)
 #define LEFT_and_RIGHT(d) \
   Direction d = LEFT; d != CENTER; d = (d == LEFT ? RIGHT : CENTER)
 
-
 /**
    if d > 0: the max operator
    if d < 0: the min operator
@@ -93,6 +75,4 @@ template<class T> T minmax (Direction d, T a, T b)
     return min (a, b);
 }
 
-// String direction_string (Direction, Axis);
-
 #endif // DIRECTION_HH