1 | /* |
2 | Copyright 2010 John Layt <john@layt.net> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KCALENDARERA_H |
21 | #define KCALENDARERA_H |
22 | |
23 | #include <QtCore/QString> |
24 | #include <QtCore/QDate> |
25 | |
26 | #include "klocale.h" |
27 | |
28 | class KCalendarSystemPrivate; |
29 | |
30 | /** |
31 | * @internal |
32 | * Class to hold details of a Calendar Era. Internal for now, but may later be |
33 | * made public if user configuration of Era formatting via System Settings is |
34 | * required, in which case a d-ptr will be needed. Details based on POSIX LC_TIME |
35 | * format. |
36 | * |
37 | * @b license GNU-LGPL v.2 or later |
38 | * |
39 | * @see KCalendarSystem |
40 | * |
41 | * @author John Layt <john@layt.net> |
42 | */ |
43 | class KCalendarEra |
44 | { |
45 | public: |
46 | explicit KCalendarEra(); |
47 | virtual ~KCalendarEra(); |
48 | |
49 | bool isValid() const; |
50 | |
51 | int sequence() const; |
52 | QDate startDate() const; |
53 | QDate endDate() const; |
54 | QString name(KLocale::DateTimeComponentFormat format = KLocale::DefaultComponentFormat) const; |
55 | QString format() const; |
56 | int direction() const; |
57 | int offset() const; |
58 | |
59 | bool isInEra(const QDate &date) const; |
60 | int yearInEra(int year) const; |
61 | int year(int yearInEra) const; |
62 | |
63 | private: |
64 | friend class KCalendarSystemPrivate; |
65 | |
66 | int m_sequence; |
67 | QDate m_startDate; |
68 | int m_startYear; |
69 | QDate m_endDate; |
70 | QString m_longName; |
71 | QString m_shortName; |
72 | QString m_format; |
73 | int m_direction; |
74 | int m_offset; |
75 | }; |
76 | |
77 | #endif // KCALENDARERA_H |
78 | |