# HG changeset patch # User Chris Cannam # Date 1389367261 0 # Node ID afeb580b1b578ba2e5cb5b12a487a4f2f62d70d8 # Parent 0b15c9328003255e8afff5a1d9276860105a1bc6 Add methods to return new Clipboard points with particular characteristics (this is an immutable object) diff -r 0b15c9328003 -r afeb580b1b57 base/Clipboard.cpp --- a/base/Clipboard.cpp Thu Jan 09 21:43:33 2014 +0000 +++ b/base/Clipboard.cpp Fri Jan 10 15:21:01 2014 +0000 @@ -123,6 +123,15 @@ return m_frame; } +Clipboard::Point +Clipboard::Point::withFrame(long frame) const +{ + Point p(*this); + p.m_haveFrame = true; + p.m_frame = frame; + return p; +} + bool Clipboard::Point::haveValue() const { @@ -135,6 +144,15 @@ return m_value; } +Clipboard::Point +Clipboard::Point::withValue(float value) const +{ + Point p(*this); + p.m_haveValue = true; + p.m_value = value; + return p; +} + bool Clipboard::Point::haveDuration() const { @@ -147,6 +165,15 @@ return m_duration; } +Clipboard::Point +Clipboard::Point::withDuration(size_t duration) const +{ + Point p(*this); + p.m_haveDuration = true; + p.m_duration = duration; + return p; +} + bool Clipboard::Point::haveLabel() const { @@ -159,6 +186,15 @@ return m_label; } +Clipboard::Point +Clipboard::Point::withLabel(QString label) const +{ + Point p(*this); + p.m_haveLabel = true; + p.m_label = label; + return p; +} + bool Clipboard::Point::haveLevel() const { @@ -171,6 +207,15 @@ return m_level; } +Clipboard::Point +Clipboard::Point::withLevel(float level) const +{ + Point p(*this); + p.m_haveLevel = true; + p.m_level = level; + return p; +} + bool Clipboard::Point::haveReferenceFrame() const { diff -r 0b15c9328003 -r afeb580b1b57 base/Clipboard.h --- a/base/Clipboard.h Thu Jan 09 21:43:33 2014 +0000 +++ b/base/Clipboard.h Fri Jan 10 15:21:01 2014 +0000 @@ -34,18 +34,23 @@ bool haveFrame() const; long getFrame() const; + Point withFrame(long frame) const; bool haveValue() const; float getValue() const; + Point withValue(float value) const; bool haveDuration() const; size_t getDuration() const; + Point withDuration(size_t duration) const; bool haveLabel() const; QString getLabel() const; + Point withLabel(QString label) const; bool haveLevel() const; float getLevel() const; + Point withLevel(float level) const; bool haveReferenceFrame() const; bool referenceFrameDiffers() const; // from point frame