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

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
  • plugins
  • hebrew
converter.h
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net>
5  Copyright (C) 2007 Loïc Corbasson <loic.corbasson@gmail.com>
6  Calendar routines from Hebrew Calendar by Frank Yellin.
7  Copyright (C) 1994-2006 Danny Sadinoff <danny@sadinoff.com>.
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 #ifndef KORG_PLUGINS_HEBREW_CONVERTER_H
24 #define KORG_PLUGINS_HEBREW_CONVERTER_H
25 
26 struct DateResult
27 {
28  int year;
29  int month;
30  int day;
31  int day_of_week;
32 
33  int hebrew_month_length, secular_month_length;
34  bool hebrew_leap_year_p, secular_leap_year_p;
35  int kvia;
36  int hebrew_day_number;
37 };
38 
45 class HebrewDate
46 {
47  public:
48  explicit HebrewDate( struct DateResult );
49  ~HebrewDate();
50 
51  static HebrewDate fromSecular( int year, int month, int day );
52  static HebrewDate fromHebrew( int year, int month, int day );
53 
54  int year() const;
55  int month() const;
56  int day() const;
57  int dayOfWeek() const;
58 
59  int hebrewMonthLength() const;
60  int secularMonthLength() const;
61  bool isOnHebrewLeapYear() const;
62  bool isOnSecularLeapYear() const;
63  int kvia() const;
64  int hebrewDayNumber() const;
65 
66  private:
67  int mYear, mMonth, mDay, mDayOfWeek;
68  int mHebrewMonthLength, mSecularMonthLength;
69  bool mOnHebrewLeapYear, mOnSecularLeapYear;
70  int mKvia, mHebrewDayNumber;
71 };
72 
85 class Converter
86 {
87  friend class HebrewDate;
88 
89  public:
90  enum HebrewMonths {
91  Nissan = 1,
92  Iyar,
93  Sivan,
94  Tamuz,
95  Ab,
96  Elul,
97  Tishrei,
98  Cheshvan,
99  Kislev,
100  Tevet,
101  Shvat,
102  Adar,
103  AdarII,
104  AdarI = 12
105  };
106 
107  enum SecularMonths {
108  January = 1,
109  February,
110  March,
111  April,
112  May,
113  June,
114  July,
115  August,
116  September,
117  October,
118  November,
119  December
120  };
121 
122  private:
123  static bool hebrew_leap_year_p( int year );
124  static bool gregorian_leap_year_p( int year );
125 
126  static long absolute_from_gregorian( int year, int month, int day );
127  static long absolute_from_hebrew( int year, int month, int day );
128 
129  static void gregorian_from_absolute( long date, int *yearp,
130  int *monthp, int *dayp );
131  static void hebrew_from_absolute( long date, int *yearp, int *monthp,
132  int *dayp );
133 
134  static int hebrew_months_in_year( int year );
135  static int hebrew_month_length( int year, int month );
136  static int secular_month_length( int year, int month );
137 
138  static long hebrew_elapsed_days( int year );
139  static long hebrew_elapsed_days2( int year );
140  static int hebrew_year_length( int year );
141 
142  static void finish_up( long absolute, int hyear, int hmonth,
143  int syear, int smonth,
144  struct DateResult *result );
145 
146  static void secularToHebrewConversion( int year, int month, int day,
147  struct DateResult *result );
148  static void hebrewToSecularConversion( int year, int month, int day,
149  struct DateResult *result );
150 };
151 
152 #endif
DateResult::kvia
int kvia
Definition: converter.h:35
Converter::AdarI
Definition: converter.h:104
DateResult::hebrew_day_number
int hebrew_day_number
Definition: converter.h:36
DateResult::hebrew_leap_year_p
bool hebrew_leap_year_p
Definition: converter.h:34
Converter::March
Definition: converter.h:110
HebrewDate::hebrewMonthLength
int hebrewMonthLength() const
Definition: converter.cpp:74
Converter::Kislev
Definition: converter.h:99
Converter::Sivan
Definition: converter.h:93
HebrewDate::fromHebrew
static HebrewDate fromHebrew(int year, int month, int day)
Definition: converter.cpp:47
Converter::July
Definition: converter.h:114
Converter::Cheshvan
Definition: converter.h:98
HebrewDate::fromSecular
static HebrewDate fromSecular(int year, int month, int day)
Definition: converter.cpp:40
DateResult::day_of_week
int day_of_week
Definition: converter.h:31
Converter::February
Definition: converter.h:109
Converter::Iyar
Definition: converter.h:92
DateResult::hebrew_month_length
int hebrew_month_length
Definition: converter.h:33
HebrewDate::isOnSecularLeapYear
bool isOnSecularLeapYear() const
Definition: converter.cpp:89
HebrewDate::month
int month() const
Definition: converter.cpp:59
Converter::Elul
Definition: converter.h:96
HebrewDate
This class converts dates between the Hebrew and Gregorian (secular) calendars.
Definition: converter.h:45
DateResult::day
int day
Definition: converter.h:30
DateResult::month
int month
Definition: converter.h:29
HebrewDate::HebrewDate
HebrewDate(struct DateResult)
Definition: converter.cpp:25
Converter::August
Definition: converter.h:115
HebrewDate::year
int year() const
Definition: converter.cpp:54
DateResult::year
int year
Definition: converter.h:28
Converter::Ab
Definition: converter.h:95
Converter::Tamuz
Definition: converter.h:94
HebrewDate::hebrewDayNumber
int hebrewDayNumber() const
Definition: converter.cpp:99
HebrewDate::isOnHebrewLeapYear
bool isOnHebrewLeapYear() const
Definition: converter.cpp:84
Converter::June
Definition: converter.h:113
DateResult::secular_month_length
int secular_month_length
Definition: converter.h:33
Converter::HebrewMonths
HebrewMonths
Definition: converter.h:90
Converter::May
Definition: converter.h:112
HebrewDate::~HebrewDate
~HebrewDate()
Definition: converter.cpp:36
Converter::Tishrei
Definition: converter.h:97
Converter::SecularMonths
SecularMonths
Definition: converter.h:107
Converter::December
Definition: converter.h:119
HebrewDate::day
int day() const
Definition: converter.cpp:64
Converter::Tevet
Definition: converter.h:100
Converter::Shvat
Definition: converter.h:101
HebrewDate::kvia
int kvia() const
Definition: converter.cpp:94
Converter::January
Definition: converter.h:108
Converter::AdarII
Definition: converter.h:103
Converter::Nissan
Definition: converter.h:91
HebrewDate::dayOfWeek
int dayOfWeek() const
Definition: converter.cpp:69
DateResult
Definition: converter.h:26
DateResult::secular_leap_year_p
bool secular_leap_year_p
Definition: converter.h:34
Converter
This class is used internally to convert dates between the Hebrew and Gregorian (secular) calendars...
Definition: converter.h:85
Converter::October
Definition: converter.h:117
Converter::April
Definition: converter.h:111
Converter::Adar
Definition: converter.h:102
Converter::September
Definition: converter.h:116
HebrewDate::secularMonthLength
int secularMonthLength() const
Definition: converter.cpp:79
Converter::November
Definition: converter.h:118
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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