]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/direction.hh
patch::: 1.1.60.jcn2
[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   X=1,
29   Y=-1,
30 };
31
32 inline Direction
33 other_dir (Direction const d)
34 {
35   return (Direction)(-d);
36 }
37
38 inline Direction
39 operator - (Direction const d)
40 {
41   return other_dir (d);
42 }
43
44 // huh?
45 inline Direction
46 flip (Direction *i) {
47   if (*i == (Direction)1)
48     *i = (Direction)-1;
49   else if (*i == (Direction)-1)
50     *i = (Direction)1;
51   return *i;
52 }
53
54 /**
55    if d > 0: the max operator
56    if d < 0: the min operator
57  */
58 template<class T> T minmax (Direction d, T, T);
59
60 // String direction_str (Direction, Axis);
61
62 #endif // DIRECTION_HH