author | eilers <eilers> | 2005-01-16 19:54:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2005-01-16 19:54:28 (UTC) |
commit | 37f290f048eeade1036cd1dc2239d2a98412c54b (patch) (unidiff) | |
tree | 04dea39ccf2725f4992d5b8bdbf12807e9a67ae2 /libopie2/opiepim/private/opimsortvector.h | |
parent | 07a4cf7e277aee7097c4da286a2559b717054362 (diff) | |
download | opie-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) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/private/opimsortvector.h | 34 |
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: | |||
55 | int testDate( const QDate&, const QDate& )const; | 55 | int testDate( const QDate&, const QDate& )const; |
56 | int testTime( const QTime&, const QTime& )const; | ||
57 | int testDateTime( const QDateTime& left, | ||
58 | const QDateTime& right )const; | ||
56 | protected: | 59 | protected: |
@@ -122,2 +125,3 @@ inline int OPimSortVector<T>::testString( const QString& left, | |||
122 | 125 | ||
126 | |||
123 | template<class T> | 127 | template<class T> |
@@ -134,2 +138,32 @@ inline int OPimSortVector<T>::testDate( const QDate& left, | |||
134 | } | 138 | } |
139 | |||
140 | template<class T> | ||
141 | inline int OPimSortVector<T>::testTime( const QTime& left, | ||
142 | const QTime& right )const { | ||
143 | int ret = 0; | ||
144 | if ( !left .isValid() ) ret++; | ||
145 | if ( !right.isValid() ) ret--; | ||
146 | |||
147 | if ( left.isValid() && right.isValid() ){ | ||
148 | ret += left < right ? -1 : 1; | ||
149 | } | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | template<class T> | ||
155 | inline int OPimSortVector<T>::testDateTime( const QDateTime& left, | ||
156 | const QDateTime& right )const { | ||
157 | int ret = 0; | ||
158 | if ( !left .isValid() ) ret++; | ||
159 | if ( !right.isValid() ) ret--; | ||
160 | |||
161 | if ( left.isValid() && right.isValid() ){ | ||
162 | ret += left < right ? -1 : 1; | ||
163 | } | ||
164 | |||
165 | return ret; | ||
166 | |||
167 | } | ||
168 | |||
135 | } | 169 | } |