]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/duration.hh
2003 -> 2004
[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   SCM smobbed_copy () const;
36   DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
37   DECLARE_SIMPLE_SMOBS (Duration,);
38
39 private:
40     /// Logarithm of the base duration.
41   int durlog_;
42   int dots_;
43
44   Rational factor_;
45 };
46
47 #include "compare.hh"
48 INSTANTIATE_COMPARE (Duration, Duration::compare);
49 DECLARE_UNSMOB (Duration, duration);
50
51 #endif // DURATION_HH
52