]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/moment.hh
* scm/music-functions.scm (has-request-chord): don't use
[lilypond.git] / lily / include / moment.hh
1 /*   
2   moment.hh -- declare Moment
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef MOMENT_HH
11 #define MOMENT_HH
12
13 #include "smobs.hh"
14 #include "rational.hh"
15
16 /**
17    Musical timing (Main-timing, grace-timing) with glue for
18    Guilification;
19 */
20 class Moment
21 {
22   DECLARE_SIMPLE_SMOBS (Moment, );
23 public:
24   Moment ();
25   Moment (int m);
26
27   Moment (Rational, Rational);
28   Moment (Rational m);
29
30   Moment operator - () const;
31   
32   void operator += (Moment const &m);
33   void operator -= (Moment const &m);  
34
35   void operator *= (Moment const &m);
36   void operator /= (Moment const &m);  
37
38   Rational main_part_;
39   Rational grace_part_;
40
41   void set_infinite (int k);
42
43   bool to_bool () const;
44   int den () const;
45   int num () const;
46   /*
47     Deliver a copy of THIS as a smobified SCM
48    */
49   String to_string () const;
50   static int compare (Moment const&, Moment const&);
51   SCM as_scheme () const;
52 };
53 IMPLEMENT_ARITHMETIC_OPERATOR (Moment, + );
54 IMPLEMENT_ARITHMETIC_OPERATOR (Moment, - );
55 IMPLEMENT_ARITHMETIC_OPERATOR (Moment, / );
56 IMPLEMENT_ARITHMETIC_OPERATOR (Moment, * );
57
58
59 DECLARE_UNSMOB(Moment, moment);
60 int compare (Moment const&, Moment const&);
61 INSTANTIATE_COMPARE (Moment const&, Moment::compare);
62
63 Moment robust_scm2moment (SCM, Moment);
64
65 #ifdef STREAM_SUPPORT
66 std::ostream & operator << (std::ostream &, Moment const &);
67 #endif
68
69 bool moment_less (SCM a, SCM b);
70
71 #endif /* MOMENT_HH */
72