Mercurial > hg > svcore
annotate base/Clipboard.cpp @ 1700:c1208b211d8c single-point
Ensure test fails rather than crashing if this reader doesn't get created
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 03 May 2019 15:02:09 +0100 |
parents | 24dc8cb42755 |
children |
rev | line source |
---|---|
Chris@74 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@74 | 2 |
Chris@74 | 3 /* |
Chris@74 | 4 Sonic Visualiser |
Chris@74 | 5 An audio file viewer and annotation editor. |
Chris@74 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@74 | 7 This file copyright 2006 Chris Cannam. |
Chris@74 | 8 |
Chris@74 | 9 This program is free software; you can redistribute it and/or |
Chris@74 | 10 modify it under the terms of the GNU General Public License as |
Chris@74 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@74 | 12 License, or (at your option) any later version. See the file |
Chris@74 | 13 COPYING included with this distribution for more information. |
Chris@74 | 14 */ |
Chris@74 | 15 |
Chris@74 | 16 #include "Clipboard.h" |
Chris@74 | 17 |
Chris@74 | 18 Clipboard::Clipboard() { } |
Chris@74 | 19 Clipboard::~Clipboard() { } |
Chris@74 | 20 |
Chris@74 | 21 void |
Chris@74 | 22 Clipboard::clear() |
Chris@74 | 23 { |
Chris@74 | 24 m_points.clear(); |
Chris@74 | 25 } |
Chris@74 | 26 |
Chris@74 | 27 bool |
Chris@74 | 28 Clipboard::empty() const |
Chris@74 | 29 { |
Chris@74 | 30 return m_points.empty(); |
Chris@74 | 31 } |
Chris@74 | 32 |
Chris@1615 | 33 const EventVector & |
Chris@74 | 34 Clipboard::getPoints() const |
Chris@74 | 35 { |
Chris@74 | 36 return m_points; |
Chris@74 | 37 } |
Chris@74 | 38 |
Chris@74 | 39 void |
Chris@1615 | 40 Clipboard::setPoints(const EventVector &pl) |
Chris@74 | 41 { |
Chris@74 | 42 m_points = pl; |
Chris@74 | 43 } |
Chris@74 | 44 |
Chris@74 | 45 void |
Chris@1615 | 46 Clipboard::addPoint(const Event &point) |
Chris@74 | 47 { |
Chris@74 | 48 m_points.push_back(point); |
Chris@74 | 49 } |
Chris@74 | 50 |
Chris@340 | 51 bool |
Chris@370 | 52 Clipboard::haveReferenceFrames() const |
Chris@370 | 53 { |
Chris@1615 | 54 for (EventVector::const_iterator i = m_points.begin(); |
Chris@370 | 55 i != m_points.end(); ++i) { |
Chris@1615 | 56 if (i->hasReferenceFrame()) return true; |
Chris@370 | 57 } |
Chris@370 | 58 return false; |
Chris@370 | 59 } |
Chris@370 | 60 |
Chris@370 | 61 bool |
Chris@369 | 62 Clipboard::referenceFramesDiffer() const |
Chris@340 | 63 { |
Chris@1615 | 64 for (EventVector::const_iterator i = m_points.begin(); |
Chris@340 | 65 i != m_points.end(); ++i) { |
Chris@370 | 66 if (i->referenceFrameDiffers()) return true; |
Chris@340 | 67 } |
Chris@340 | 68 return false; |
Chris@340 | 69 } |
Chris@340 | 70 |