# HG changeset patch # User Chris Cannam # Date 1578497143 0 # Node ID 796ae7eecced1926441120afe738c65ea132638c # Parent ee3b248bda253f108cd4908efdcf206dbe465ac6 Add Selection::toString for debug purposes diff -r ee3b248bda25 -r 796ae7eecced base/Selection.cpp --- a/base/Selection.cpp Fri Nov 22 14:12:16 2019 +0000 +++ b/base/Selection.cpp Wed Jan 08 15:25:43 2020 +0000 @@ -227,3 +227,15 @@ stream << indent << "\n"; } +QString +MultiSelection::toString() const +{ + QStringList list; + for (SelectionList::iterator i = m_selections.begin(); + i != m_selections.end(); ++i) { + list << QString("(%1,%2)") + .arg(i->getStartFrame()) + .arg(i->getEndFrame()); + } + return "(" + list.join(",") + ")"; +} diff -r ee3b248bda25 -r 796ae7eecced base/Selection.h --- a/base/Selection.h Fri Nov 22 14:12:16 2019 +0000 +++ b/base/Selection.h Wed Jan 08 15:25:43 2020 +0000 @@ -75,18 +75,22 @@ void clearSelections(); void getExtents(sv_frame_t &startFrame, sv_frame_t &endFrame) const; - + /** * Return the selection that contains a given frame. * If defaultToFollowing is true, and if the frame is not in a * selected area, return the next selection after the given frame. * Return the empty selection if no appropriate selection is found. */ - Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const; + Selection getContainingSelection(sv_frame_t frame, + bool defaultToFollowing) const; void toXml(QTextStream &stream, QString indent = "", - QString extraAttributes = "") const override; + QString extraAttributes = "") const override; + // Debug only, not interop + QString toString() const; + protected: SelectionList m_selections; };