]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/duration.hh
* lily/global-context.cc (run_iterator_on_me): fix grace note
[lilypond.git] / lily / include / duration.hh
1 /*
2   duration.hh -- declare Duration
3   
4   source file of the LilyPond music typesetter
5
6   (c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 */
9
10 #ifndef DURATION_HH
11 #define DURATION_HH
12
13 #include "flower-proto.hh"
14 #include "moment.hh"
15 #include "smobs.hh"
16
17 /**
18    A musical duration.
19   */
20 struct Duration {
21 public:
22   
23   Duration ();
24   Duration (int, int);
25   String to_string () const;
26
27   Duration compressed (Rational) const;
28   Rational get_length () const ;
29   Rational factor () const { return factor_; }
30   int duration_log ()const;
31   int dot_count () const;
32
33   static int compare (Duration const&, Duration const&);
34
35   DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
36   DECLARE_SIMPLE_SMOBS (Duration,);
37
38 private:
39     /// Logarithm of the base duration.
40   int durlog_;
41   int dots_;
42
43   Rational factor_;
44 };
45
46 #include "compare.hh"
47 INSTANTIATE_COMPARE (Duration, Duration::compare);
48 DECLARE_UNSMOB (Duration, duration);
49
50 #endif // DURATION_HH
51