/*
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
#ifndef DIRECTION_HH
#define DIRECTION_HH
+#include <algorithm>
#include "axis.hh"
enum Direction
};
inline Direction
-other_dir (Direction const d)
+operator - (Direction d)
{
- return (Direction) (-d);
+ return Direction (- static_cast<int> (d)); // cast avoids recursion
}
-inline Direction
-operator - (Direction const d)
-{
- return other_dir (d);
-}
+#define UP_and_DOWN(d) \
+ Direction d = UP; d != CENTER; d = (d == UP ? DOWN : CENTER)
-// huh?
-inline Direction
-flip (Direction *i)
-{
- if (*i == (Direction)1)
- *i = (Direction) - 1;
- else if (*i == (Direction) - 1)
- *i = (Direction)1;
- return *i;
-}
+#define DOWN_and_UP(d) \
+ Direction d = DOWN; d != CENTER; d = (d == DOWN ? UP : CENTER)
+
+#define LEFT_and_RIGHT(d) \
+ Direction d = LEFT; d != CENTER; d = (d == LEFT ? RIGHT : CENTER)
/**
if d > 0: the max operator
return min (a, b);
}
-// String direction_string (Direction, Axis);
-
#endif // DIRECTION_HH