LibreOffice Module i18npool (master)  1
calendar_hijri.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_I18NPOOL_INC_CALENDAR_HIJRI_HXX
20 #define INCLUDED_I18NPOOL_INC_CALENDAR_HIJRI_HXX
21 
22 #include "calendar_gregorian.hxx"
23 
24 
25 
26 
27 namespace i18npool {
28 
29 class Calendar_hijri final : public Calendar_gregorian
30 {
31 public:
32 
33  // Constructors
35 
36 private:
37  void mapToGregorian() override;
38  void mapFromGregorian() override;
39 
40  // radians per degree (pi/180)
41  static const double RadPerDeg;
42 
43  // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec
44  static const double SynPeriod;
45 
46  static const double SynMonth; // Solar days in a year/SynPeriod
47 
48  // Julian day on Jan 1, 1900
49  static const double jd1900;
50 
51  // Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900
52  static const sal_Int32 SynRef;
53  static const sal_Int32 GregRef;
54 
55  // Local time (Saudi Arabia)
56  static const double SA_TimeZone; // Time Zone
57 
58  // Period between 1.30pm - 6:30pm
59  static const double EveningPeriod;
60 
61  // "Leap" years
62  static const sal_Int32 LeapYear[];
63 
64 private:
65  static double NewMoon(sal_Int32 n);
66  static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
67  static void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
68  static void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear);
69  static sal_Int32 getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year);
70 };
71 
72 }
73 
74 #endif
75 
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static sal_Int32 getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year)
sal_Int32 month
static const sal_Int32 GregRef
static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year)
static const double SynMonth
static double NewMoon(sal_Int32 n)
void mapFromGregorian() override
static const double SA_TimeZone
static const double jd1900
static const double EveningPeriod
static void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year)
Constant values shared between i18npool and, for example, the number formatter.
static const sal_Int32 LeapYear[]
static void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear)
sal_Int32 day
static const sal_Int32 SynRef
static const double SynPeriod
void mapToGregorian() override
sal_Int32 year
static const double RadPerDeg