comparison base/Selection.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 6a94bb528e9d
children 48e9f538e6e9
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
20 m_startFrame(0), 20 m_startFrame(0),
21 m_endFrame(0) 21 m_endFrame(0)
22 { 22 {
23 } 23 }
24 24
25 Selection::Selection(int startFrame, int endFrame) : 25 Selection::Selection(sv_frame_t startFrame, sv_frame_t endFrame) :
26 m_startFrame(startFrame), 26 m_startFrame(startFrame),
27 m_endFrame(endFrame) 27 m_endFrame(endFrame)
28 { 28 {
29 if (m_startFrame > m_endFrame) { 29 if (m_startFrame > m_endFrame) {
30 int tmp = m_endFrame; 30 sv_frame_t tmp = m_endFrame;
31 m_endFrame = m_startFrame; 31 m_endFrame = m_startFrame;
32 m_startFrame = tmp; 32 m_startFrame = tmp;
33 } 33 }
34 } 34 }
35 35
57 Selection::isEmpty() const 57 Selection::isEmpty() const
58 { 58 {
59 return m_startFrame == m_endFrame; 59 return m_startFrame == m_endFrame;
60 } 60 }
61 61
62 int 62 sv_frame_t
63 Selection::getStartFrame() const 63 Selection::getStartFrame() const
64 { 64 {
65 return m_startFrame; 65 return m_startFrame;
66 } 66 }
67 67
68 int 68 sv_frame_t
69 Selection::getEndFrame() const 69 Selection::getEndFrame() const
70 { 70 {
71 return m_endFrame; 71 return m_endFrame;
72 } 72 }
73 73
74 bool 74 bool
75 Selection::contains(int frame) const 75 Selection::contains(sv_frame_t frame) const
76 { 76 {
77 return (frame >= m_startFrame) && (frame < m_endFrame); 77 return (frame >= m_startFrame) && (frame < m_endFrame);
78 } 78 }
79 79
80 bool 80 bool
172 m_selections.clear(); 172 m_selections.clear();
173 } 173 }
174 } 174 }
175 175
176 void 176 void
177 MultiSelection::getExtents(int &startFrame, int &endFrame) const 177 MultiSelection::getExtents(sv_frame_t &startFrame, sv_frame_t &endFrame) const
178 { 178 {
179 startFrame = 0; 179 startFrame = 0;
180 endFrame = 0; 180 endFrame = 0;
181 181
182 for (SelectionList::const_iterator i = m_selections.begin(); 182 for (SelectionList::const_iterator i = m_selections.begin();
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 Selection 195 Selection
196 MultiSelection::getContainingSelection(int frame, bool defaultToFollowing) const 196 MultiSelection::getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const
197 { 197 {
198 // This scales very badly with the number of selections, but it's 198 // This scales very badly with the number of selections, but it's
199 // more efficient for very small numbers of selections than a more 199 // more efficient for very small numbers of selections than a more
200 // scalable method, and I think that may be what we need 200 // scalable method, and I think that may be what we need
201 201