List journeys in descending order of time
[harbour-pedalo.git] / src / journey.h
index 45393b3..cd3df88 100644 (file)
@@ -3,19 +3,29 @@
 
 #include <QObject>
 #include <QTime>
+#include <QDate>
 
 class Journey
 {
 public:
+    friend class JourneyTimeDescending;
+    friend class JourneyTimeAscending;
+
     Journey();
     Journey(quint64 start, quint32 duration, quint32 overtook, quint32 overtakenby);
 
     quint64 getStart () const;
+    QDate getStartDate() const;
+    QTime getStartTime() const;
+    QTime getEndTime() const;
     qint32 getDuration () const;
     qint32 getOvertook () const;
     qint32 getOvertakenBy () const;
 
     void setStart (const quint64 value);
+    void setStartDate (const QDate &value);
+    void setStartTime (const QTime &value);
+    void setEndTime(const QTime &value);
     void setDuration (qint32 value);
     void setOvertook (qint32 value);
     void setOvertakenBy (qint32 value);
@@ -27,5 +37,18 @@ private:
     quint32 overtakenby;
 };
 
+class JourneyTimeAscending : std::binary_function<Journey,Journey, bool> {
+public:
+    bool operator() (Journey const &lhs, Journey const &rhs) const {
+        return lhs.start < rhs.start;
+    }
+};
+
+class JourneyTimeDescending : std::binary_function<Journey,Journey, bool> {
+public:
+    bool operator() (Journey const &lhs, Journey const &rhs) const {
+        return lhs.start > rhs.start;
+    }
+};
 
 #endif // JOURNEY_H