Initial commit (software version 0.2.0)
[movie-schedule] / src / data / scheduleentry.h
1 // Copyright 2010 Jochen Becher
2 //
3 // This file is part of MovieSchedule.
4 //
5 // MovieSchedule is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // MovieSchedule is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with MovieSchedule.  If not, see <http://www.gnu.org/licenses/>.
17
18 #ifndef SCHEDULEENTRY_H
19 #define SCHEDULEENTRY_H
20
21 #include "scheduleentrykey.h"
22
23 #include <QString>
24 #include <QDate>
25
26 class Cinema;
27 class Movie;
28
29 class ScheduleEntry
30 {
31 public:
32     ScheduleEntry();
33     ScheduleEntry(const Cinema *cinema, const Movie *movie, const QTime &start_time, const QDate &date);
34
35     ScheduleEntryKey GetKey() const;
36
37     bool IsValid() const { return _cinema != 0 && _movie != 0; }
38
39     const Cinema *GetCinema() const { return _cinema; }
40     void SetCinema(const Cinema *cinema) { _cinema = cinema; }
41
42     const Movie *GetMovie() const { return _movie; }
43     void SetMovie(const Movie *movie) { _movie = movie; }
44
45     QTime GetStartTime() const { return _start_time; }
46     void SetStartTime(const QTime &start_time) { _start_time = start_time; }
47
48     QDate GetDate() const { return _date; }
49     void SetDate(const QDate &date) { _date = date; }
50
51 private:
52     const Cinema *_cinema;
53     const Movie *_movie;
54     QTime _start_time;
55     QDate _date;
56 };
57
58 bool operator==(const ScheduleEntry &lhs, const ScheduleEntry &rhs);
59
60 uint qHash(const ScheduleEntry &);
61
62 #endif // SCHEDULEENTRY_H