mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
refs #501, compareByPropertyIndex (performance for sort)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
1e57ce7ecb
commit
0c94922bd6
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/pq/pq.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -15,7 +16,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
template <class MU, class PQ>
|
||||
MU CPhysicalQuantity<MU, PQ>::getUnit() const
|
||||
{
|
||||
@@ -394,6 +394,22 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
template <class MU, class PQ>
|
||||
int CPhysicalQuantity<MU, PQ>::comparePropertyByIndex(const PQ &pq, const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return compareImpl(*derived(), pq); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexValue:
|
||||
return Compare::compare(this->m_value, pq.m_value);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison");
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class MU, class PQ>
|
||||
int CPhysicalQuantity<MU, PQ>::compareImpl(const PQ &a, const PQ &b)
|
||||
{
|
||||
|
||||
@@ -211,6 +211,9 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
|
||||
//! Compare
|
||||
int comparePropertyByIndex(const PQ &pq, const CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user