comparison base/Event.h @ 1800:705ea8699d49

OK, that didn't work because of scoping/overload rules. Try this
author Chris Cannam
date Thu, 10 Oct 2019 09:18:37 +0100
parents 8c34ecba70df
children af3f6c411a8e
comparison
equal deleted inserted replaced
1799:8c34ecba70df 1800:705ea8699d49
23 23
24 #include <vector> 24 #include <vector>
25 #include <stdexcept> 25 #include <stdexcept>
26 26
27 #include <QString> 27 #include <QString>
28
29 #if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
30 uint qHash(float key, uint seed) {
31 return key != 0.0f ?
32 qHash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) :
33 seed;
34 }
35 #endif
28 36
29 /** 37 /**
30 * An immutable(-ish) type used for point and event representation in 38 * An immutable(-ish) type used for point and event representation in
31 * sparse models, as well as for interchange within the clipboard. An 39 * sparse models, as well as for interchange within the clipboard. An
32 * event always has a frame and (possibly empty) label, and optionally 40 * event always has a frame and (possibly empty) label, and optionally
382 if (m_uri != "") list << m_uri; 390 if (m_uri != "") list << m_uri;
383 if (m_label != "") list << m_label; 391 if (m_label != "") list << m_label;
384 392
385 return list.join(delimiter); 393 return list.join(delimiter);
386 } 394 }
387
388 #if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
389 private:
390 uint qHash(float key, uint seed) const {
391 return key != 0.0f ?
392 qHash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) :
393 seed;
394 }
395 public:
396 #endif
397 395
398 uint hash(uint seed = 0) const { 396 uint hash(uint seed = 0) const {
399 uint h = qHash(m_label, seed); 397 uint h = qHash(m_label, seed);
400 if (m_haveValue) h ^= qHash(m_value); 398 if (m_haveValue) h ^= qHash(m_value);
401 if (m_haveLevel) h ^= qHash(m_level); 399 if (m_haveLevel) h ^= qHash(m_level);