summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/private/opimsortvector.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/private/opimsortvector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/private/opimsortvector.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/libopie2/opiepim/private/opimsortvector.h b/libopie2/opiepim/private/opimsortvector.h
index 6c21339..11a40ac 100644
--- a/libopie2/opiepim/private/opimsortvector.h
+++ b/libopie2/opiepim/private/opimsortvector.h
@@ -54,4 +54,7 @@ protected:
int testString( const QString&, const QString& )const;
int testDate( const QDate&, const QDate& )const;
+ int testTime( const QTime&, const QTime& )const;
+ int testDateTime( const QDateTime& left,
+ const QDateTime& right )const;
protected:
bool sortAscending()const;
@@ -121,4 +124,5 @@ inline int OPimSortVector<T>::testString( const QString& left,
}
+
template<class T>
inline int OPimSortVector<T>::testDate( const QDate& left,
@@ -133,4 +137,34 @@ inline int OPimSortVector<T>::testDate( const QDate& left,
return ret;
}
+
+template<class T>
+inline int OPimSortVector<T>::testTime( const QTime& left,
+ const QTime& right )const {
+ int ret = 0;
+ if ( !left .isValid() ) ret++;
+ if ( !right.isValid() ) ret--;
+
+ if ( left.isValid() && right.isValid() ){
+ ret += left < right ? -1 : 1;
+ }
+
+ return ret;
+}
+
+template<class T>
+inline int OPimSortVector<T>::testDateTime( const QDateTime& left,
+ const QDateTime& right )const {
+ int ret = 0;
+ if ( !left .isValid() ) ret++;
+ if ( !right.isValid() ) ret--;
+
+ if ( left.isValid() && right.isValid() ){
+ ret += left < right ? -1 : 1;
+ }
+
+ return ret;
+
+}
+
}
}