X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/i18n/gregoimp.h diff --git a/icuSources/i18n/gregoimp.h b/icuSources/i18n/gregoimp.h index d8ab8de4..b3074167 100644 --- a/icuSources/i18n/gregoimp.h +++ b/icuSources/i18n/gregoimp.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** - * Copyright (c) 2003-2007, International Business Machines + * Copyright (c) 2003-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -22,9 +24,10 @@ U_NAMESPACE_BEGIN /** * A utility class providing mathematical functions used by time zone - * and calendar code. Do not instantiate. + * and calendar code. Do not instantiate. Formerly just named 'Math'. + * @internal */ -class Math { +class ClockMath { public: /** * Divide two integers, returning the floor of the quotient. @@ -250,7 +253,7 @@ class Grego { static const int8_t MONTH_LENGTH[24]; }; -inline double Math::floorDivide(double numerator, double denominator) { +inline double ClockMath::floorDivide(double numerator, double denominator) { return uprv_floor(numerator / denominator); } @@ -281,80 +284,15 @@ inline double Grego::julianDayToMillis(int32_t julian) } inline int32_t Grego::millisToJulianDay(double millis) { - return (int32_t) (kEpochStartAsJulianDay + Math::floorDivide(millis, (double)kOneDay)); + return (int32_t) (kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay)); } inline int32_t Grego::gregorianShift(int32_t eyear) { int32_t y = eyear-1; - int32_t gregShift = Math::floorDivide(y, 400) - Math::floorDivide(y, 100) + 2; + int32_t gregShift = ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2; return gregShift; } -/** - * This utility class provides convenient access to the data needed for a calendar. - * @internal ICU 3.0 - */ -class CalendarData : public UMemory { -public: - /** - * Construct a CalendarData from the given locale. - * @param loc locale to use. The 'calendar' keyword will be ignored. - * @param type calendar type. NULL indicates the gregorian calendar. - * No default lookup is done. - * @param status error code - */ - CalendarData(const Locale& loc, const char *type, UErrorCode& status); - - /** - * Load data for calendar. Note, this object owns the resources, do NOT call ures_close()! - * The ResourceBundle C++ API should NOT be used because it is too slow for a low level API. - * - * @param key Resource key to data - * @param status Error Status - * @internal - */ - UResourceBundle* getByKey(const char *key, UErrorCode& status); - - /** - * Load data for calendar. Note, this object owns the resources, do NOT call ures_close()! - * There is an implicit key of 'format' - * data is located in: "calendar/key/format/subKey" - * for example, calendar/dayNames/format/abbreviated - * The ResourceBundle C++ API should NOT be used because it is too slow for a low level API. - * - * @param key Resource key to data - * @param subKey Resource key to data - * @param status Error Status - * @internal - */ - UResourceBundle* getByKey2(const char *key, const char *subKey, UErrorCode& status); - - /** - * Load data for calendar. Note, this object owns the resources, do NOT call ures_close()! - * data is located in: "calendar/key/contextKey/subKey" - * for example, calendar/dayNames/standalone/narrow - * The ResourceBundle C++ API should NOT be used because it is too slow for a low level API. - * - * @param key Resource key to data - * @param contextKey Resource key to data - * @param subKey Resource key to data - * @param status Error Status - * @internal - */ - UResourceBundle* getByKey3(const char *key, const char *contextKey, const char *subKey, UErrorCode& status); - - ~CalendarData(); - -private: - void initData(const char *locale, const char *type, UErrorCode& status); - - UResourceBundle *fFillin; - UResourceBundle *fOtherFillin; - UResourceBundle *fBundle; - UResourceBundle *fFallback; - CalendarData(); // Not implemented. -}; - U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING