]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/direction.hh
release: 1.1.32
[lilypond.git] / flower / include / direction.hh
1 /*
2   direction.hh -- declare Direction
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef DIRECTION_HH
11 #define DIRECTION_HH
12
13 #include "axes.hh"
14
15 enum Direction 
16 {
17   UP=1,
18   DOWN=-1,
19   LEFT=-1,
20   RIGHT=1,
21   MIN=-1,
22   MAX=1,
23   CENTER=0,
24   SMALLER=-1,
25   BIGGER=1,
26   START = -1,
27   STOP = 1
28 };
29
30 inline Direction
31 other_dir (Direction const d)
32 {
33   return (Direction)(-d);
34 }
35
36 inline Direction
37 operator - (Direction const d)
38 {
39   return other_dir (d);
40 }
41
42 // huh?
43 inline Direction
44 flip (Direction *i) {
45   if (*i == (Direction)1)
46     *i = (Direction)-1;
47   else if (*i == (Direction)-1)
48     *i = (Direction)1;
49   return *i;
50 }
51
52 /**
53    if d > 0: the max operator
54    if d < 0: the min operator
55  */
56 template<class T> T minmax (Direction d, T, T);
57
58 // String direction_str (Direction, Axis);
59
60 #endif // DIRECTION_HH