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

KDECore

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

Skip menu "kdelibs-4.14.38 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
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