BHoliday: Remove, unused.
There isn't much use for a class that can only compute the dates of two minor and one major holiday. Probably in the future the Locale Kit could be extended to expose ICU holiday APIs, but seeing as that is a less-used functionality, this can just be removed altogether for now at least. Change-Id: I18be044be7d5c6896295ed85d294abeea90b8bb0 Reviewed-on: https://review.haiku-os.org/c/1037 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Stephan Aßmus
parent
41ddfe2a44
commit
a5e9253fe0
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _HOLIDAY_H_
|
||||
#define _HOLIDAY_H_
|
||||
|
||||
|
||||
#include <DateTime.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class BHoliday {
|
||||
public:
|
||||
virtual ~BHoliday() { };
|
||||
};
|
||||
|
||||
|
||||
class BEasterHoliday : public BHoliday {
|
||||
public:
|
||||
static BDate EasterSunday(int32 year);
|
||||
static BDate AscensionDay(int32 year);
|
||||
static BDate PentecostDay(int32 year);
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
Returns the date for easter sunday for the \c year.
|
||||
*/
|
||||
/*static*/ BDate
|
||||
BEasterHoliday::EasterSunday(int32 year)
|
||||
{
|
||||
// http://bloggingabout.net/blogs/jschreuder/archive/2005/06/24/7019.aspx
|
||||
int32 gold = year % 19;
|
||||
int32 century = year / 100;
|
||||
int32 h = (century - (int32)(century / 4)
|
||||
- (int32)((century * 8 + 13) / 25) + 19 * gold + 15) % 30;
|
||||
int32 i = h - (int32)(h / 28) * (1 - (int32)(h / 28)
|
||||
* (int32)(29 / (h + 1)) * (int32)((21 - gold) / 11));
|
||||
|
||||
int32 day = i - ((year + (int32)(year / 4) + i + 2 - century
|
||||
+ (int32)(century / 4)) % 7) + 28;
|
||||
BDate date;
|
||||
if (day > 31)
|
||||
date.SetDate(year, 4, day - 31);
|
||||
else
|
||||
date.SetDate(year, 3, day);
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the date for ascension day for the \c year.
|
||||
*/
|
||||
/*static*/ BDate
|
||||
BEasterHoliday::AscensionDay(int32 year)
|
||||
{
|
||||
BDate date = EasterSunday(year);
|
||||
date.AddDays(39);
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the date for pentecost day for the \c year.
|
||||
*/
|
||||
/*static*/ BDate
|
||||
BEasterHoliday::PentecostDay(int32 year)
|
||||
{
|
||||
BDate date = EasterSunday(year);
|
||||
date.AddDays(49);
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
using BPrivate::BHoliday;
|
||||
using BPrivate::BEasterHoliday;
|
||||
|
||||
|
||||
#endif // _HOLIDAY_H_
|
||||
Reference in New Issue
Block a user