• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
kcalendarsystemworld.h
1 #ifndef KCALENDARSYSTEMWORLD_H
2 #define KCALENDARSYSTEMWORLD_H
3 
4 /*
5  Copyright (C) 2023 by Roman Savochenko, <roman@oscada.org>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; version 2 of the License.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the
18  Free Software Foundation, Inc.,
19  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #include <tqdatetime.h>
23 #include <tqstring.h>
24 
25 #include "kcalendarsystem.h"
26 
30 class TDECORE_EXPORT KCalendarSystemWorld : public KCalendarSystem
31 {
32  public:
33  KCalendarSystemWorld( const TDELocale* locale = 0 ) : KCalendarSystem(locale) { }
34 
35  int year( const TQDate& date ) const;
36  int month( const TQDate& date ) const;
37  int day( const TQDate& date ) const { return date.day(); }
38  int dayOfWeek( const TQDate& date ) const { return date.dayOfWeek(); }
39  int dayOfYear( const TQDate& date ) const { return date.dayOfYear(); }
40 
41  bool setYMD( TQDate& date, int y, int m, int d ) const;
42 
43  TQDate addYears( const TQDate& date, int nyears ) const { return date.addYears(nyears); }
44  TQDate addMonths( const TQDate& date, int nmonths) const { return date.addMonths(nmonths); }
45  TQDate addDays( const TQDate& date, int ndays ) const { return date.addDays(ndays); }
46 
47  int monthsInYear( const TQDate& date ) const{ return 12; }
48 
49  int daysInYear( const TQDate& date ) const { return date.daysInYear(); }
50  int daysInMonth( const TQDate& date ) const { return date.daysInMonth(); }
51  int weeksInYear( int year ) const { return 52; }
52  int weekNumber( const TQDate& date, int* yearNum = 0 ) const { return date.weekNumber(yearNum); }
53 
54  TQString monthName( const TQDate& date, bool shortName = false ) const { return monthName(month(date), 0, shortName); }
55  TQString monthName( int month, int year, bool shortName = false ) const;
56  TQString monthNamePossessive( const TQDate& date, bool shortName = false ) const { return monthName(date, shortName); }
57  TQString monthNamePossessive( int month, int year, bool shortName = false ) const { return monthName(month, year, shortName); }
58  TQString weekDayName( const TQDate& date, bool shortName = false ) const { return weekDayName(dayOfWeek(date), shortName); }
59  TQString weekDayName( int weekDay, bool shortName = false ) const;
60 
61  int minValidYear( ) const { return 0; }
62  int maxValidYear( ) const { return 10000; }
63  int weekDayOfPray( ) const { return 7; } // sunday
64 
65  TQString calendarName( ) const { return TQString::fromLatin1("world"); }
66 
67  bool isLunar( ) const { return false; }
68  bool isLunisolar( ) const { return false; }
69  bool isSolar( ) const { return true; }
70 };
71 
72 #endif
KCalendarSystem::monthName
virtual TQString monthName(int month, int year, bool shortName=false) const =0
Gets specific calendar type month name for a given month number If an invalid month is specified...
KCalendarSystemWorld::weeksInYear
int weeksInYear(int year) const
Gets the number of weeks in a specified year.
Definition: kcalendarsystemworld.h:51
KCalendarSystemWorld::daysInYear
int daysInYear(const TQDate &date) const
Gets the number of days in date whose years specified.
Definition: kcalendarsystemworld.h:49
KCalendarSystemWorld::addMonths
TQDate addMonths(const TQDate &date, int nmonths) const
Returns a TQDate object containing a date nmonths later.
Definition: kcalendarsystemworld.h:44
KCalendarSystemWorld::isLunar
bool isLunar() const
Gets if the calendar is lunar based.
Definition: kcalendarsystemworld.h:67
KCalendarSystem::year
virtual int year(const TQDate &date) const =0
Gets specific calendar type year for a given gregorian date.
KCalendarSystemWorld::addDays
TQDate addDays(const TQDate &date, int ndays) const
Returns a TQDate object containing a date ndays later.
Definition: kcalendarsystemworld.h:45
KCalendarSystem::dayOfWeek
virtual int dayOfWeek(const TQDate &date) const =0
Gets specific calendar type number of day of week number for a given date.
KCalendarSystemWorld::daysInMonth
int daysInMonth(const TQDate &date) const
Gets specific calendar type number of days in month for a given date.
Definition: kcalendarsystemworld.h:50
KCalendarSystemWorld::weekNumber
int weekNumber(const TQDate &date, int *yearNum=0) const
Gets specific calendar type week number for a given date.
Definition: kcalendarsystemworld.h:52
KCalendarSystemWorld::isSolar
bool isSolar() const
Gets if the calendar is solar based.
Definition: kcalendarsystemworld.h:69
KCalendarSystemWorld::weekDayName
TQString weekDayName(const TQDate &date, bool shortName=false) const
Gets specific calendar type week day name.
Definition: kcalendarsystemworld.h:58
KCalendarSystem::KCalendarSystem
KCalendarSystem(const TDELocale *locale=0)
Constructor of abstract calendar class.
Definition: kcalendarsystem.cpp:36
KCalendarSystemWorld::monthsInYear
int monthsInYear(const TQDate &date) const
Gets specific calendar type number of month for a given year.
Definition: kcalendarsystemworld.h:47
KCalendarSystem
CalendarSystem abstract class, default derived kde gregorian class and factory class.
Definition: kcalendarsystem.h:42
KCalendarSystemWorld::monthName
TQString monthName(const TQDate &date, bool shortName=false) const
Gets specific calendar type month name for a given gregorian date.
Definition: kcalendarsystemworld.h:54
KCalendarSystemWorld::weekDayOfPray
int weekDayOfPray() const
Gets the day of the week traditionaly associated with pray.
Definition: kcalendarsystemworld.h:63
KCalendarSystemWorld::isLunisolar
bool isLunisolar() const
Gets if the calendar is lunisolar based.
Definition: kcalendarsystemworld.h:68
TDELocale
TDELocale provides support for country specific stuff like the national language. ...
Definition: tdelocale.h:123
KCalendarSystemWorld::addYears
TQDate addYears(const TQDate &date, int nyears) const
Returns a TQDate object containing a date nyears later.
Definition: kcalendarsystemworld.h:43
KCalendarSystemWorld::minValidYear
int minValidYear() const
Gets the first year value supported by specific calendar type algorithms.
Definition: kcalendarsystemworld.h:61
KCalendarSystem::month
virtual int month(const TQDate &date) const =0
Gets specific calendar type month for a given gregorian date.
KCalendarSystem::weekDayName
virtual TQString weekDayName(int weekDay, bool shortName=false) const =0
Gets specific calendar type week day name If an invalid week day is specified, TQString::null is retu...
Definition: kcalendarsystem.cpp:119
KCalendarSystemWorld
World founding COLODAR type implementation.
Definition: kcalendarsystemworld.h:30
KCalendarSystemWorld::dayOfWeek
int dayOfWeek(const TQDate &date) const
Gets specific calendar type number of day of week number for a given date.
Definition: kcalendarsystemworld.h:38
KCalendarSystemWorld::maxValidYear
int maxValidYear() const
Gets the maximum year value supported by specific calendar type algorithms (TQDate, 8000)
Definition: kcalendarsystemworld.h:62
KCalendarSystemWorld::monthNamePossessive
TQString monthNamePossessive(const TQDate &date, bool shortName=false) const
Returns a string containing the possessive form of the month name.
Definition: kcalendarsystemworld.h:56
KCalendarSystemWorld::calendarName
TQString calendarName() const
Gets the string representing the calendar.
Definition: kcalendarsystemworld.h:65
KCalendarSystemWorld::monthNamePossessive
TQString monthNamePossessive(int month, int year, bool shortName=false) const
Returns a string containing the possessive form of the month name.
Definition: kcalendarsystemworld.h:57
KCalendarSystemWorld::dayOfYear
int dayOfYear(const TQDate &date) const
Gets specific calendar type day number of year for a given date.
Definition: kcalendarsystemworld.h:39
KCalendarSystemWorld::day
int day(const TQDate &date) const
Gets specific calendar type day number of month for a given date.
Definition: kcalendarsystemworld.h:37
KCalendarSystem::setYMD
virtual bool setYMD(TQDate &date, int y, int m, int d) const =0
Changes the date's year, month and day.

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.