• 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
kcalendarsystemhebrew.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2003 Hans Petter Bieker <bieker@kde.org>
3  Copyright 2007, 2009, 2010 John Layt <john@layt.net>
4  Calendar conversion routines based on Hdate v6, by Amos
5  Shapir 1978 (rev. 1985, 1992)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 // Derived hebrew kde calendar class
24 
25 #include "kcalendarsystemhebrew_p.h"
26 #include "kcalendarsystemprivate_p.h"
27 
28 #include "kdebug.h"
29 #include "klocale.h"
30 
31 #include <QtCore/QDate>
32 #include <QtCore/QCharRef>
33 
34 static int hebrewDaysElapsed(int y);
35 
36 class h_date
37 {
38 public:
39  int hd_day;
40  int hd_mon;
41  int hd_year;
42  int hd_dw;
43  int hd_flg;
44 };
45 
46 /*
47  * compute general date structure from hebrew date
48  */
49 static class h_date * hebrewToGregorian(int y, int m, int d)
50 {
51  static class h_date h;
52  int s;
53 
54  y -= 3744;
55  s = hebrewDaysElapsed(y);
56  d += s;
57  s = hebrewDaysElapsed(y + 1) - s; /* length of year */
58 
59  if (s > 365 && m > 6) {
60  --m;
61  d += 30;
62  }
63  d += (59 * (m - 1) + 1) / 2; /* regular months */
64  /* special cases */
65  if (s % 10 > 4 && m > 2) { /* long Heshvan */
66  d++;
67  }
68  if (s % 10 < 4 && m > 3) { /* short Kislev */
69  d--;
70  }
71  // ### HPB: Broken in leap years
72  //if (s > 365 && m > 6) /* leap year */
73  // d += 30;
74  d -= 6002;
75 
76  y = (d + 36525) * 4 / 146097 - 1;
77  d -= y / 4 * 146097 + (y % 4) * 36524;
78  y *= 100;
79 
80  /* compute year */
81  s = (d + 366) * 4 / 1461 - 1;
82  d -= s / 4 * 1461 + (s % 4) * 365;
83  y += s;
84  /* compute month */
85  m = (d + 245) * 12 / 367 - 7;
86  d -= m * 367 / 12 - 30;
87  if (++m >= 12) {
88  m -= 12;
89  y++;
90  }
91  h.hd_day = d;
92  h.hd_mon = m;
93  h.hd_year = y;
94  return(&h);
95 }
96 
97 /*
98  * compute date structure from no. of days since 1 Tishrei 3744
99  */
100 static class h_date * gregorianToHebrew(int y, int m, int d)
101 {
102  static class h_date h;
103  int s;
104 
105  if ((m -= 2) <= 0) {
106  m += 12;
107  y--;
108  }
109  /* no. of days, Julian calendar */
110  d += 365 * y + y / 4 + 367 * m / 12 + 5968;
111  /* Gregorian calendar */
112  d -= y / 100 - y / 400 - 2;
113  h.hd_dw = (d + 1) % 7;
114 
115  /* compute the year */
116  y += 16;
117  s = hebrewDaysElapsed(y);
118  m = hebrewDaysElapsed(y + 1);
119  while (d >= m) { /* computed year was underestimated */
120  s = m;
121  y++;
122  m = hebrewDaysElapsed(y + 1);
123  }
124  d -= s;
125  s = m - s; /* size of current year */
126  y += 3744;
127 
128  h.hd_flg = s % 10 - 4;
129 
130  /* compute day and month */
131  if (d >= s - 236) { /* last 8 months are regular */
132  d -= s - 236;
133  m = d * 2 / 59;
134  d -= (m * 59 + 1) / 2;
135  m += 4;
136  if (s > 365 && m <= 5) { /* Adar of Meuberet */
137  m += 8;
138  }
139  } else {
140  /* first 4 months have 117-119 days */
141  s = 114 + s % 10;
142  m = d * 4 / s;
143  d -= (m * s + 3) / 4;
144  }
145 
146  h.hd_day = d;
147  h.hd_mon = m;
148  h.hd_year = y;
149  return(&h);
150 }
151 
152 /* constants, in 1/18th of minute */
153 static const int HOUR = 1080;
154 static const int DAY = 24 * HOUR;
155 static const int WEEK = 7 * DAY;
156 #define M(h,p) ((h)*HOUR+p)
157 #define MONTH (DAY+M(12,793))
158 
163 static int hebrewDaysElapsed(int y)
164 {
165  int m, nm, dw, s, l;
166 
167  l = y * 7 + 1; // no. of leap months
168  m = y * 12 + l / 19; // total no. of months
169  l %= 19;
170  nm = m * MONTH + M(1 + 6, 779); // molad new year 3744 (16BC) + 6 hours
171  s = m * 28 + nm / DAY - 2;
172 
173  nm %= WEEK;
174  dw = nm / DAY;
175  nm %= DAY;
176 
177  // special cases of Molad Zaken
178  if ((l < 12 && dw == 3 && nm >= M(9 + 6, 204)) ||
179  (l < 7 && dw == 2 && nm >= M(15 + 6, 589))) {
180  s++, dw++;
181  }
182 
183  /* ADU */
184  if (dw == 1 || dw == 4 || dw == 6) {
185  s++;
186  }
187  return s;
188 }
189 
194 static int long_cheshvan(int year)
195 {
196  QDate first, last;
197  class h_date *gd;
198 
199  gd = hebrewToGregorian(year, 1, 1);
200  first.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1);
201 
202  gd = hebrewToGregorian(year + 1, 1, 1);
203  last.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1);
204 
205  return (first.daysTo(last) % 10 == 5);
206 }
207 
212 static int short_kislev(int year)
213 {
214  QDate first, last;
215  class h_date * gd;
216 
217  gd = hebrewToGregorian(year, 1, 1);
218  first.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1);
219 
220  gd = hebrewToGregorian(year + 1, 1, 1);
221  last.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1);
222 
223  return (first.daysTo(last) % 10 == 3);
224 }
225 
226 // Ok
227 static class h_date *toHebrew(const QDate &date)
228 {
229  class h_date *sd;
230 
231  sd = gregorianToHebrew(date.year(), date.month(), date.day());
232  ++sd->hd_mon;
233  ++sd->hd_day;
234 
235  return sd;
236 }
237 
238 class KCalendarSystemHebrewPrivate : public KCalendarSystemPrivate
239 {
240 public:
241  explicit KCalendarSystemHebrewPrivate(KCalendarSystemHebrew *q);
242 
243  virtual ~KCalendarSystemHebrewPrivate();
244 
245  // Virtual methods each calendar system must re-implement
246  virtual KLocale::CalendarSystem calendarSystem() const;
247  virtual void loadDefaultEraList();
248  virtual int monthsInYear(int year) const;
249  virtual int daysInMonth(int year, int month) const;
250  virtual int daysInYear(int year) const;
251  virtual int daysInWeek() const;
252  virtual bool isLeapYear(int year) const;
253  virtual bool hasLeapMonths() const;
254  virtual bool hasYearZero() const;
255  virtual int maxDaysInWeek() const;
256  virtual int maxMonthsInYear() const;
257  virtual int earliestValidYear() const;
258  virtual int latestValidYear() const;
259  virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
260  virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
261 
262  virtual int integerFromString(const QString &string, int maxLength, int &readLength) const;
263  virtual QString stringFromInteger(int number, int padWidth = 0, QChar padChar = QLatin1Char('0')) const;
264  virtual QString stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const;
265 
266  virtual int monthNumberToMonthIndex(int year, int month) const;
267 };
268 
269 // Shared d pointer base class definitions
270 
271 KCalendarSystemHebrewPrivate::KCalendarSystemHebrewPrivate(KCalendarSystemHebrew *q)
272  : KCalendarSystemPrivate(q)
273 {
274 }
275 
276 KCalendarSystemHebrewPrivate::~KCalendarSystemHebrewPrivate()
277 {
278 }
279 
280 KLocale::CalendarSystem KCalendarSystemHebrewPrivate::calendarSystem() const
281 {
282  return KLocale::HebrewCalendar;
283 }
284 
285 void KCalendarSystemHebrewPrivate::loadDefaultEraList()
286 {
287  QString name, shortName, format;
288  // Jewish Era, Anno Mundi, "Year of the World".
289  name = i18nc("Calendar Era: Hebrew Era, years > 0, LongFormat", "Anno Mundi");
290  shortName = i18nc("Calendar Era: Hebrew Era, years > 0, ShortFormat", "AM");
291  format = i18nc("(kdedt-format) Hebrew, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC");
292  addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format);
293 }
294 
295 int KCalendarSystemHebrewPrivate::monthsInYear(int year) const
296 {
297  if (isLeapYear(year)) {
298  return 13;
299  } else {
300  return 12;
301  }
302 }
303 
304 int KCalendarSystemHebrewPrivate::daysInMonth(int year, int month) const
305 {
306  int mi = monthNumberToMonthIndex(year, month);
307 
308  if (mi == 2 && long_cheshvan(year)) {
309  return 30;
310  }
311 
312  if (mi == 3 && short_kislev(year)) {
313  return 29;
314  }
315 
316  if (mi % 2 == 0) { // Even number months have 29 days
317  return 29;
318  } else { // Odd number months have 30 days
319  return 30;
320  }
321 }
322 
323 int KCalendarSystemHebrewPrivate::daysInYear(int year) const
324 {
325  int days;
326 
327  // Get Regular year length
328  if (isLeapYear(year)) { // Has 13 months
329  days = 384;
330  } else { // Has 12 months
331  days = 354;
332  }
333 
334  // Check if is Deficient or Abundant year
335  if (short_kislev(year)) { // Deficient
336  days = days - 1;
337  } else if (long_cheshvan(year)) { // Abundant
338  days = days + 1;
339  }
340 
341  return days;
342 }
343 
344 int KCalendarSystemHebrewPrivate::daysInWeek() const
345 {
346  return 7;
347 }
348 
349 bool KCalendarSystemHebrewPrivate::isLeapYear(int year) const
350 {
351  return ((((7 * year) + 1) % 19) < 7);
352 }
353 
354 bool KCalendarSystemHebrewPrivate::hasLeapMonths() const
355 {
356  return true;
357 }
358 
359 bool KCalendarSystemHebrewPrivate::hasYearZero() const
360 {
361  return false;
362 }
363 
364 int KCalendarSystemHebrewPrivate::maxDaysInWeek() const
365 {
366  return 7;
367 }
368 
369 int KCalendarSystemHebrewPrivate::maxMonthsInYear() const
370 {
371  return 13;
372 }
373 
374 int KCalendarSystemHebrewPrivate::earliestValidYear() const
375 {
376  return 5344;
377 }
378 
379 int KCalendarSystemHebrewPrivate::latestValidYear() const
380 {
381  return 8119;
382 }
383 
384 int KCalendarSystemHebrewPrivate::integerFromString(const QString &inputString, int maxLength, int &readLength) const
385 {
386  if (locale()->language() == QLatin1String("he")) {
387 
388  // Hebrew numbers are composed of combinations of normal letters which have a numeric value.
389  // This is a non-positional system, the numeric values are simply added together, however
390  // convention is for a RTL highest to lowest value ordering. There is also a degree of
391  // ambiguity due to the lack of a letter for 0, hence 5 and 5000 are written the same.
392  // Hebrew numbers are only used in dates.
393  // See http://www.i18nguy.com/unicode/hebrew-numbers.html for more explaination
394 
395  /*
396  Ref table for numbers to Hebrew chars
397 
398  Value 1 2 3 4 5 6 7 8 9
399 
400  x 1 Alef א Bet ב Gimel ג Dalet ד He ה Vav ו Zayen ז Het ח Tet ט
401  0x05D0 0x05D1 0x05D2 0x05D3 0x05D4 0x05D5 0x05D6 0x05D7 0x05D8
402 
403  x 10 Yod י Kaf כ Lamed ל Mem מ Nun נ Samekh ס Ayin ע Pe פ Tzadi צ
404  0x05D9 0x05DB 0x05DC 0x05DE 0x05E0 0x05E1 0x05E2 0x05E4 0x05E6
405 
406  x 100 Qof ק Resh ר Shin ש Tav ת
407  0x05E7 0x05E8 0x05E9 0x05EA
408 
409  Note special cases 15 = 9 + 6 = 96 טו and 16 = 9 + 7 = 97 טז
410  */
411 
412  int decadeValues[14] = {10, 20, 20, 30, 40, 40, 50, 50, 60, 70, 80, 80, 90, 90};
413 
414  QChar thisChar, nextChar;
415  QString string = inputString;
416 
417  int stringLength = string.length();
418  readLength = 0;
419  int position = 0;
420  int result = 0;
421  int value = 0;
422 
423  for (; position < stringLength ; ++position) {
424 
425  thisChar = string[position];
426 
427  if (position + 1 < stringLength) {
428  nextChar = string[position + 1];
429  // Ignore any geresh or gershayim chars, we don't bother checking they are in the right place
430  if (nextChar == QLatin1Char('\'') || nextChar == QChar(0x05F3) || // geresh
431  nextChar == QLatin1Char('\"') || nextChar == QChar(0x05F4)) { // gershayim
432  string.remove(position + 1, 1);
433  stringLength = string.length();
434  if (position + 1 < stringLength) {
435  nextChar = string[position + 1];
436  } else {
437  nextChar = QChar();
438  }
439  readLength = readLength + 1;
440  }
441  } else {
442  nextChar = QChar();
443  }
444 
445  if (thisChar >= QChar(0x05D0) && thisChar <= QChar(0x05D7)) {
446 
447  // If this char Alef to Het, 1 to 8, א to ח
448 
449  // If next char is any valid digit char (Alef to Tav, 1 to 400, א to ת)
450  // then this char is a thousands digit
451  // else this char is a ones digit
452 
453  if (nextChar >= QChar(0x05D0) && nextChar <= QChar(0x05EA)) {
454  value = (thisChar.unicode() - 0x05D0 + 1) * 1000;
455  } else {
456  value = thisChar.unicode() - 0x05D0 + 1;
457  }
458 
459  } else if (thisChar == QChar(0x05D8)) {
460 
461  // If this char is Tet, 9, ט
462 
463  // If next char is any valid digit char (Alef to Tav, 1 to 400, א to ת)
464  // and next char not 6 (Special case for 96 = 15)
465  // and next char not 7 (Special case for 97 = 16)
466  // then is a thousands digit else is 9
467 
468  if (nextChar >= QChar(0x05D0) && nextChar <= QChar(0x05EA) &&
469  nextChar != QChar(0x05D5) && nextChar != QChar(0x05D6)) {
470  value = 9000;
471  } else {
472  value = 9;
473  }
474 
475  } else if (thisChar >= QChar(0x05D9) && thisChar <= QChar(0x05E6)) {
476 
477  // If this char Yod to Tsadi, 10 to 90, י to צ
478 
479  // If next char is a tens or hundreds char then is an error
480  // Else is a tens digit
481 
482  if (nextChar >= QChar(0x05D9)) {
483  return -1;
484  } else {
485  value = decadeValues[thisChar.unicode() - 0x05D9];
486  }
487 
488  } else if (thisChar >= QChar(0x05E7) && thisChar <= QChar(0x05EA)) {
489 
490  // If this char Qof to Tav, 100 to 400, ק to ת, then is hundreds digit
491 
492  value = (thisChar.unicode() - 0x05E7 + 1) * 100;
493 
494  } else {
495 
496  // If this char any non-digit char including whitespace or punctuation, we're done
497  break;
498 
499  }
500 
501  result = result + value;
502 
503  value = 0;
504  }
505 
506  readLength += position;
507 
508  return result;
509 
510  } else {
511  return KCalendarSystemPrivate::integerFromString(inputString, maxLength, readLength);
512  }
513 }
514 
515 QString KCalendarSystemHebrewPrivate::stringFromInteger(int number, int padWidth, QChar padChar) const
516 {
517  return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar);
518 }
519 
520 QString KCalendarSystemHebrewPrivate::stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const
521 {
522  if (locale()->language() == QLatin1String("he")) {
523 
524  // Hebrew numbers are composed of combinations of normal letters which have a numeric value.
525  // This is a non-positional system, the numeric values are simply added together, however
526  // convention is for a RTL highest to lowest value ordering. There is also a degree of
527  // ambiguity due to the lack of a letter for 0, hence 5 and 5000 are written the same.
528  // Hebrew numbers are only used in dates.
529  // See http://www.i18nguy.com/unicode/hebrew-numbers.html for more explaination
530 
531  /*
532  Ref table for numbers to Hebrew chars
533 
534  Value 1 2 3 4 5 6 7 8 9
535 
536  x 1 Alef א Bet ב Gimel ג Dalet ד He ה Vav ו Zayen ז Het ח Tet ט
537  0x05D0 0x05D1 0x05D2 0x05D3 0x05D4 0x05D5 0x05D6 0x05D7 0x05D8
538 
539  x 10 Yod י Kaf כ Lamed ל Mem מ Nun נ Samekh ס Ayin ע Pe פ Tzadi צ
540  0x05D9 0x05DB 0x05DC 0x05DE 0x05E0 0x05E1 0x05E2 0x05E4 0x05E6
541 
542  x 100 Qof ק Resh ר Shin ש Tav ת
543  0x05E7 0x05E8 0x05E9 0x05EA
544 
545  Note special cases 15 = 9 + 6 = 96 טו and 16 = 9 + 7 = 97 טז
546  */
547 
548  const QChar decade[] = {
549  // Tet = ט, Yod = י, Kaf = כ, Lamed = ל, Mem = מ
550  // Nun = נ, Samekh = ס, Ayin = ע, Pe = פ, Tsadi = צ
551  0x05D8, 0x05D9, 0x05DB, 0x05DC, 0x05DE,
552  0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6
553  };
554 
555  QString result;
556 
557  // We have no rules for coping with numbers outside this range
558  if (number < 1 || number > 9999) {
559  return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar, digitSet);
560  }
561 
562  // Translate the thousands digit, just uses letter for number 1..9 ( א to ט, Alef to Tet )
563  // Years 5001-5999 do not have the thousands by convention
564  if (number >= 1000) {
565  if (number <= 5000 || number >= 6000) {
566  result += QChar(0x05D0 - 1 + number / 1000); // Alef א to Tet ט
567  }
568  number %= 1000;
569  }
570 
571  // Translate the hundreds digit
572  // Use traditional method where we only have letters assigned values for 100, 200, 300 and 400
573  // so may need to repeat 400 twice to make up the required number
574  if (number >= 100) {
575  while (number >= 500) {
576  result += QChar(0x05EA); // Tav = ת
577  number -= 400;
578  }
579  result += QChar(0x05E7 - 1 + number / 100); // Qof = ק to xxx
580  number %= 100;
581  }
582 
583  // Translate the tens digit
584  // The numbers 15 and 16 translate to letters that spell out the name of God which is
585  // forbidden, so require special treatment where 15 = 9 + 6 and 1 = 9 + 7.
586  if (number >= 10) {
587  if (number == 15 || number == 16)
588  number -= 9;
589  result += decade[number / 10];
590  number %= 10;
591  }
592 
593  // Translate the ones digit, uses letter for number 1..9 ( א to ט, Alef to Tet )
594  if (number > 0) {
595  result += QChar(0x05D0 - 1 + number); // Alef = א to xxx
596  }
597 
598  // When used in a string with mixed names and numbers the numbers need special chars to
599  // distinguish them from words composed of the same letters.
600  // Single digit numbers are followed by a geresh symbol ? (Unicode = 0x05F3), but we use
601  // single quote for convenience.
602  // Multiple digit numbers have a gershayim symbol ? (Unicode = 0x05F4) as second-to-last
603  // char, but we use double quote for convenience.
604  if (result.length() == 1) {
605  result += QLatin1Char('\'');
606  } else {
607  result.insert(result.length() - 1, QLatin1Char('\"'));
608  }
609 
610  return result;
611 
612  } else {
613  return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar, digitSet);
614  }
615 }
616 
617 int KCalendarSystemHebrewPrivate::monthNumberToMonthIndex(int year, int month) const
618 {
619  if (isLeapYear(year)) {
620  if (month == 6) {
621  return 13; // Adar I
622  } else if (month == 7) {
623  return 14; // Adar II
624  } else if (month > 7) {
625  return month - 1; // Because of Adar II
626  }
627  }
628 
629  return month;
630 }
631 
632 QString KCalendarSystemHebrewPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const
633 {
634  // We must map month number to month index
635  int monthIndex = monthNumberToMonthIndex(year, month);
636 
637  if (format == KLocale::NarrowName) {
638  switch (monthIndex) {
639  case 1:
640  return ki18nc("Hebrew month 1 - KLocale::NarrowName", "T").toString(locale());
641  case 2:
642  return ki18nc("Hebrew month 2 - KLocale::NarrowName", "H").toString(locale());
643  case 3:
644  return ki18nc("Hebrew month 3 - KLocale::NarrowName", "K").toString(locale());
645  case 4:
646  return ki18nc("Hebrew month 4 - KLocale::NarrowName", "T").toString(locale());
647  case 5:
648  return ki18nc("Hebrew month 5 - KLocale::NarrowName", "S").toString(locale());
649  case 6:
650  return ki18nc("Hebrew month 6 - KLocale::NarrowName", "A").toString(locale());
651  case 7:
652  return ki18nc("Hebrew month 7 - KLocale::NarrowName", "N").toString(locale());
653  case 8:
654  return ki18nc("Hebrew month 8 - KLocale::NarrowName", "I").toString(locale());
655  case 9:
656  return ki18nc("Hebrew month 9 - KLocale::NarrowName", "S").toString(locale());
657  case 10:
658  return ki18nc("Hebrew month 10 - KLocale::NarrowName", "T").toString(locale());
659  case 11:
660  return ki18nc("Hebrew month 11 - KLocale::NarrowName", "A").toString(locale());
661  case 12:
662  return ki18nc("Hebrew month 12 - KLocale::NarrowName", "E").toString(locale());
663  case 13:
664  return ki18nc("Hebrew month 13 - KLocale::NarrowName", "A").toString(locale());
665  case 14:
666  return ki18nc("Hebrew month 14 - KLocale::NarrowName", "A").toString(locale());
667  default:
668  return QString();
669  }
670  }
671 
672  if (format == KLocale::ShortName && possessive) {
673  switch (monthIndex) {
674  case 1:
675  return ki18nc("Hebrew month 1 - KLocale::ShortName Possessive", "of Tis").toString(locale());
676  case 2:
677  return ki18nc("Hebrew month 2 - KLocale::ShortName Possessive", "of Hes").toString(locale());
678  case 3:
679  return ki18nc("Hebrew month 3 - KLocale::ShortName Possessive", "of Kis").toString(locale());
680  case 4:
681  return ki18nc("Hebrew month 4 - KLocale::ShortName Possessive", "of Tev").toString(locale());
682  case 5:
683  return ki18nc("Hebrew month 5 - KLocale::ShortName Possessive", "of Shv").toString(locale());
684  case 6:
685  return ki18nc("Hebrew month 6 - KLocale::ShortName Possessive", "of Ada").toString(locale());
686  case 7:
687  return ki18nc("Hebrew month 7 - KLocale::ShortName Possessive", "of Nis").toString(locale());
688  case 8:
689  return ki18nc("Hebrew month 8 - KLocale::ShortName Possessive", "of Iya").toString(locale());
690  case 9:
691  return ki18nc("Hebrew month 9 - KLocale::ShortName Possessive", "of Siv").toString(locale());
692  case 10:
693  return ki18nc("Hebrew month 10 - KLocale::ShortName Possessive", "of Tam").toString(locale());
694  case 11:
695  return ki18nc("Hebrew month 11 - KLocale::ShortName Possessive", "of Av").toString(locale());
696  case 12:
697  return ki18nc("Hebrew month 12 - KLocale::ShortName Possessive", "of Elu").toString(locale());
698  case 13:
699  return ki18nc("Hebrew month 13 - KLocale::ShortName Possessive", "of Ad1").toString(locale());
700  case 14:
701  return ki18nc("Hebrew month 14 - KLocale::ShortName Possessive", "of Ad2").toString(locale());
702  default:
703  return QString();
704  }
705  }
706 
707  if (format == KLocale::ShortName && !possessive) {
708  switch (monthIndex) {
709  case 1:
710  return ki18nc("Hebrew month 1 - KLocale::ShortName", "Tis").toString(locale());
711  case 2:
712  return ki18nc("Hebrew month 2 - KLocale::ShortName", "Hes").toString(locale());
713  case 3:
714  return ki18nc("Hebrew month 3 - KLocale::ShortName", "Kis").toString(locale());
715  case 4:
716  return ki18nc("Hebrew month 4 - KLocale::ShortName", "Tev").toString(locale());
717  case 5:
718  return ki18nc("Hebrew month 5 - KLocale::ShortName", "Shv").toString(locale());
719  case 6:
720  return ki18nc("Hebrew month 6 - KLocale::ShortName", "Ada").toString(locale());
721  case 7:
722  return ki18nc("Hebrew month 7 - KLocale::ShortName", "Nis").toString(locale());
723  case 8:
724  return ki18nc("Hebrew month 8 - KLocale::ShortName", "Iya").toString(locale());
725  case 9:
726  return ki18nc("Hebrew month 9 - KLocale::ShortName", "Siv").toString(locale());
727  case 10:
728  return ki18nc("Hebrew month 10 - KLocale::ShortName", "Tam").toString(locale());
729  case 11:
730  return ki18nc("Hebrew month 11 - KLocale::ShortName", "Av").toString(locale());
731  case 12:
732  return ki18nc("Hebrew month 12 - KLocale::ShortName", "Elu").toString(locale());
733  case 13:
734  return ki18nc("Hebrew month 13 - KLocale::ShortName", "Ad1").toString(locale());
735  case 14:
736  return ki18nc("Hebrew month 14 - KLocale::ShortName", "Ad2").toString(locale());
737  default:
738  return QString();
739  }
740  }
741 
742  if (format == KLocale::LongName && possessive) {
743  switch (monthIndex) {
744  case 1:
745  return ki18nc("Hebrew month 1 - KLocale::LongName Possessive", "of Tishrey").toString(locale());
746  case 2:
747  return ki18nc("Hebrew month 2 - KLocale::LongName Possessive", "of Heshvan").toString(locale());
748  case 3:
749  return ki18nc("Hebrew month 3 - KLocale::LongName Possessive", "of Kislev").toString(locale());
750  case 4:
751  return ki18nc("Hebrew month 4 - KLocale::LongName Possessive", "of Tevet").toString(locale());
752  case 5:
753  return ki18nc("Hebrew month 5 - KLocale::LongName Possessive", "of Shvat").toString(locale());
754  case 6:
755  return ki18nc("Hebrew month 6 - KLocale::LongName Possessive", "of Adar").toString(locale());
756  case 7:
757  return ki18nc("Hebrew month 7 - KLocale::LongName Possessive", "of Nisan").toString(locale());
758  case 8:
759  return ki18nc("Hebrew month 8 - KLocale::LongName Possessive", "of Iyar").toString(locale());
760  case 9:
761  return ki18nc("Hebrew month 9 - KLocale::LongName Possessive", "of Sivan").toString(locale());
762  case 10:
763  return ki18nc("Hebrew month 10 - KLocale::LongName Possessive", "of Tamuz").toString(locale());
764  case 11:
765  return ki18nc("Hebrew month 11 - KLocale::LongName Possessive", "of Av").toString(locale());
766  case 12:
767  return ki18nc("Hebrew month 12 - KLocale::LongName Possessive", "of Elul").toString(locale());
768  case 13:
769  return ki18nc("Hebrew month 13 - KLocale::LongName Possessive", "of Adar I").toString(locale());
770  case 14:
771  return ki18nc("Hebrew month 14 - KLocale::LongName Possessive", "of Adar II").toString(locale());
772  default:
773  return QString();
774  }
775  }
776 
777  // Default to LongName
778  switch (monthIndex) {
779  case 1:
780  return ki18nc("Hebrew month 1 - KLocale::LongName", "Tishrey").toString(locale());
781  case 2:
782  return ki18nc("Hebrew month 2 - KLocale::LongName", "Heshvan").toString(locale());
783  case 3:
784  return ki18nc("Hebrew month 3 - KLocale::LongName", "Kislev").toString(locale());
785  case 4:
786  return ki18nc("Hebrew month 4 - KLocale::LongName", "Tevet").toString(locale());
787  case 5:
788  return ki18nc("Hebrew month 5 - KLocale::LongName", "Shvat").toString(locale());
789  case 6:
790  return ki18nc("Hebrew month 6 - KLocale::LongName", "Adar").toString(locale());
791  case 7:
792  return ki18nc("Hebrew month 7 - KLocale::LongName", "Nisan").toString(locale());
793  case 8:
794  return ki18nc("Hebrew month 8 - KLocale::LongName", "Iyar").toString(locale());
795  case 9:
796  return ki18nc("Hebrew month 9 - KLocale::LongName", "Sivan").toString(locale());
797  case 10:
798  return ki18nc("Hebrew month 10 - KLocale::LongName", "Tamuz").toString(locale());
799  case 11:
800  return ki18nc("Hebrew month 11 - KLocale::LongName", "Av").toString(locale());
801  case 12:
802  return ki18nc("Hebrew month 12 - KLocale::LongName", "Elul").toString(locale());
803  case 13:
804  return ki18nc("Hebrew month 13 - KLocale::LongName", "Adar I").toString(locale());
805  case 14:
806  return ki18nc("Hebrew month 14 - KLocale::LongName", "Adar II").toString(locale());
807  default:
808  return QString();
809  }
810 }
811 
812 // Use Western day names for now as that's what the old version did,
813 // but wouldn't it be better to use the right Hebrew names like Shabbat?
814 // Could make it switchable by adding new enums to WeekDayFormat, e.g. ShortNameWestern?
815 QString KCalendarSystemHebrewPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
816 {
817  if (format == KLocale::NarrowName) {
818  switch (weekDay) {
819  case 1:
820  return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
821  case 2:
822  return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
823  case 3:
824  return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
825  case 4:
826  return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
827  case 5:
828  return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
829  case 6:
830  return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
831  case 7:
832  return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
833  default:
834  return QString();
835  }
836  }
837 
838  if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
839  switch (weekDay) {
840  case 1:
841  return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
842  case 2:
843  return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
844  case 3:
845  return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
846  case 4:
847  return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
848  case 5:
849  return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
850  case 6:
851  return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
852  case 7:
853  return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
854  default: return QString();
855  }
856  }
857 
858  switch (weekDay) {
859  case 1:
860  return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale());
861  case 2:
862  return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
863  case 3:
864  return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
865  case 4:
866  return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
867  case 5:
868  return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale());
869  case 6:
870  return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
871  case 7:
872  return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
873  default:
874  return QString();
875  }
876 }
877 
878 
879 KCalendarSystemHebrew::KCalendarSystemHebrew(const KLocale *locale)
880  : KCalendarSystem(*new KCalendarSystemHebrewPrivate(this), KSharedConfig::Ptr(), locale)
881 {
882  d_ptr->loadConfig(calendarType());
883 }
884 
885 KCalendarSystemHebrew::KCalendarSystemHebrew(const KSharedConfig::Ptr config, const KLocale *locale)
886  : KCalendarSystem(*new KCalendarSystemHebrewPrivate(this), config, locale)
887 {
888  d_ptr->loadConfig(calendarType());
889 }
890 
891 KCalendarSystemHebrew::KCalendarSystemHebrew(KCalendarSystemHebrewPrivate &dd,
892  const KSharedConfig::Ptr config, const KLocale *locale)
893  : KCalendarSystem(dd, config, locale)
894 {
895  d_ptr->loadConfig(calendarType());
896 }
897 
898 KCalendarSystemHebrew::~KCalendarSystemHebrew()
899 {
900 }
901 
902 QString KCalendarSystemHebrew::calendarType() const
903 {
904  return QLatin1String("hebrew");
905 }
906 
907 QDate KCalendarSystemHebrew::epoch() const
908 {
909  // Hebrew 0001-01-01 (Gregorian -3760-09-07, Julian -3761-10-07)
910  return QDate::fromJulianDay(347998);
911 }
912 
913 QDate KCalendarSystemHebrew::earliestValidDate() const
914 {
915  // Current formulas using direct Gregorian <-> Hebrew conversion using Qt
916  // will return invalid results prior to the Gregorian switchover in 1582
917  // Next valid Hebrew year starts 5344-01-01 (Gregorian 1583-09-17)
918  return QDate::fromJulianDay(2299498);
919 }
920 
921 QDate KCalendarSystemHebrew::latestValidDate() const
922 {
923  // Testing shows current formulas only work up to 8119-13-29 (Gregorian 4359-10-07)
924  return QDate::fromJulianDay(3313431);
925 }
926 
927 bool KCalendarSystemHebrew::isValid(int year, int month, int day) const
928 {
929  return KCalendarSystem::isValid(year, month, day);
930 }
931 
932 bool KCalendarSystemHebrew::isValid(const QDate &date) const
933 {
934  return KCalendarSystem::isValid(date);
935 }
936 
937 int KCalendarSystemHebrew::dayOfWeek(const QDate &date) const
938 {
939  class h_date * sd = toHebrew(date);
940  if (sd->hd_dw == 0) {
941  return 7;
942  } else {
943  return (sd->hd_dw);
944  }
945 }
946 
947 bool KCalendarSystemHebrew::isLeapYear(int year) const
948 {
949  return KCalendarSystem::isLeapYear(year);
950 }
951 
952 bool KCalendarSystemHebrew::isLeapYear(const QDate &date) const
953 {
954  return KCalendarSystem::isLeapYear(date);
955 }
956 
957 QString KCalendarSystemHebrew::monthName(int month, int year, MonthNameFormat format) const
958 {
959  return KCalendarSystem::monthName(month, year, format);
960 }
961 
962 QString KCalendarSystemHebrew::monthName(const QDate &date, MonthNameFormat format) const
963 {
964  return KCalendarSystem::monthName(date, format);
965 }
966 
967 QString KCalendarSystemHebrew::weekDayName(int weekDay, WeekDayNameFormat format) const
968 {
969  return KCalendarSystem::weekDayName(weekDay, format);
970 }
971 
972 QString KCalendarSystemHebrew::weekDayName(const QDate &date, WeekDayNameFormat format) const
973 {
974  return KCalendarSystem::weekDayName(date, format);
975 }
976 
977 int KCalendarSystemHebrew::yearStringToInteger(const QString &string, int &readLength) const
978 {
979  int result = KCalendarSystem::yearStringToInteger(string, readLength);
980 
981  // Hebrew has no letter for 0, so 5 and 5000 are written the same
982  // Assume if less than 10 then we are in an exact multiple of 1000
983  if (result < 10) {
984  result = result * 1000;
985  }
986 
987  // Not good just assuming, make configurable
988  if (result < 1000) {
989  result += 5000; // assume we're in the 6th millenium (y6k bug)
990  }
991 
992  return result;
993 }
994 
995 int KCalendarSystemHebrew::weekDayOfPray() const
996 {
997  return 6; // Saturday
998 }
999 
1000 bool KCalendarSystemHebrew::isLunar() const
1001 {
1002  return false;
1003 }
1004 
1005 bool KCalendarSystemHebrew::isLunisolar() const
1006 {
1007  return true;
1008 }
1009 
1010 bool KCalendarSystemHebrew::isSolar() const
1011 {
1012  return false;
1013 }
1014 
1015 bool KCalendarSystemHebrew::isProleptic() const
1016 {
1017  return false;
1018 }
1019 
1020 bool KCalendarSystemHebrew::julianDayToDate(int jd, int &year, int &month, int &day) const
1021 {
1022  class h_date * sd = toHebrew(QDate::fromJulianDay(jd));
1023 
1024  year = sd->hd_year;
1025 
1026  month = sd->hd_mon;
1027  if (isLeapYear(sd->hd_year)) {
1028  if (month == 13 /*AdarI*/) {
1029  month = 6;
1030  } else if (month == 14 /*AdarII*/) {
1031  month = 7;
1032  } else if (month > 6 && month < 13) {
1033  ++month;
1034  }
1035  }
1036 
1037  day = sd->hd_day;
1038 
1039  return true;
1040 }
1041 
1042 bool KCalendarSystemHebrew::dateToJulianDay(int year, int month, int day, int &jd) const
1043 {
1044  class h_date * gd = hebrewToGregorian(year, month, day);
1045 
1046  QDate tempDate(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1);
1047 
1048  jd = tempDate.toJulianDay();
1049 
1050  return true;
1051 }
QDate::daysTo
int daysTo(const QDate &d) const
KLocale::NarrowName
Narrow text format, may not be unique, e.g.
Definition: klocale.h:913
KSharedPtr< KSharedConfig >
KCalendarSystemHebrew::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: kcalendarsystemhebrew.cpp:1020
KSharedConfig
KConfig variant using shared memory.
Definition: ksharedconfig.h:40
DAY
static const int DAY
Definition: kcalendarsystemhebrew.cpp:154
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
KCalendarSystemHebrew::~KCalendarSystemHebrew
virtual ~KCalendarSystemHebrew()
Definition: kcalendarsystemhebrew.cpp:898
KCalendarSystemPrivate::loadDefaultEraList
virtual void loadDefaultEraList()
Definition: kcalendarsystem.cpp:269
QChar
KCalendarSystemPrivate::integerFromString
virtual int integerFromString(const QString &string, int maxLength, int &readLength) const
Definition: kcalendarsystem.cpp:750
KCalendarSystemHebrew::yearStringToInteger
virtual int yearStringToInteger(const QString &sNum, int &iLength) const
Definition: kcalendarsystemhebrew.cpp:977
KCalendarSystemPrivate::monthsInYear
virtual int monthsInYear(int year) const
Definition: kcalendarsystem.cpp:277
KCalendarSystemHebrew::weekDayOfPray
virtual int weekDayOfPray() const
Definition: kcalendarsystemhebrew.cpp:995
short_kislev
static int short_kislev(int year)
Definition: kcalendarsystemhebrew.cpp:212
KCalendarSystemHebrew::earliestValidDate
virtual QDate earliestValidDate() const
Returns the earliest date valid in this calendar system implementation.
Definition: kcalendarsystemhebrew.cpp:913
KCalendarSystemHebrew::KCalendarSystemHebrew
KCalendarSystemHebrew(const KLocale *locale=0)
Definition: kcalendarsystemhebrew.cpp:879
KCalendarSystem::MonthNameFormat
MonthNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:55
KLocale::HebrewCalendar
Hebrew Calendar, aka Jewish Calendar.
Definition: klocale.h:789
QDate::month
int month() const
klocale.h
KCalendarSystemPrivate::maxMonthsInYear
virtual int maxMonthsInYear() const
Definition: kcalendarsystem.cpp:362
WEEK
static const int WEEK
Definition: kcalendarsystemhebrew.cpp:155
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
long_cheshvan
static int long_cheshvan(int year)
Definition: kcalendarsystemhebrew.cpp:194
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:139
KCalendarSystemPrivate::daysInWeek
virtual int daysInWeek() const
Definition: kcalendarsystem.cpp:315
KCalendarSystemHebrew::isValid
virtual bool isValid(int year, int month, int day) const
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystemhebrew.cpp:927
M
#define M(h, p)
Definition: kcalendarsystemhebrew.cpp:156
KCalendarSystemHebrew::isLunisolar
virtual bool isLunisolar() const
Returns whether the calendar is lunisolar based.
Definition: kcalendarsystemhebrew.cpp:1005
KCalendarSystemHebrew::isLunar
virtual bool isLunar() const
Returns whether the calendar is lunar based.
Definition: kcalendarsystemhebrew.cpp:1000
QString::insert
QString & insert(int position, QChar ch)
KLocale::CalendarSystem
CalendarSystem
Definition: klocale.h:780
KCalendarSystemHebrew::epoch
virtual QDate epoch() const
Returns a QDate holding the epoch of the calendar system.
Definition: kcalendarsystemhebrew.cpp:907
QDate::setYMD
bool setYMD(int y, int m, int d)
QDate::toJulianDay
int toJulianDay() const
KCalendarSystemHebrew::dayOfWeek
virtual int dayOfWeek(const QDate &date) const
Returns the weekday number for the given date.
Definition: kcalendarsystemhebrew.cpp:937
QDate::day
int day() const
KCalendarSystemHebrew::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const
Gets specific calendar type week day name.
Definition: kcalendarsystemhebrew.cpp:967
KLocale::LongName
Long text format, e.g.
Definition: klocale.h:915
KCalendarSystemHebrew::calendarType
virtual QString calendarType() const
Definition: kcalendarsystemhebrew.cpp:902
KCalendarSystemHebrew::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: kcalendarsystemhebrew.cpp:957
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
QDate::year
int year() const
hebrewToGregorian
static class h_date * hebrewToGregorian(int y, int m, int d)
Definition: kcalendarsystemhebrew.cpp:49
QString
toHebrew
static class h_date * toHebrew(const QDate &date)
Definition: kcalendarsystemhebrew.cpp:227
KCalendarSystemPrivate::stringFromInteger
virtual QString stringFromInteger(int number, int padWidth=0, QChar padChar=QLatin1Char('0')) const
Definition: kcalendarsystem.cpp:781
KCalendarSystemHebrew
Definition: kcalendarsystemhebrew_p.h:41
KCalendarSystemPrivate::hasLeapMonths
virtual bool hasLeapMonths() const
Definition: kcalendarsystem.cpp:341
QChar::unicode
ushort unicode() const
kcalendarsystemprivate_p.h
KCalendarSystem::WeekDayNameFormat
WeekDayNameFormat
Format for returned month / day name.
Definition: kcalendarsystem.h:66
KCalendarSystemHebrew::isLeapYear
virtual bool isLeapYear(int year) const
Returns whether a given year is a leap year.
Definition: kcalendarsystemhebrew.cpp:947
KCalendarSystemHebrew::latestValidDate
virtual QDate latestValidDate() const
Returns the latest date valid in this calendar system implementation.
Definition: kcalendarsystemhebrew.cpp:921
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
gregorianToHebrew
static class h_date * gregorianToHebrew(int y, int m, int d)
Definition: kcalendarsystemhebrew.cpp:100
KCalendarSystemHebrew::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: kcalendarsystemhebrew.cpp:1042
QLatin1Char
KCalendarSystemPrivate::maxDaysInWeek
virtual int maxDaysInWeek() const
Definition: kcalendarsystem.cpp:355
KCalendarSystem::yearStringToInteger
virtual int yearStringToInteger(const QString &sNum, int &iLength) const
Definition: kcalendarsystem.cpp:2018
KLocale::ShortName
Short text format, e.g.
Definition: klocale.h:914
MONTH
#define MONTH
Definition: kcalendarsystemhebrew.cpp:157
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KCalendarSystemPrivate::hasYearZero
virtual bool hasYearZero() const
Definition: kcalendarsystem.cpp:348
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
ki18nc
KLocalizedString ki18nc(const char *ctxt, const char *msg)
Creates localized string from a given message, with added context.
Definition: klocalizedstring.cpp:929
KCalendarSystemHebrew::isProleptic
virtual bool isProleptic() const
Returns whether the calendar system is proleptic, i.e.
Definition: kcalendarsystemhebrew.cpp:1015
KCalendarSystemPrivate::calendarSystem
virtual KLocale::CalendarSystem calendarSystem() const
Definition: kcalendarsystem.cpp:261
QString::length
int length() const
KCalendarSystemPrivate::isLeapYear
virtual bool isLeapYear(int year) const
Definition: kcalendarsystem.cpp:322
hebrewDaysElapsed
static int hebrewDaysElapsed(int y)
Definition: kcalendarsystemhebrew.cpp:163
KLocale::DigitSet
DigitSet
Definition: klocale.h:309
QDate::fromJulianDay
QDate fromJulianDay(int jd)
HOUR
static const int HOUR
Definition: kcalendarsystemhebrew.cpp:153
kcalendarsystemhebrew_p.h
KCalendarSystemHebrew::isSolar
virtual bool isSolar() const
Returns whether the calendar is solar based.
Definition: kcalendarsystemhebrew.cpp:1010
KCalendarSystem::weekDayName
virtual QString weekDayName(int weekDay, WeekDayNameFormat format=LongDayName) const =0
Gets specific calendar type week day name.
Definition: kcalendarsystem.cpp:1881
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