summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/private/opimsortvector.h
authoreilers <eilers>2005-01-16 19:54:28 (UTC)
committer eilers <eilers>2005-01-16 19:54:28 (UTC)
commit37f290f048eeade1036cd1dc2239d2a98412c54b (patch) (side-by-side diff)
tree04dea39ccf2725f4992d5b8bdbf12807e9a67ae2 /libopie2/opiepim/private/opimsortvector.h
parent07a4cf7e277aee7097c4da286a2559b717054362 (diff)
downloadopie-37f290f048eeade1036cd1dc2239d2a98412c54b.zip
opie-37f290f048eeade1036cd1dc2239d2a98412c54b.tar.gz
opie-37f290f048eeade1036cd1dc2239d2a98412c54b.tar.bz2
Added new generic sorted for the databook backends. Needed an sortedvector
to do this job, which is now added to private classes..
Diffstat (limited to 'libopie2/opiepim/private/opimsortvector.h') (more/less context) (show 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
@@ -55,2 +55,5 @@ protected:
int testDate( const QDate&, const QDate& )const;
+ int testTime( const QTime&, const QTime& )const;
+ int testDateTime( const QDateTime& left,
+ const QDateTime& right )const;
protected:
@@ -122,2 +125,3 @@ inline int OPimSortVector<T>::testString( const QString& left,
+
template<class T>
@@ -134,2 +138,32 @@ inline int OPimSortVector<T>::testDate( const QDate& left,
}
+
+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;
+
+}
+
}