From 666cb250dfbc41e3029c31c6285a73f199651ef4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 21 Jul 2020 00:39:03 +0200 Subject: [PATCH] Allow const operatons on time-selection --- gtk2_ardour/time_selection.cc | 10 +++++----- gtk2_ardour/time_selection.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc index 43e8d95d39..4d59f9dcfb 100644 --- a/gtk2_ardour/time_selection.cc +++ b/gtk2_ardour/time_selection.cc @@ -70,7 +70,7 @@ TimeSelection::consolidate () } samplepos_t -TimeSelection::start () +TimeSelection::start () const { if (empty()) { return 0; @@ -78,7 +78,7 @@ TimeSelection::start () samplepos_t first = max_samplepos; - for (std::list::iterator i = begin(); i != end(); ++i) { + for (std::list::const_iterator i = begin(); i != end(); ++i) { if ((*i).start < first) { first = (*i).start; } @@ -87,13 +87,13 @@ TimeSelection::start () } samplepos_t -TimeSelection::end_sample () +TimeSelection::end_sample () const { samplepos_t last = 0; /* XXX make this work like RegionSelection: no linear search needed */ - for (std::list::iterator i = begin(); i != end(); ++i) { + for (std::list::const_iterator i = begin(); i != end(); ++i) { if ((*i).end > last) { last = (*i).end; } @@ -102,7 +102,7 @@ TimeSelection::end_sample () } samplecnt_t -TimeSelection::length() +TimeSelection::length() const { if (empty()) { return 0; diff --git a/gtk2_ardour/time_selection.h b/gtk2_ardour/time_selection.h index f3ca6e076e..53a0f28662 100644 --- a/gtk2_ardour/time_selection.h +++ b/gtk2_ardour/time_selection.h @@ -33,9 +33,9 @@ class TimeSelection : public std::list public: ARDOUR::AudioRange& operator[](uint32_t); - ARDOUR::samplepos_t start(); - ARDOUR::samplepos_t end_sample(); - ARDOUR::samplepos_t length(); + ARDOUR::samplepos_t start() const; + ARDOUR::samplepos_t end_sample() const; + ARDOUR::samplepos_t length() const; bool consolidate (); };