[haiku-commits] Re: r40125 - in haiku/trunk: headers/os/support headers/private/shared src/kits/support

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 07 Jan 2011 20:21:35 +0100

On 2011-01-05 at 19:00:32 [+0100], korli@xxxxxxxxxxxxxxxx wrote:
> +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);
> +};

Given that there are probably hundreds of holidays, a class for each one 
seems overkill. Also, holidays are potentially calendar and locale specific. 
So besides that I'm not sure whether the calender handling BDate does ATM is 
sufficient (respectively whether it belongs there at all), I think a generic 
method to get holidays is a much better approach. E.g. in the (not yet 
existing) B*Calender classes:

  static BDate GetHoliday(int32 year, const char* holidayName,
      BLocale* locale = NULL);

or

  static BDate GetHoliday(int32 year, enum BHoliday holiday,
      BLocale* locale = NULL);

Alternatively, if B*Calendar classes shall not be introduced, in BLocale:

  static BDate GetHoliday(int32 year, const char* holidayName,
      enum BCalendar calendar = B_GREGORIAN_CALENDAR);

or "enum BHoliday holiday" instead of the string parameter.

CU, Ingo

Other related posts: