From ba16526a792dc8d4ef4d9ec025c3f1d19d5d165f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 24 Jan 2007 02:27:00 +0100 Subject: make spanned_rank_iv() const; add Spanner::spanned_time() method --- lily/spanner.cc | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'lily/spanner.cc') diff --git a/lily/spanner.cc b/lily/spanner.cc index e1fe55efe1..8a1e9e62c9 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -14,6 +14,7 @@ #include "stencil.hh" #include "system.hh" #include "warn.hh" +#include "moment.hh" Grob * Spanner::clone () const @@ -145,7 +146,7 @@ Spanner::set_my_columns () } Interval_t -Spanner::spanned_rank_iv () +Spanner::spanned_rank_iv () const { Interval_t iv (0, 0); @@ -156,6 +157,31 @@ Spanner::spanned_rank_iv () return iv; } +Interval_t +Spanner::spanned_time () const +{ + Interval_t iv; + + Direction d = LEFT; + do + { + if (spanned_drul_[d] && spanned_drul_[d]->get_column ()) + iv[d] = robust_scm2moment (spanned_drul_[d]->get_column ()->get_property ("when"), + iv[d]); + } + while (flip (&d) != LEFT); + + do + { + if (!spanned_drul_[d] || !spanned_drul_[d]->get_column ()) + iv[d] = iv[-d]; + } + while (flip (&d) != LEFT); + + + return iv; +} + Item * Spanner::get_bound (Direction d) const { -- cgit v1.2.3