From 480cda836ecb8a9c1a8ba3299b94859dc40896aa Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Tue, 26 Jul 2011 14:10:51 -0400 Subject: [PATCH] Allow for checking if the TimingData is empty. AKA, no segments in use. Again, this is mainly for the editor. As for why a lowercase empty? Blame vectors. --- src/TimingData.cpp | 12 ++++++++++++ src/TimingData.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 612cf07446..1c5e88c9ea 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -17,6 +17,18 @@ TimingData::~TimingData() { } +bool TimingData::empty() const +{ + for (unsigned i = 0; i < NUM_TimingSegmentType; i++) + { + for (unsigned j = 0; j < this->allTimingSegments[i].size(); j++) + { + return false; + } + } + return true; +} + TimingData TimingData::CopyRange(int startRow, int endRow) { TimingData tmp; diff --git a/src/TimingData.h b/src/TimingData.h index b6d79214cf..90c7f5b3f7 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -45,6 +45,8 @@ public: return this->GetPreviousSegmentBeatAtRow(tst, BeatToNoteRow(beat), isDelay); } + bool empty() const; + /** * @brief Sets up initial timing data with a defined offset. * @param fOffset the offset from the 0th beat. */