Mercurial > hg > svcore
comparison base/Clipboard.h @ 1611:b2f32c554199 single-point
Pull out the Point class, plus start testing NoteModel, plus actually add the tests...
author | Chris Cannam |
---|---|
date | Tue, 05 Mar 2019 15:15:11 +0000 |
parents | 7db29268cf4c |
children | 23a29e5dc0e9 |
comparison
equal
deleted
inserted
replaced
1610:7db29268cf4c | 1611:b2f32c554199 |
---|---|
14 */ | 14 */ |
15 | 15 |
16 #ifndef SV_CLIPBOARD_H | 16 #ifndef SV_CLIPBOARD_H |
17 #define SV_CLIPBOARD_H | 17 #define SV_CLIPBOARD_H |
18 | 18 |
19 #include <QString> | |
20 #include <vector> | 19 #include <vector> |
21 | 20 |
22 #include "BaseTypes.h" | 21 #include "Point.h" |
23 | 22 |
24 class Clipboard | 23 class Clipboard |
25 { | 24 { |
26 public: | 25 public: |
27 class Point | |
28 { | |
29 public: | |
30 Point(sv_frame_t frame, QString label); | |
31 Point(sv_frame_t frame, float value, QString label); | |
32 Point(sv_frame_t frame, float value, sv_frame_t duration, QString label); | |
33 Point(sv_frame_t frame, float value, sv_frame_t duration, float level, QString label); | |
34 | |
35 Point(const Point &point) =default; | |
36 Point &operator=(const Point &point) =default; | |
37 | |
38 bool haveFrame() const; | |
39 sv_frame_t getFrame() const; | |
40 Point withFrame(sv_frame_t frame) const; | |
41 | |
42 bool haveValue() const; | |
43 float getValue() const; | |
44 Point withValue(float value) const; | |
45 | |
46 bool haveDuration() const; | |
47 sv_frame_t getDuration() const; | |
48 Point withDuration(sv_frame_t duration) const; | |
49 | |
50 bool haveLabel() const; | |
51 QString getLabel() const; | |
52 Point withLabel(QString label) const; | |
53 | |
54 bool haveLevel() const; | |
55 float getLevel() const; | |
56 Point withLevel(float level) const; | |
57 | |
58 bool haveReferenceFrame() const; | |
59 bool referenceFrameDiffers() const; // from point frame | |
60 | |
61 sv_frame_t getReferenceFrame() const; | |
62 void setReferenceFrame(sv_frame_t); | |
63 | |
64 private: | |
65 // Order of fields here is chosen to minimise overall size of struct. | |
66 // If you change something, check what difference it makes to packing. | |
67 bool m_haveValue : 1; | |
68 bool m_haveLevel : 1; | |
69 bool m_haveFrame : 1; | |
70 bool m_haveDuration : 1; | |
71 bool m_haveReferenceFrame : 1; | |
72 bool m_haveLabel : 1; | |
73 float m_value; | |
74 float m_level; | |
75 sv_frame_t m_frame; | |
76 sv_frame_t m_duration; | |
77 sv_frame_t m_referenceFrame; | |
78 QString m_label; | |
79 }; | |
80 | |
81 Clipboard(); | 26 Clipboard(); |
82 ~Clipboard(); | 27 ~Clipboard(); |
83 | 28 |
84 typedef std::vector<Point> PointList; | 29 typedef std::vector<Point> PointList; |
85 | 30 |