• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • date
kcalendarsystemjulian.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2009, 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 #include "kcalendarsystemjulian_p.h"
21 #include "kcalendarsystemprivate_p.h"
22 
23 #include "kdebug.h"
24 #include "klocale.h"
25 #include "kglobal.h"
26 #include "kconfiggroup.h"
27 
28 #include <QtCore/QDate>
29 #include <QtCore/QCharRef>
30 
31 class KCalendarSystemJulianPrivate : public KCalendarSystemPrivate
32 {
33 public:
34  explicit KCalendarSystemJulianPrivate(KCalendarSystemJulian *q);
35 
36  virtual ~KCalendarSystemJulianPrivate();
37 
38  // Virtual methods each calendar system must re-implement
39  virtual KLocale::CalendarSystem calendarSystem() const;
40  virtual void loadDefaultEraList();
41  virtual int monthsInYear(int year) const;
42  virtual int daysInMonth(int year, int month) const;
43  virtual int daysInYear(int year) const;
44  virtual int daysInWeek() const;
45  virtual bool isLeapYear(int year) const;
46  virtual bool hasLeapMonths() const;
47  virtual bool hasYearZero() const;
48  virtual int maxDaysInWeek() const;
49  virtual int maxMonthsInYear() const;
50  virtual int earliestValidYear() const;
51  virtual int latestValidYear() const;
52  virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
53  virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
54 
55  bool m_useCommonEra;
56 };
57 
58 // Shared d pointer base class definitions
59 
60 KCalendarSystemJulianPrivate::KCalendarSystemJulianPrivate(KCalendarSystemJulian *q)
61  : KCalendarSystemPrivate(q)
62 {
63 }
64 
65 KCalendarSystemJulianPrivate::~KCalendarSystemJulianPrivate()
66 {
67 }
68 
69 KLocale::CalendarSystem KCalendarSystemJulianPrivate::calendarSystem() const
70 {
71  return KLocale::JulianCalendar;
72 }
73 
74 void KCalendarSystemJulianPrivate::loadDefaultEraList()
75 {
76  QString name, shortName, format;
77 
78  KConfigGroup cg(config(), QString::fromLatin1("KCalendarSystem %1").arg(q->calendarType(q->calendarSystem())));
79  m_useCommonEra = cg.readEntry("UseCommonEra", false);
80 
81  if (m_useCommonEra) {
82  name = i18nc("Calendar Era: Julian Common Era, years < 0, LongFormat", "Before Common Era");
83  shortName = i18nc("Calendar Era: Julian Common Era, years < 0, ShortFormat", "BCE");
84  } else {
85  name = i18nc("Calendar Era: Julian Christian Era, years < 0, LongFormat", "Before Christ");
86  shortName = i18nc("Calendar Era: Julian Christian Era, years < 0, ShortFormat", "BC");
87  }
88  format = i18nc("(kdedt-format) Julian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC");
89  addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), name, shortName, format);
90 
91  if (m_useCommonEra) {
92  name = i18nc("Calendar Era: Julian Common Era, years > 0, LongFormat", "Common Era");
93  shortName = i18nc("Calendar Era: Julian Common Era, years > 0, ShortFormat", "CE");
94  } else {
95  name = i18nc("Calendar Era: Julian Christian Era, years > 0, LongFormat", "Anno Domini");
96  shortName = i18nc("Calendar Era: Julian Christian Era, years > 0, ShortFormat", "AD");
97  }
98  format = i18nc("(kdedt-format) Julian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC");
99  addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format);
100 }
101 
102 int KCalendarSystemJulianPrivate::monthsInYear(int year) const
103 {
104  Q_UNUSED(year)
105  return 12;
106 }
107 
108 int KCalendarSystemJulianPrivate::daysInMonth(int year, int month) const
109 {
110  if (month == 2) {
111  if (isLeapYear(year)) {
112  return 29;
113  } else {
114  return 28;
115  }
116  }
117 
118  if (month == 4 || month == 6 || month == 9 || month == 11) {
119  return 30;
120  }
121 
122  return 31;
123 }
124 
125 int KCalendarSystemJulianPrivate::daysInYear(int year) const
126 {
127  if (isLeapYear(year)) {
128  return 366;
129  } else {
130  return 365;
131  }
132 }
133 
134 int KCalendarSystemJulianPrivate::daysInWeek() const
135 {
136  return 7;
137 }
138 
139 bool KCalendarSystemJulianPrivate::isLeapYear(int year) const
140 {
141  if (year < 1) {
142  year = year + 1;
143  }
144 
145  if (year % 4 == 0) {
146  return true;
147  }
148 
149  return false;
150 }
151 
152 bool KCalendarSystemJulianPrivate::hasLeapMonths() const
153 {
154  return false;
155 }
156 
157 bool KCalendarSystemJulianPrivate::hasYearZero() const
158 {
159  return false;
160 }
161 
162 int KCalendarSystemJulianPrivate::maxDaysInWeek() const
163 {
164  return 7;
165 }
166 
167 int KCalendarSystemJulianPrivate::maxMonthsInYear() const
168 {
169  return 12;
170 }
171 
172 int KCalendarSystemJulianPrivate::earliestValidYear() const
173 {
174  return -4712;
175 }
176 
177 int KCalendarSystemJulianPrivate::latestValidYear() const
178 {
179  return 9999;
180 }
181 
182 QString KCalendarSystemJulianPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const
183 {
184  Q_UNUSED(year);
185 
186  if (format == KLocale::NarrowName) {
187  switch (month) {
188  case 1:
189  return ki18nc("Julian month 1 - KLocale::NarrowName", "J").toString(locale());
190  case 2:
191  return ki18nc("Julian month 2 - KLocale::NarrowName", "F").toString(locale());
192  case 3:
193  return ki18nc("Julian month 3 - KLocale::NarrowName", "M").toString(locale());
194  case 4:
195  return ki18nc("Julian month 4 - KLocale::NarrowName", "A").toString(locale());
196  case 5:
197  return ki18nc("Julian month 5 - KLocale::NarrowName", "M").toString(locale());
198  case 6:
199  return ki18nc("Julian month 6 - KLocale::NarrowName", "J").toString(locale());
200  case 7:
201  return ki18nc("Julian month 7 - KLocale::NarrowName", "J").toString(locale());
202  case 8:
203  return ki18nc("Julian month 8 - KLocale::NarrowName", "A").toString(locale());
204  case 9:
205  return ki18nc("Julian month 9 - KLocale::NarrowName", "S").toString(locale());
206  case 10:
207  return ki18nc("Julian month 10 - KLocale::NarrowName", "O").toString(locale());
208  case 11:
209  return ki18nc("Julian month 11 - KLocale::NarrowName", "N").toString(locale());
210  case 12:
211  return ki18nc("Julian month 12 - KLocale::NarrowName", "D").toString(locale());
212  default:
213  return QString();
214  }
215  }
216 
217  if (format == KLocale::ShortName && possessive) {
218  switch (month) {
219  case 1:
220  return ki18nc("Julian month 1 - KLocale::ShortName Possessive", "of Jan").toString(locale());
221  case 2:
222  return ki18nc("Julian month 2 - KLocale::ShortName Possessive", "of Feb").toString(locale());
223  case 3:
224  return ki18nc("Julian month 3 - KLocale::ShortName Possessive", "of Mar").toString(locale());
225  case 4:
226  return ki18nc("Julian month 4 - KLocale::ShortName Possessive", "of Apr").toString(locale());
227  case 5:
228  return ki18nc("Julian month 5 - KLocale::ShortName Possessive", "of May").toString(locale());
229  case 6:
230  return ki18nc("Julian month 6 - KLocale::ShortName Possessive", "of Jun").toString(locale());
231  case 7:
232  return ki18nc("Julian month 7 - KLocale::ShortName Possessive", "of Jul").toString(locale());
233  case 8:
234  return ki18nc("Julian month 8 - KLocale::ShortName Possessive", "of Aug").toString(locale());
235  case 9:
236  return ki18nc("Julian month 9 - KLocale::ShortName Possessive", "of Sep").toString(locale());
237  case 10:
238  return ki18nc("Julian month 10 - KLocale::ShortName Possessive", "of Oct").toString(locale());
239  case 11:
240  return ki18nc("Julian month 11 - KLocale::ShortName Possessive", "of Nov").toString(locale());
241  case 12:
242  return ki18nc("Julian month 12 - KLocale::ShortName Possessive", "of Dec").toString(locale());
243  default:
244  return QString();
245  }
246  }
247 
248  if (format == KLocale::ShortName && !possessive) {
249  switch (month) {
250  case 1:
251  return ki18nc("Julian month 1 - KLocale::ShortName", "Jan").toString(locale());
252  case 2:
253  return ki18nc("Julian month 2 - KLocale::ShortName", "Feb").toString(locale());
254  case 3:
255  return ki18nc("Julian month 3 - KLocale::ShortName", "Mar").toString(locale());
256  case 4:
257  return ki18nc("Julian month 4 - KLocale::ShortName", "Apr").toString(locale());
258  case 5:
259  return ki18nc("Julian month 5 - KLocale::ShortName", "May").toString(locale());
260  case 6:
261  return ki18nc("Julian month 6 - KLocale::ShortName", "Jun").toString(locale());
262  case 7:
263  return ki18nc("Julian month 7 - KLocale::ShortName", "Jul").toString(locale());
264  case 8:
265  return ki18nc("Julian month 8 - KLocale::ShortName", "Aug").toString(locale());
266  case 9:
267  return ki18nc("Julian month 9 - KLocale::ShortName", "Sep").toString(locale());
268  case 10:
269  return ki18nc("Julian month 10 - KLocale::ShortName", "Oct").toString(locale());
270  case 11:
271  return ki18nc("Julian month 11 - KLocale::ShortName", "Nov").toString(locale());
272  case 12:
273  return ki18nc("Julian month 12 - KLocale::ShortName", "Dec").toString(locale());
274  default:
275  return QString();
276  }
277  }
278 
279  if (format == KLocale::LongName && possessive) {
280  switch (month) {
281  case 1:
282  return ki18nc("Julian month 1 - KLocale::LongName Possessive", "of January").toString(locale());
283  case 2:
284  return ki18nc("Julian month 2 - KLocale::LongName Possessive", "of February").toString(locale());
285  case 3:
286  return ki18nc("Julian month 3 - KLocale::LongName Possessive", "of March").toString(locale());
287  case 4:
288  return ki18nc("Julian month 4 - KLocale::LongName Possessive", "of April").toString(locale());
289  case 5:
290  return ki18nc("Julian month 5 - KLocale::LongName Possessive", "of May").toString(locale());
291  case 6:
292  return ki18nc("Julian month 6 - KLocale::LongName Possessive", "of June").toString(locale());
293  case 7:
294  return ki18nc("Julian month 7 - KLocale::LongName Possessive", "of July").toString(locale());
295  case 8:
296  return ki18nc("Julian month 8 - KLocale::LongName Possessive", "of August").toString(locale());
297  case 9:
298  return ki18nc("Julian month 9 - KLocale::LongName Possessive", "of September").toString(locale());
299  case 10:
300  return ki18nc("Julian month 10 - KLocale::LongName Possessive", "of October").toString(locale());
301  case 11:
302  return ki18nc("Julian month 11 - KLocale::LongName Possessive", "of November").toString(locale());
303  case 12:
304  return ki18nc("Julian month 12 - KLocale::LongName Possessive", "of December").toString(locale());
305  default:
306  return QString();
307  }
308  }
309 
310  // Default to LongName
311  switch (month) {
312  case 1:
313  return ki18nc("Julian month 1 - KLocale::LongName", "January").toString(locale());
314  case 2:
315  return ki18nc("Julian month 2 - KLocale::LongName", "February").toString(locale());
316  case 3:
317  return ki18nc("Julian month 3 - KLocale::LongName", "March").toString(locale());
318  case 4:
319  return ki18nc("Julian month 4 - KLocale::LongName", "April").toString(locale());
320  case 5:
321  return ki18nc("Julian month 5 - KLocale::LongName", "May").toString(locale());
322  case 6:
323  return ki18nc("Julian month 6 - KLocale::LongName", "June").toString(locale());
324  case 7:
325  return ki18nc("Julian month 7 - KLocale::LongName", "July").toString(locale());
326  case 8:
327  return ki18nc("Julian month 8 - KLocale::LongName", "August").toString(locale());
328  case 9:
329  return ki18nc("Julian month 9 - KLocale::LongName", "September").toString(locale());
330  case 10:
331  return ki18nc("Julian month 10 - KLocale::LongName", "October").toString(locale());
332  case 11:
333  return ki18nc("Julian month 11 - KLocale::LongName", "November").toString(locale());
334  case 12:
335  return ki18nc("Julian month 12 - KLocale::LongName", "December").toString(locale());
336  default:
337  return QString();
338  }
339 }
340 
341 QString KCalendarSystemJulianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
342 {
343  if (format == KLocale::NarrowName) {
344  switch (weekDay) {
345  case 1:
346  return ki18nc("Julian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
347  case 2:
348  return ki18nc("Julian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
349  case 3:
350  return ki18nc("Julian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
351  case 4:
352  return ki18nc("Julian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
353  case 5:
354  return ki18nc("Julian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
355  case 6:
356  return ki18nc("Julian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
357  case 7:
358  return ki18nc("Julian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
359  default:
360  return QString();
361  }
362  }
363 
364  if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
365  switch (weekDay) {
366  case 1:
367  return ki18nc("Julian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
368  case 2:
369  return ki18nc("Julian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
370  case 3:
371  return ki18nc("Julian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
372  case 4:
373  return ki18nc("Julian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
374  case 5:
375  return ki18nc("Julian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
376  case 6:
377  return ki18nc("Julian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
378  case 7:
379  return ki18nc("Julian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
380  default: return QString();
381  }
382  }
383 
384  switch (weekDay) {
385  case 1:
386  return ki18nc("Julian weekday 1 - KLocale::LongName", "Monday").toString(locale());
387  case 2:
388  return ki18nc("Julian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
389  case 3:
390  return ki18nc("Julian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
391  case 4:
392  return ki18nc("Julian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
393  case 5:
394  return ki18nc("Julian weekday 5 - KLocale::LongName", "Friday").toString(locale());
395  case 6:
396  return ki18nc("Julian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
397  case 7:
398  return ki18nc("Julian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
399  default:
400  return QString();
401  }
402 }
403 
404 
405 KCalendarSystemJulian::KCalendarSystemJulian(const KLocale *locale)
406  : KCalendarSystem(*new KCalendarSystemJulianPrivate(this), KSharedConfig::Ptr(), locale)
407 {
408  d_ptr->loadConfig(calendarType());
409 }
410 
411 KCalendarSystemJulian::KCalendarSystemJulian(const KSharedConfig::Ptr config, const KLocale *locale)
412  : KCalendarSystem(*new KCalendarSystemJulianPrivate(this), config, locale)
413 {
414  d_ptr->loadConfig(calendarType());
415 }
416 
417 KCalendarSystemJulian::KCalendarSystemJulian(KCalendarSystemJulianPrivate &dd,
418  const KSharedConfig::Ptr config, const KLocale *locale)
419  : KCalendarSystem(dd, config, locale)
420 {
421  d_ptr->loadConfig(calendarType());
422 }
423 
424 KCalendarSystemJulian::~KCalendarSystemJulian()
425 {
426 }
427 
428 QString KCalendarSystemJulian::calendarType() const
429 {
430  return QLatin1String("julian");
431 }
432 
433 QDate KCalendarSystemJulian::epoch() const
434 {
435  return QDate::fromJulianDay(1721426);
436 }
437 
438 QDate KCalendarSystemJulian::earliestValidDate() const
439 {
440  // 1 Jan 4712 BC, no year zero, cant be 4713BC due to error in QDate that day 0 is not valid
441  // and we really need the first in each year to be valid for the date maths
442  return QDate::fromJulianDay(366);
443 }
444 
445 QDate KCalendarSystemJulian::latestValidDate() const
446 {
447  // Set to last day of year 9999 until confirm date formats & widgets support > 9999
448  // 31 Dec 9999 AD, no year zero
449  return QDate::fromJulianDay(5373557);
450 }
451 
452 bool KCalendarSystemJulian::isValid(int year, int month, int day) const
453 {
454  return KCalendarSystem::isValid(year, month, day);
455 }
456 
457 bool KCalendarSystemJulian::isValid(const QDate &date) const
458 {
459  return KCalendarSystem::isValid(date);
460 }
461 
462 bool KCalendarSystemJulian::isLeapYear(int year) const
463 {
464  return KCalendarSystem::isLeapYear(year);
465 }
466 
467 bool KCalendarSystemJulian::isLeapYear(const QDate &date) const
468 {
469  return KCalendarSystem::isLeapYear(date);
470 }
471 
472 QString KCalendarSystemJulian::monthName(int month, int year, MonthNameFormat format) const
473 {
474  return KCalendarSystem::monthName(month, year, format);
475 }
476 
477 QString KCalendarSystemJulian::monthName(const QDate &date, MonthNameFormat format) const
478 {
479  return KCalendarSystem::monthName(date, format);
480 }
481 
482 QString KCalendarSystemJulian::weekDayName(int weekDay, WeekDayNameFormat format) const
483 {
484  return KCalendarSystem::weekDayName(weekDay, format);
485 }
486 
487 QString KCalendarSystemJulian::weekDayName(const QDate &date, WeekDayNameFormat format) const
488 {
489  return KCalendarSystem::weekDayName(date, format);
490 }
491 
492 int KCalendarSystemJulian::weekDayOfPray() const
493 {
494  return 7; // sunday
495 }
496 
497 bool KCalendarSystemJulian::isLunar() const
498 {
499  return false;
500 }
501 
502 bool KCalendarSystemJulian::isLunisolar() const
503 {
504  return false;
505 }
506 
507 bool KCalendarSystemJulian::isSolar() const
508 {
509  return true;
510 }
511 
512 bool KCalendarSystemJulian::isProleptic() const
513 {
514  return true;
515 }
516 
517 bool KCalendarSystemJulian::julianDayToDate(int jd, int &year, int &month, int &day) const
518 {
519  // Formula from The Calendar FAQ by Claus Tondering
520  // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
521  // NOTE: Coded from scratch from mathematical formulas, not copied from
522  // the Boost licensed source code
523 
524  int b = 0;
525  int c = jd + 32082;
526  int d = ((4 * c) + 3) / 1461;
527  int e = c - ((1461 * d) / 4);
528  int m = ((5 * e) + 2) / 153;
529  day = e - (((153 * m) + 2) / 5) + 1;
530  month = m + 3 - (12 * (m / 10));
531  year = (100 * b) + d - 4800 + (m / 10);
532 
533  // If year is -ve then is BC. In Julian there is no year 0, but the maths
534  // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside
535  if (year < 1) {
536  year = year - 1;
537  }
538 
539  return true;
540 }
541 
542 bool KCalendarSystemJulian::dateToJulianDay(int year, int month, int day, int &jd) const
543 {
544  // Formula from The Calendar FAQ by Claus Tondering
545  // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000
546  // NOTE: Coded from scratch from mathematical formulas, not copied from
547  // the Boost licensed source code
548 
549  // If year is -ve then is BC. In Julian there is no year 0, but the maths
550  // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally
551  int y;
552  if (year < 1) {
553  y = year + 1;
554  } else {
555  y = year;
556  }
557 
558  int a = (14 - month) / 12;
559  y = y + 4800 - a;
560  int m = month + (12 * a) - 3;
561 
562  jd = day
563  + (((153 * m) + 2) / 5)
564  + (365 * y)
565  + (y / 4)
566  - 32083;
567 
568  return true;
569 }
KLocale::NarrowName
Narrow text format, may not be unique, e.g.
Definition: klocale.h:913
KSharedPtr< KSharedConfig >
KCalendarSystemJulian
Definition: kcalendarsystemjulian_p.h:41
KSharedConfig
KConfig variant using shared memory.
Definition: ksharedconfig.h:40
KLocalizedString::toString
QString toString() const
Finalizes the translation, creates QString with placeholders substituted.
Definition: klocalizedstring.cpp:192
KCalendarSystem::isLeapYear
virtual bool isLeapYear(int year) const =0
Returns whether a given year is a leap year.
Definition: kcalendarsystem.cpp:1720
kdebug.h
KCalendarSystemPrivate::earliestValidYear
virtual int earliestValidYear() const
Definition: kcalendarsystem.cpp:371
KCalendarSystem::monthName
virtual QString monthName(int month, int year, MonthNameFormat format=LongName) const =0
Gets specific calendar type month name for a given month number If an invalid month is specified...
Definition: kcalendarsystem.cpp:1842
KCalendarSystemJulian::monthName
virtual QString monthName(int month, int year, MonthNameFormat format=LongName) const
Gets specific calendar type month name for a given month number If an invalid month is specified...
Definition: kcalendarsystemjulian.cpp:472
KCalendarSystemPrivate::loadDefaultEraList
virtual void loadDefaultEraList()
Definition: kcalendarsystem.cpp:269
KCalendarSystemJulian::KCalendarSystemJulian
KCalendarSystemJulian(const KLocale *locale=0)
Definition: kcalendarsystemjulian.cpp:405
KCalendarSystemPrivate::monthsInYear
virtual int monthsInYear(int year) const
Definition: kcalendarsystem.cpp:277
KCalendarSystemJulian::isLunar
virtual bool isLunar() const
Returns whether the calendar is lunar based.
Definition: kcalendarsystemjulian.cpp:497
KCalendarSystemJulian::dateToJulianDay
virtual bool dateToJulianDay(int year, int month, int day, int &jd) const
Internal method to convert YMD values for this calendar system into a Julian Day number.
Definition: kcalendarsystemjulian.cpp:542
KCalendarSystem::MonthNameFormat
MonthNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:55
klocale.h
KCalendarSystemPrivate::maxMonthsInYear
virtual int maxMonthsInYear() const
Definition: kcalendarsystem.cpp:362
KCalendarSystemJulian::isValid
virtual bool isValid(int year, int month, int day) const
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystemjulian.cpp:452
KLocale::ShortNumber
Number at its natural width, e.g.
Definition: klocale.h:910
KCalendarSystem
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
Definition: kcalendarsystem.h:40
KLocale::DateTimeComponentFormat
DateTimeComponentFormat
Definition: klocale.h:908
i18nc
QString i18nc(const char *ctxt, const char *text)
Returns a localized version of a string and a context.
Definition: klocalizedstring.h:797
KCalendarSystemPrivate::daysInYear
virtual int daysInYear(int year) const
Definition: kcalendarsystem.cpp:304
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
KCalendarSystemPrivate::daysInWeek
virtual int daysInWeek() const
Definition: kcalendarsystem.cpp:315
KCalendarSystemJulian::~KCalendarSystemJulian
virtual ~KCalendarSystemJulian()
Definition: kcalendarsystemjulian.cpp:424
kglobal.h
KCalendarSystemJulian::weekDayOfPray
virtual int weekDayOfPray() const
Definition: kcalendarsystemjulian.cpp:492
KCalendarSystemJulian::isProleptic
virtual bool isProleptic() const
Returns whether the calendar system is proleptic, i.e.
Definition: kcalendarsystemjulian.cpp:512
KLocale::CalendarSystem
CalendarSystem
Definition: klocale.h:780
KCalendarSystemJulian::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const
Gets specific calendar type week day name.
Definition: kcalendarsystemjulian.cpp:482
KLocale::LongName
Long text format, e.g.
Definition: klocale.h:915
KCalendarSystem::month
virtual int month(const QDate &date) const
Returns the month portion of a given date in the current calendar system.
Definition: kcalendarsystem.cpp:1344
QDate
QString
KCalendarSystemPrivate::hasLeapMonths
virtual bool hasLeapMonths() const
Definition: kcalendarsystem.cpp:341
KCalendarSystemJulian::earliestValidDate
virtual QDate earliestValidDate() const
Returns the earliest date valid in this calendar system implementation.
Definition: kcalendarsystemjulian.cpp:438
kcalendarsystemprivate_p.h
KCalendarSystem::WeekDayNameFormat
WeekDayNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:66
KCalendarSystemJulian::isLunisolar
virtual bool isLunisolar() const
Returns whether the calendar is lunisolar based.
Definition: kcalendarsystemjulian.cpp:502
KCalendarSystemJulian::isSolar
virtual bool isSolar() const
Returns whether the calendar is solar based.
Definition: kcalendarsystemjulian.cpp:507
KCalendarSystem::isValid
virtual bool isValid(int year, int month, int day) const =0
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystem.cpp:1133
KCalendarSystemPrivate::maxDaysInWeek
virtual int maxDaysInWeek() const
Definition: kcalendarsystem.cpp:355
KLocale::ShortName
Short text format, e.g.
Definition: klocale.h:914
KCalendarSystem::year
virtual int year(const QDate &date) const
Returns the year portion of a given date in the current calendar system.
Definition: kcalendarsystem.cpp:1331
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KCalendarSystemPrivate::hasYearZero
virtual bool hasYearZero() const
Definition: kcalendarsystem.cpp:348
KConfigGroup
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:53
KCalendarSystemPrivate
Definition: kcalendarsystemprivate_p.h:31
KCalendarSystemPrivate::monthName
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive=false) const
Definition: kcalendarsystem.cpp:387
KCalendarSystemPrivate::latestValidYear
virtual int latestValidYear() const
Definition: kcalendarsystem.cpp:380
KCalendarSystemPrivate::daysInMonth
virtual int daysInMonth(int year, int month) const
Definition: kcalendarsystem.cpp:285
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:69
KCalendarSystemPrivate::weekDayName
virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
Definition: kcalendarsystem.cpp:398
QLatin1String
KCalendarSystemJulian::calendarType
virtual QString calendarType() const
Definition: kcalendarsystemjulian.cpp:428
ki18nc
KLocalizedString ki18nc(const char *ctxt, const char *msg)
Creates localized string from a given message, with added context.
Definition: klocalizedstring.cpp:929
KCalendarSystemJulian::julianDayToDate
virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const
Internal method to convert a Julian Day number into the YMD values for this calendar system...
Definition: kcalendarsystemjulian.cpp:517
KCalendarSystemJulian::latestValidDate
virtual QDate latestValidDate() const
Returns the latest date valid in this calendar system implementation.
Definition: kcalendarsystemjulian.cpp:445
KCalendarSystemPrivate::calendarSystem
virtual KLocale::CalendarSystem calendarSystem() const
Definition: kcalendarsystem.cpp:261
kcalendarsystemjulian_p.h
QString::fromLatin1
QString fromLatin1(const char *str, int size)
KCalendarSystemPrivate::isLeapYear
virtual bool isLeapYear(int year) const
Definition: kcalendarsystem.cpp:322
QDate::fromJulianDay
QDate fromJulianDay(int jd)
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:248
KLocale::JulianCalendar
Julian Calendar, as used in Orthodox Churches.
Definition: klocale.h:801
KCalendarSystem::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const =0
Gets specific calendar type week day name.
Definition: kcalendarsystem.cpp:1881
kconfiggroup.h
KCalendarSystemJulian::epoch
virtual QDate epoch() const
Returns a QDate holding the epoch of the calendar system.
Definition: kcalendarsystemjulian.cpp:433
KCalendarSystemJulian::isLeapYear
virtual bool isLeapYear(int year) const
Returns whether a given year is a leap year.
Definition: kcalendarsystemjulian.cpp:462
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal