Mercurial > hg > svcore
comparison base/Event.h @ 1647:29a20719796e single-point
Rework NoteModel commands (not entirely successfully); remove FlexiNoteModel as it has always been almost entirely identical to NoteModel (unlike its layer counterpart)
author | Chris Cannam |
---|---|
date | Thu, 14 Mar 2019 15:31:59 +0000 |
parents | 751a52865270 |
children | a77a7e8c085c |
comparison
equal
deleted
inserted
replaced
1646:b429750e64a8 | 1647:29a20719796e |
---|---|
25 #include <stdexcept> | 25 #include <stdexcept> |
26 | 26 |
27 #include <QString> | 27 #include <QString> |
28 | 28 |
29 /** | 29 /** |
30 * An immutable type used for point and event representation in sparse | 30 * An immutable(-ish) type used for point and event representation in |
31 * models, as well as for interchange within the clipboard. An event | 31 * sparse models, as well as for interchange within the clipboard. An |
32 * always has a frame and (possibly empty) label, and optionally has | 32 * event always has a frame and (possibly empty) label, and optionally |
33 * numerical value, level, duration in frames, and a mapped reference | 33 * has numerical value, level, duration in frames, and a mapped |
34 * frame. Event has an operator< defining a total ordering, by frame | 34 * reference frame. Event has an operator< defining a total ordering, |
35 * first and then by the other properties. | 35 * by frame first and then by the other properties. |
36 * | 36 * |
37 * Event is based on the Clipboard::Point type up to SV v3.2.1 and is | 37 * Event is based on the Clipboard::Point type up to SV v3.2.1 and is |
38 * intended also to replace the custom point types previously found in | 38 * intended also to replace the custom point types previously found in |
39 * sparse models. | 39 * sparse models. |
40 */ | 40 */ |
81 m_duration(duration), m_referenceFrame(0), m_label(label) { | 81 m_duration(duration), m_referenceFrame(0), m_label(label) { |
82 if (m_duration < 0) throw std::logic_error("duration must be >= 0"); | 82 if (m_duration < 0) throw std::logic_error("duration must be >= 0"); |
83 } | 83 } |
84 | 84 |
85 Event(const Event &event) =default; | 85 Event(const Event &event) =default; |
86 | |
87 // We would ideally like Event to be immutable - but we have to | |
88 // have these because otherwise we can't put Events in vectors | |
89 // etc. Let's call it conceptually immutable | |
86 Event &operator=(const Event &event) =default; | 90 Event &operator=(const Event &event) =default; |
87 Event &operator=(Event &&event) =default; | 91 Event &operator=(Event &&event) =default; |
88 | 92 |
89 sv_frame_t getFrame() const { return m_frame; } | 93 sv_frame_t getFrame() const { return m_frame; } |
90 | 94 |