2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FLcl_IcuCalendarImpl.cpp
19 * @brief This is the implementation file for _IcuCalendarImpl class.
22 #include <unique_ptr.h>
23 #include <unicode/errorcode.h>
24 #include <unicode/simpletz.h>
25 #include <unicode/calendar.h>
26 #include <unicode/gregocal.h>
28 #include <FLclLocale.h>
29 #include <FLclTimeZone.h>
30 #include <FLclCalendar.h>
32 #include <FBase_StringConverter.h>
33 #include <FBaseSysLog.h>
35 #include "FLcl_LocaleData.h"
36 #include "FLcl_IcuCalendarImpl.h"
37 #include "FLcl_TimeZoneImpl.h"
40 typedef U_ICU_NAMESPACE::ErrorCode IcuErrorCode;
41 typedef U_ICU_NAMESPACE::Locale IcuLocale;
42 typedef U_ICU_NAMESPACE::Calendar IcuCalendar;
43 typedef U_ICU_NAMESPACE::GregorianCalendar IcuGregorianCalendar;
44 typedef U_ICU_NAMESPACE::TimeZone IcuTimeZone;
45 typedef U_ICU_NAMESPACE::SimpleTimeZone IcuSimpleTimeZone;
47 using namespace Tizen::Base;
49 static const long long _EPOCH_OFFSET_IN_MILLISEC = 62135596800000LL;
50 static const int _GREGORIAN_DEFAULT_YEAR = 1970;
52 namespace Tizen { namespace Locales
55 _IcuCalendarImpl::_IcuCalendarImpl()
56 : __pIcuCalendar(null)
57 , __isEraFieldOverFlowed(false)
61 _IcuCalendarImpl::~_IcuCalendarImpl()
63 delete __pIcuCalendar;
64 __pIcuCalendar = null;
68 _IcuCalendarImpl::Construct(const TimeZone& timeZone, const Locale& locale, int calendarType)
70 // Object is not allowed to construct twice
71 SysAssertf(__pIcuCalendar == null,
72 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
74 IcuLocale icuLocale = GetIcuLocale(locale, calendarType);
75 result r = GetLastResult();
78 const _TimeZoneImpl* pTimeZoneImpl = _TimeZoneImpl::GetTimeZoneImpl(timeZone);
82 __pIcuCalendar = IcuCalendar::createInstance(pTimeZoneImpl->GetIcuTimeZone()->clone(), icuLocale, err);
83 r = GetOspException(err);
90 _IcuCalendarImpl::CloneN(void)
92 std::unique_ptr< _IcuCalendarImpl > pIcuCalendar(new (std::nothrow) _IcuCalendarImpl);
93 SysTryReturn(NID_LCL, pIcuCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
95 if (__pIcuCalendar != null)
97 pIcuCalendar->__pIcuCalendar = __pIcuCalendar->clone();
98 if (pIcuCalendar->__pIcuCalendar != null)
100 pIcuCalendar->__isEraFieldOverFlowed = __isEraFieldOverFlowed;
104 return pIcuCalendar.release();
108 _IcuCalendarImpl::AddTimeField(int field, int amount)
110 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
112 // Uncomment these lines if OSP values are set to be in minutes
113 // if (field == TIME_FIELD_ZONE_OFFSET || field == TIME_FIELD_DST_OFFSET)
115 // amount *= Calendar::ONE_MINUTE_IN_MILLISEC;
119 __pIcuCalendar->add(static_cast< UCalendarDateFields >(GetIcuTimeField(field)), amount, err);
121 return GetOspException(err);
125 _IcuCalendarImpl::After(const _IcuCalendarImpl& otherInstance, bool& after)
127 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
128 SysTryReturnResult(NID_LCL, otherInstance.__pIcuCalendar, E_INVALID_ARG, "otherInstance is not constructed");
130 result r = ValidateFieldsForOverFlow();
131 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s] Fields values are not valid", GetErrorMessage(r));
133 r = otherInstance.ValidateFieldsForOverFlow();
134 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s] otherInstance's Fields values are not valid", GetErrorMessage(r));
137 after = __pIcuCalendar->after(*(otherInstance.__pIcuCalendar), err);
138 return GetOspException(err);
142 _IcuCalendarImpl::Before(const _IcuCalendarImpl& otherInstance, bool& before)
144 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
145 SysTryReturnResult(NID_LCL, otherInstance.__pIcuCalendar, E_INVALID_ARG, "otherInstance is not constructed");
147 result r = ValidateFieldsForOverFlow();
148 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s] Fields values are not valid", GetErrorMessage(r));
150 r = otherInstance.ValidateFieldsForOverFlow();
151 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s] otherInstance's Fields values are not valid", GetErrorMessage(r));
154 before = __pIcuCalendar->before(*(otherInstance.__pIcuCalendar), err);
155 return GetOspException(err);
159 _IcuCalendarImpl::Clear(void)
161 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
163 __pIcuCalendar->clear();
168 _IcuCalendarImpl::Clear(int field)
170 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
172 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
173 SysTryReturnResult(NID_LCL, icuTimeField != UCAL_FIELD_COUNT,
174 E_INVALID_ARG, "Invalid argument is used. Input field value is not supported");
176 // Hack to reset year field to 1970 while clearing TIME_FIELD_YEAR in GregorianCalendar
177 if (icuTimeField == UCAL_YEAR)
179 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
183 pCal->set(UCAL_YEAR, _GREGORIAN_DEFAULT_YEAR);
188 __pIcuCalendar->clear(icuTimeField);
193 _IcuCalendarImpl::Equals(const _IcuCalendarImpl& otherInstance)
195 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
196 if (otherInstance.__pIcuCalendar != null)
198 return *__pIcuCalendar == *otherInstance.__pIcuCalendar;
204 _IcuCalendarImpl::GetActualMaxTimeField(int field) const
206 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
208 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
209 if (icuTimeField != UCAL_FIELD_COUNT)
212 int value = __pIcuCalendar->getActualMaximum(icuTimeField, err);
215 SetLastResult(E_SUCCESS);
216 return ConvertToOspTimeFieldValue(field, value);
220 SetLastResult(E_INVALID_ARG);
225 _IcuCalendarImpl::GetActualMinTimeField(int field) const
227 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
229 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
230 if (icuTimeField != UCAL_FIELD_COUNT)
233 int value = __pIcuCalendar->getActualMinimum(icuTimeField, err);
236 SetLastResult(E_SUCCESS);
237 return ConvertToOspTimeFieldValue(field, value);
239 SetLastResult(E_SYSTEM);
242 SetLastResult(E_INVALID_ARG);
247 _IcuCalendarImpl::GetFirstDayOfWeek(void) const
249 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
252 int value = __pIcuCalendar->getFirstDayOfWeek(err); // ICU DAY of week and OSP day of week are similar
262 _IcuCalendarImpl::GetGreatestMinTimeField(int field) const
264 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
266 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
267 if (icuTimeField != UCAL_FIELD_COUNT)
269 SetLastResult(E_SUCCESS);
270 int value = __pIcuCalendar->getGreatestMinimum(icuTimeField);
271 return ConvertToOspTimeFieldValue(field, value);
274 SetLastResult(E_INVALID_ARG);
279 _IcuCalendarImpl::GetHashCode(void) const
281 return (int) E_UNSUPPORTED_OPERATION;
285 _IcuCalendarImpl::GetLeastMaxTimeField(int field) const
287 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
289 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
290 if (icuTimeField != UCAL_FIELD_COUNT)
292 SetLastResult(E_SUCCESS);
293 int value = __pIcuCalendar->getLeastMaximum(icuTimeField);
294 return ConvertToOspTimeFieldValue(field, value);
297 SetLastResult(E_INVALID_ARG);
302 _IcuCalendarImpl::GetMaxTimeField(int field) const
304 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
306 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
307 if (icuTimeField != UCAL_FIELD_COUNT)
309 SetLastResult(E_SUCCESS);
310 int value = __pIcuCalendar->getMaximum(icuTimeField);
311 return ConvertToOspTimeFieldValue(field, value);
314 SetLastResult(E_INVALID_ARG);
319 _IcuCalendarImpl::GetMinDaysInFirstWeek(void) const
321 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
322 return __pIcuCalendar->getMinimalDaysInFirstWeek();
326 _IcuCalendarImpl::GetMinTimeField(int field) const
328 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
330 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
331 if (icuTimeField != UCAL_FIELD_COUNT)
333 SetLastResult(E_SUCCESS);
334 int value = __pIcuCalendar->getMinimum(icuTimeField);
335 return ConvertToOspTimeFieldValue(field, value);
338 SetLastResult(E_INVALID_ARG);
343 _IcuCalendarImpl::GetTimeField(int field) const
345 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
347 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
348 if (icuTimeField != UCAL_FIELD_COUNT)
351 int value = __pIcuCalendar->get(icuTimeField, err);
354 return ConvertToOspTimeFieldValue(field, value);
356 SetLastResult(GetOspException(err));
363 _IcuCalendarImpl::GetTimeInMillisec(long long& millisec) const
365 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
367 result r = ValidateFieldsForOverFlow();
368 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s]Instance is not constructed", GetErrorMessage(r));
371 millisec = __pIcuCalendar->getTime(err);
374 millisec += _EPOCH_OFFSET_IN_MILLISEC;
377 return GetOspException(err);
381 _IcuCalendarImpl::IsInDst(bool& isInDst) const
383 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
385 result r = ValidateFieldsForOverFlow();
386 SysTryReturn(NID_LCL, !IsFailed(r), r, r, "[%s] Fields values are not valid", GetErrorMessage(r));
389 isInDst = __pIcuCalendar->inDaylightTime(err);
390 return GetOspException(err);
394 _IcuCalendarImpl::IsLeapYear(int year) const
396 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
398 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
403 year = 1 - year; // to adjust year as year 0 to 1 BC, -1 to 2 BC and so on
405 return pCal->isLeapYear(year);
411 _IcuCalendarImpl::IsLenient(void) const
413 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
414 return __pIcuCalendar->isLenient();
418 _IcuCalendarImpl::IsSet(int field) const
420 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
422 UCalendarDateFields icuTimeField = static_cast< UCalendarDateFields >(GetIcuTimeField(field));
423 if (icuTimeField != UCAL_FIELD_COUNT)
425 return __pIcuCalendar->isSet(icuTimeField);
432 _IcuCalendarImpl::Roll(int field, int amount)
434 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
436 result r = ValidateFieldsForOverFlow();
439 // Non Roll-able fields
440 if (field == TIME_FIELD_ZONE_OFFSET || field == TIME_FIELD_DST_OFFSET)
442 return E_INVALID_ARG;
445 field = GetIcuTimeField(field);
446 if (field != UCAL_FIELD_COUNT)
449 __pIcuCalendar->roll(static_cast< UCalendarDateFields >(field), amount, err);
450 return GetOspException(err);
452 return E_INVALID_ARG;
458 _IcuCalendarImpl::SetFirstDayOfWeek(int dayOfWeek)
460 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
462 if (dayOfWeek >= UCAL_SUNDAY && dayOfWeek <= UCAL_SATURDAY)
464 __pIcuCalendar->setFirstDayOfWeek(static_cast< UCalendarDaysOfWeek >(dayOfWeek));
467 return E_INVALID_ARG;
472 _IcuCalendarImpl::SetLenient(bool lenient)
474 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
476 __pIcuCalendar->setLenient(lenient);
481 _IcuCalendarImpl::SetMinDaysInFirstWeek(short value)
483 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
485 __pIcuCalendar->setMinimalDaysInFirstWeek(static_cast< byte >(value));
490 _IcuCalendarImpl::SetTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
492 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
493 UErrorCode ec = U_ZERO_ERROR;
494 UDate old = __pIcuCalendar->getTime(ec);
495 __pIcuCalendar->set(year, month - 1, day, hour, minute, second);
496 __pIcuCalendar->set(UCAL_MILLISECOND, millisecond);
499 __pIcuCalendar->getTime(ec);
503 __pIcuCalendar->setTime(old, ec);
504 return E_OUT_OF_RANGE;
511 _IcuCalendarImpl::SetTimeField(int field, int value)
513 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
515 field = GetIcuTimeField(field);
516 if (field != UCAL_FIELD_COUNT)
518 CheckInputFieldValueForOverFlow(field, value);
520 __pIcuCalendar->set(static_cast< UCalendarDateFields >(field), ConvertFromOspTimeFieldValue(field, value));
523 return E_INVALID_ARG;
527 _IcuCalendarImpl::SetTimeInMillisec(long long millisec)
529 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
531 millisec -= _EPOCH_OFFSET_IN_MILLISEC;
534 __pIcuCalendar->setTime(static_cast< UDate >(millisec), err);
535 return GetOspException(err);
539 _IcuCalendarImpl::SetTimeZone(const TimeZone& timeZone)
541 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
543 const _TimeZoneImpl* pTimeZoneImpl = _TimeZoneImpl::GetTimeZoneImpl(timeZone);
546 __pIcuCalendar->adoptTimeZone(pTimeZoneImpl->GetIcuTimeZone()->clone());
552 _IcuCalendarImpl::GetGregorianChange(void) const
554 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
555 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
558 return pCal->getGregorianChange() + _EPOCH_OFFSET_IN_MILLISEC;
564 _IcuCalendarImpl::SetGregorianChange(long long change)
566 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
567 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
570 change -= _EPOCH_OFFSET_IN_MILLISEC;
572 pCal->setGregorianChange(change, err);
573 return GetOspException(err);
575 return E_UNSUPPORTED_OPERATION;
579 _IcuCalendarImpl::GetJulianDay(void) const
581 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
582 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
586 return pCal->get(UCAL_JULIAN_DAY, err);
592 _IcuCalendarImpl::SetJulianDay(int julianDay)
594 SysAssertf(__pIcuCalendar != null, "Not yet constructed! Construct() should be called before use.");
595 IcuGregorianCalendar* pCal = dynamic_cast< IcuGregorianCalendar* >(__pIcuCalendar);
598 pCal->set(UCAL_JULIAN_DAY, julianDay);
601 return E_UNSUPPORTED_OPERATION;
605 _IcuCalendarImpl::GetOspException(IcuErrorCode icuException) const
607 if (U_SUCCESS(icuException))
612 //SysTryLog(NID_LCL, false, "ICU Exception: %s", icuException.errorName());
614 result r = E_SUCCESS;
615 switch (icuException)
617 case U_ILLEGAL_ARGUMENT_ERROR:
627 case U_MEMORY_ALLOCATION_ERROR:
642 _IcuCalendarImpl::GetIcuTimeField(int field) const
644 int res = UCAL_FIELD_COUNT;
653 case TIME_FIELD_YEAR:
659 case TIME_FIELD_MONTH:
665 case TIME_FIELD_WEEK_OF_YEAR:
667 res = UCAL_WEEK_OF_YEAR;
671 case TIME_FIELD_WEEK_OF_MONTH:
673 res = UCAL_WEEK_OF_MONTH;
677 case TIME_FIELD_DAY_OF_MONTH:
679 res = UCAL_DAY_OF_MONTH;
683 case TIME_FIELD_DAY_OF_YEAR:
685 res = UCAL_DAY_OF_YEAR;
689 case TIME_FIELD_DAY_OF_WEEK:
691 res = UCAL_DAY_OF_WEEK;
695 case TIME_FIELD_DAY_OF_WEEK_IN_MONTH:
697 res = UCAL_DAY_OF_WEEK_IN_MONTH;
701 case TIME_FIELD_AM_PM:
707 case TIME_FIELD_HOUR:
713 case TIME_FIELD_HOUR_OF_DAY:
715 res = UCAL_HOUR_OF_DAY;
719 case TIME_FIELD_MINUTE:
725 case TIME_FIELD_SECOND:
731 case TIME_FIELD_MILLISECOND:
733 res = UCAL_MILLISECOND;
737 case TIME_FIELD_ZONE_OFFSET:
739 res = UCAL_ZONE_OFFSET;
743 case TIME_FIELD_DST_OFFSET:
745 res = UCAL_DST_OFFSET;
751 res = UCAL_FIELD_COUNT;
759 _IcuCalendarImpl::ConvertFromOspTimeFieldValue(int field, int value) const
764 case TIME_FIELD_MONTH:
768 case TIME_FIELD_ZONE_OFFSET: // fall through
769 case TIME_FIELD_DST_OFFSET: // fall through
770 // Uncomment these lines if OSP values are set to be in minutes
771 // res *= Calendar::ONE_MINUTE_IN_MILLISEC;
774 case TIME_FIELD_ERA: // fall through
775 case TIME_FIELD_YEAR: // fall through
776 case TIME_FIELD_WEEK_OF_YEAR: // fall through
777 case TIME_FIELD_WEEK_OF_MONTH: // fall through
778 case TIME_FIELD_DAY_OF_MONTH: // fall through
779 case TIME_FIELD_DAY_OF_YEAR: // fall through
780 case TIME_FIELD_DAY_OF_WEEK: // fall through
781 case TIME_FIELD_DAY_OF_WEEK_IN_MONTH: // fall through
782 case TIME_FIELD_AM_PM: // fall through
783 case TIME_FIELD_HOUR: // fall through
784 case TIME_FIELD_HOUR_OF_DAY: // fall through
785 case TIME_FIELD_MINUTE: // fall through
786 case TIME_FIELD_SECOND: // fall through
787 case TIME_FIELD_MILLISECOND: // fall through
796 _IcuCalendarImpl::ConvertToOspTimeFieldValue(int field, int value) const
801 case TIME_FIELD_MONTH:
805 case TIME_FIELD_ZONE_OFFSET: // fall through
806 case TIME_FIELD_DST_OFFSET: // fall through
807 // Uncomment these lines if OSP values are set to be in minutes
808 // res /= Calendar::ONE_MINUTE_IN_MILLISEC;
811 case TIME_FIELD_ERA: // fall through
812 case TIME_FIELD_YEAR: // fall through
813 case TIME_FIELD_WEEK_OF_YEAR: // fall through
814 case TIME_FIELD_WEEK_OF_MONTH: // fall through
815 case TIME_FIELD_DAY_OF_MONTH: // fall through
816 case TIME_FIELD_DAY_OF_YEAR: // fall through
817 case TIME_FIELD_DAY_OF_WEEK: // fall through
818 case TIME_FIELD_DAY_OF_WEEK_IN_MONTH: // fall through
819 case TIME_FIELD_AM_PM: // fall through
820 case TIME_FIELD_HOUR: // fall through
821 case TIME_FIELD_HOUR_OF_DAY: // fall through
822 case TIME_FIELD_MINUTE: // fall through
823 case TIME_FIELD_SECOND: // fall through
824 case TIME_FIELD_MILLISECOND: // fall through
833 _IcuCalendarImpl::GetIcuLocale(const Locale& ospLocale, int type) const
836 String localeStr = ospLocale.GetLocaleCodeString();
837 if (!localeStr.IsEmpty())
841 case CALENDAR_GREGORIAN:
842 localeStr += "@calendar=gregorian";
845 case CALENDAR_BUDDHIST:
846 localeStr += "@calendar=buddhist";
849 case CALENDAR_CHINESE:
850 localeStr += "@calendar=chinese";
853 case CALENDAR_COPTIC:
854 localeStr += "@calendar=coptic";
857 case CALENDAR_ETHIOPIC_AMETE_ALEM:
858 localeStr += "@calendar=ethiopic-amete-alem";
861 case CALENDAR_ETHIOPIC:
862 localeStr += "@calendar=ethiopic";
865 case CALENDAR_HEBREW:
866 localeStr += "@calendar=hebrew";
869 case CALENDAR_INDIAN:
870 localeStr += "@calendar=indian";
873 case CALENDAR_ISLAMIC:
874 localeStr += "@calendar=islamic";
877 case CALENDAR_ISLAMIC_CIVIL:
878 localeStr += "@calendar=islamic-civil";
881 case CALENDAR_JAPANESE:
882 localeStr += "@calendar=japanese";
885 case CALENDAR_PERSIAN:
886 localeStr += "@calendar=persian";
890 localeStr += "@calendar=roc";
893 case CALENDAR_TAIWAN:
894 localeStr += "@calendar=taiwan";
897 case CALENDAR_ISO8601:
898 localeStr += "@calendar=iso8601";
902 localeStr += "@calendar=gregorian";
907 std::unique_ptr< char [] > pLclStr(_StringConverter::CopyToCharArrayN(localeStr));
908 IcuLocale icuLocale = IcuLocale(pLclStr.get());
909 if (icuLocale.isBogus())
911 SetLastResult(E_SYSTEM);
918 _IcuCalendarImpl::CheckInputFieldValueForOverFlow(int field, int value)
920 if (field == TIME_FIELD_ERA)
922 __isEraFieldOverFlowed = (value < GetMinTimeField(TIME_FIELD_ERA)) || (value > GetMaxTimeField(TIME_FIELD_ERA));
927 _IcuCalendarImpl::ValidateFieldsForOverFlow(void) const
929 if (__isEraFieldOverFlowed)
933 return E_OUT_OF_RANGE;
935 return E_INVALID_STATE;
941 _IcuCalendarImpl::GetIcuCalendarCloneN(void) const
945 return __pIcuCalendar->clone();