Mercurial > hg > svcore
comparison data/model/SparseModel.h @ 606:1415e35881f6
* Some (incomplete) Solaris build bobs
author | Chris Cannam |
---|---|
date | Thu, 10 Sep 2009 14:17:59 +0000 |
parents | 6441b31b37ac |
children | d7f3dfe6f9a4 |
comparison
equal
deleted
inserted
replaced
605:133418f4e74c | 606:1415e35881f6 |
---|---|
65 | 65 |
66 typedef PointType Point; | 66 typedef PointType Point; |
67 typedef std::multiset<PointType, | 67 typedef std::multiset<PointType, |
68 typename PointType::OrderComparator> PointList; | 68 typename PointType::OrderComparator> PointList; |
69 typedef typename PointList::iterator PointListIterator; | 69 typedef typename PointList::iterator PointListIterator; |
70 typedef typename PointList::const_iterator PointListConstIterator; | |
70 | 71 |
71 /** | 72 /** |
72 * Return whether the model is empty or not. | 73 * Return whether the model is empty or not. |
73 */ | 74 */ |
74 virtual bool isEmpty() const; | 75 virtual bool isEmpty() const; |
147 QString extraAttributes = "") const; | 148 QString extraAttributes = "") const; |
148 | 149 |
149 virtual QString toDelimitedDataString(QString delimiter) const | 150 virtual QString toDelimitedDataString(QString delimiter) const |
150 { | 151 { |
151 QString s; | 152 QString s; |
152 for (PointListIterator i = m_points.begin(); i != m_points.end(); ++i) { | 153 for (PointListConstIterator i = m_points.begin(); i != m_points.end(); ++i) { |
153 s += i->toDelimitedDataString(delimiter, m_sampleRate) + "\n"; | 154 s += i->toDelimitedDataString(delimiter, m_sampleRate) + "\n"; |
154 } | 155 } |
155 return s; | 156 return s; |
156 } | 157 } |
157 | 158 |
274 return m_points.size(); | 275 return m_points.size(); |
275 } | 276 } |
276 | 277 |
277 virtual long getFrameForRow(int row) const | 278 virtual long getFrameForRow(int row) const |
278 { | 279 { |
279 PointListIterator i = getPointListIteratorForRow(row); | 280 PointListConstIterator i = getPointListIteratorForRow(row); |
280 if (i == m_points.end()) return 0; | 281 if (i == m_points.end()) return 0; |
281 return i->frame; | 282 return i->frame; |
282 } | 283 } |
283 | 284 |
284 virtual int getRowForFrame(long frame) const | 285 virtual int getRowForFrame(long frame) const |
294 } | 295 } |
295 | 296 |
296 virtual int getColumnCount() const { return 1; } | 297 virtual int getColumnCount() const { return 1; } |
297 virtual QVariant getData(int row, int column, int role) const | 298 virtual QVariant getData(int row, int column, int role) const |
298 { | 299 { |
299 PointListIterator i = getPointListIteratorForRow(row); | 300 PointListConstIterator i = getPointListIteratorForRow(row); |
300 if (i == m_points.end()) return QVariant(); | 301 if (i == m_points.end()) return QVariant(); |
301 | 302 |
302 switch (column) { | 303 switch (column) { |
303 case 0: { | 304 case 0: { |
304 if (role == SortRole) return int(i->frame); | 305 if (role == SortRole) return int(i->frame); |