Mercurial > hg > svcore
comparison base/Clipboard.cpp @ 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 |
---|---|
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #include "Clipboard.h" | 16 #include "Clipboard.h" |
17 | |
18 Clipboard::Point::Point(sv_frame_t frame, QString label) : | |
19 m_haveValue(false), | |
20 m_haveLevel(false), | |
21 m_haveFrame(true), | |
22 m_haveDuration(false), | |
23 m_haveReferenceFrame(false), | |
24 m_haveLabel(true), | |
25 m_value(0), | |
26 m_level(0.f), | |
27 m_frame(frame), | |
28 m_duration(0), | |
29 m_referenceFrame(frame), | |
30 m_label(label) | |
31 { | |
32 } | |
33 | |
34 Clipboard::Point::Point(sv_frame_t frame, float value, QString label) : | |
35 m_haveValue(true), | |
36 m_haveLevel(false), | |
37 m_haveFrame(true), | |
38 m_haveDuration(false), | |
39 m_haveReferenceFrame(false), | |
40 m_haveLabel(true), | |
41 m_value(value), | |
42 m_level(0.f), | |
43 m_frame(frame), | |
44 m_duration(0), | |
45 m_referenceFrame(frame), | |
46 m_label(label) | |
47 { | |
48 } | |
49 | |
50 Clipboard::Point::Point(sv_frame_t frame, float value, sv_frame_t duration, QString label) : | |
51 m_haveValue(true), | |
52 m_haveLevel(false), | |
53 m_haveFrame(true), | |
54 m_haveDuration(true), | |
55 m_haveReferenceFrame(false), | |
56 m_haveLabel(true), | |
57 m_value(value), | |
58 m_level(0.f), | |
59 m_frame(frame), | |
60 m_duration(duration), | |
61 m_referenceFrame(frame), | |
62 m_label(label) | |
63 { | |
64 } | |
65 | |
66 Clipboard::Point::Point(sv_frame_t frame, float value, sv_frame_t duration, float level, QString label) : | |
67 m_haveValue(true), | |
68 m_haveLevel(true), | |
69 m_haveFrame(true), | |
70 m_haveDuration(true), | |
71 m_haveReferenceFrame(false), | |
72 m_haveLabel(true), | |
73 m_value(value), | |
74 m_level(level), | |
75 m_frame(frame), | |
76 m_duration(duration), | |
77 m_referenceFrame(frame), | |
78 m_label(label) | |
79 { | |
80 } | |
81 | |
82 bool | |
83 Clipboard::Point::haveFrame() const | |
84 { | |
85 return m_haveFrame; | |
86 } | |
87 | |
88 sv_frame_t | |
89 Clipboard::Point::getFrame() const | |
90 { | |
91 return m_frame; | |
92 } | |
93 | |
94 Clipboard::Point | |
95 Clipboard::Point::withFrame(sv_frame_t frame) const | |
96 { | |
97 Point p(*this); | |
98 p.m_haveFrame = true; | |
99 p.m_frame = frame; | |
100 return p; | |
101 } | |
102 | |
103 bool | |
104 Clipboard::Point::haveValue() const | |
105 { | |
106 return m_haveValue; | |
107 } | |
108 | |
109 float | |
110 Clipboard::Point::getValue() const | |
111 { | |
112 return m_value; | |
113 } | |
114 | |
115 Clipboard::Point | |
116 Clipboard::Point::withValue(float value) const | |
117 { | |
118 Point p(*this); | |
119 p.m_haveValue = true; | |
120 p.m_value = value; | |
121 return p; | |
122 } | |
123 | |
124 bool | |
125 Clipboard::Point::haveDuration() const | |
126 { | |
127 return m_haveDuration; | |
128 } | |
129 | |
130 sv_frame_t | |
131 Clipboard::Point::getDuration() const | |
132 { | |
133 return m_duration; | |
134 } | |
135 | |
136 Clipboard::Point | |
137 Clipboard::Point::withDuration(sv_frame_t duration) const | |
138 { | |
139 Point p(*this); | |
140 p.m_haveDuration = true; | |
141 p.m_duration = duration; | |
142 return p; | |
143 } | |
144 | |
145 bool | |
146 Clipboard::Point::haveLabel() const | |
147 { | |
148 return m_haveLabel; | |
149 } | |
150 | |
151 QString | |
152 Clipboard::Point::getLabel() const | |
153 { | |
154 return m_label; | |
155 } | |
156 | |
157 Clipboard::Point | |
158 Clipboard::Point::withLabel(QString label) const | |
159 { | |
160 Point p(*this); | |
161 p.m_haveLabel = true; | |
162 p.m_label = label; | |
163 return p; | |
164 } | |
165 | |
166 bool | |
167 Clipboard::Point::haveLevel() const | |
168 { | |
169 return m_haveLevel; | |
170 } | |
171 | |
172 float | |
173 Clipboard::Point::getLevel() const | |
174 { | |
175 return m_level; | |
176 } | |
177 | |
178 Clipboard::Point | |
179 Clipboard::Point::withLevel(float level) const | |
180 { | |
181 Point p(*this); | |
182 p.m_haveLevel = true; | |
183 p.m_level = level; | |
184 return p; | |
185 } | |
186 | |
187 bool | |
188 Clipboard::Point::haveReferenceFrame() const | |
189 { | |
190 return m_haveReferenceFrame; | |
191 } | |
192 | |
193 bool | |
194 Clipboard::Point::referenceFrameDiffers() const | |
195 { | |
196 return m_haveReferenceFrame && (m_referenceFrame != m_frame); | |
197 } | |
198 | |
199 sv_frame_t | |
200 Clipboard::Point::getReferenceFrame() const | |
201 { | |
202 return m_referenceFrame; | |
203 } | |
204 | |
205 void | |
206 Clipboard::Point::setReferenceFrame(sv_frame_t f) | |
207 { | |
208 m_haveReferenceFrame = true; | |
209 m_referenceFrame = f; | |
210 } | |
211 | 17 |
212 Clipboard::Clipboard() { } | 18 Clipboard::Clipboard() { } |
213 Clipboard::~Clipboard() { } | 19 Clipboard::~Clipboard() { } |
214 | 20 |
215 void | 21 void |