X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fdirection.hh;h=ceff68fe5506dc135e5cfebba40f0e4b203f79bc;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=902f2fa2b8182a5a7d4aa81152ba3f4e00ea7768;hpb=fc3e875d6bf06f0680e897faffdcab36ad975a03;p=lilypond.git diff --git a/flower/include/direction.hh b/flower/include/direction.hh index 902f2fa2b8..ceff68fe55 100644 --- a/flower/include/direction.hh +++ b/flower/include/direction.hh @@ -3,29 +3,39 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2000 Han-Wen Nienhuys + (c) 1997--2008 Han-Wen Nienhuys */ - #ifndef DIRECTION_HH #define DIRECTION_HH -#include "axes.hh" +#include "axis.hh" -enum Direction -{ - UP=1, - DOWN=-1, - LEFT=-1, - RIGHT=1, - MIN=-1, - MAX=1, - CENTER=0, - SMALLER=-1, - BIGGER=1, - START = -1, - STOP = 1, -}; +enum Direction + { + UP = 1, + DOWN=-1, + LEFT=-1, + RIGHT = 1, + MIN=-1, + MAX = 1, + CENTER = 0, + SMALLER=-1, + BIGGER = 1, + START = -1, + STOP = 1, + + /* + This is necessary to safely write loops, + since + + dir <= RIGHT + + is otherwise transformed into true unconditionally. + */ + DIRECTION_LIMIT = 2, + DIRECTION_NEG_LIMIT = -2, + }; inline Direction other_dir (Direction const d) @@ -41,10 +51,11 @@ operator - (Direction const d) // huh? inline Direction -flip (Direction *i) { +flip (Direction *i) +{ if (*i == (Direction)1) - *i = (Direction)-1; - else if (*i == (Direction)-1) + *i = (Direction) - 1; + else if (*i == (Direction) - 1) *i = (Direction)1; return *i; } @@ -52,9 +63,9 @@ flip (Direction *i) { /** if d > 0: the max operator if d < 0: the min operator - */ +*/ template T minmax (Direction d, T, T); -// String direction_str (Direction, Axis); +// String direction_string (Direction, Axis); #endif // DIRECTION_HH