Revert "Fix N_SE-46938 for tz list."
[platform/framework/native/appfw.git] / src / locales / FLcl_CalendarImpl.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file     FLcl_CalendarImpl.cpp
19  * @brief    This is the implementation file for _CalendarImpl class.
20  */
21
22 #include <new>
23 #include <unique_ptr.h>
24
25 #include <FBaseDateTime.h>
26 #include <FBaseSysLog.h>
27 #include <FApp_AppInfo.h>
28 #include <FLclGregorianCalendar.h>
29
30 #include "FLcl_CalendarImpl.h"
31 #include "FLcl_IcuCalendarImpl.h"
32 #include "FLcl_LocaleData.h"
33 #include "FLcl_LocaleImpl.h"
34 #include "FLcl_LocaleManagerImpl.h"
35
36 using namespace Tizen::Base;
37
38 namespace Tizen { namespace Locales
39 {
40
41 static const int ONE_MINUTE_IN_MILLISEC = 60000;
42
43 _CalendarImpl::_CalendarImpl()
44         : __type(CALENDAR_GREGORIAN)
45         , __locale(LANGUAGE_INVALID, COUNTRY_INVALID)
46         , __timezone()
47         , __pCalendar(null)
48 {
49 }
50
51 _CalendarImpl::~_CalendarImpl()
52 {
53         delete __pCalendar;
54         __pCalendar = null;
55 }
56
57
58 Calendar*
59 _CalendarImpl::CreateCalendarInstanceN(CalendarType calendarType)
60 {
61         return CreateInstanceN(TimeZone::GetGmtTimeZone(), calendarType);
62 }
63
64 Calendar*
65 _CalendarImpl::CreateCalendarInstanceN(const TimeZone& timeZone, CalendarType calendarType)
66 {
67         return CreateInstanceN(timeZone, _LocaleManagerImpl::GetSystemLocale(), calendarType);
68 }
69
70 Calendar*
71 _CalendarImpl::CreateCalendarInstanceN(const Locale& locale, CalendarType calendarType)
72 {
73         // Create calendar using system time zone and given locale and calendar type
74         return CreateInstanceN(TimeZone::GetGmtTimeZone(), locale, calendarType);
75 }
76
77 Calendar*
78 _CalendarImpl::CreateCalendarInstanceN(const TimeZone& timeZone, const Locale& locale, CalendarType calendarType)
79 {
80         ClearLastResult();
81         result r = E_SYSTEM;
82         switch (calendarType)
83         {
84         case CALENDAR_GREGORIAN:
85         {
86                 std::unique_ptr< GregorianCalendar > pGregCalendar(new (std::nothrow) GregorianCalendar);
87                 SysTryReturn(NID_LCL, pGregCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
88
89                 r = pGregCalendar->Construct(timeZone, locale);
90                 SysTryReturn(NID_LCL, !IsFailed(r), null, r, "[%s] Unable to construct calendar", GetErrorMessage(r));
91
92                 return pGregCalendar.release();
93         }
94
95         default:
96                 break;
97         }
98
99         std::unique_ptr< _CalendarImpl > pCalendar(new (std::nothrow) _CalendarImpl);
100         SysTryReturn(NID_LCL, pCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
101
102         r = pCalendar->Construct(timeZone, locale, calendarType);
103         SetLastResult(r);
104         SysTryReturn(NID_LCL, !IsFailed(r), null, r, "[%s] Unable to construct calendar", GetErrorMessage(r));
105         return pCalendar.release();
106 }
107
108 Calendar*
109 _CalendarImpl::CloneN(void) const
110 {
111         std::unique_ptr< _CalendarImpl > pCalendar(new (std::nothrow) _CalendarImpl());
112         SysTryReturn(NID_LCL, pCalendar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
113
114         if (__pCalendar != null)
115         {
116                 pCalendar->__pCalendar = __pCalendar->CloneN();
117                 if (pCalendar->__pCalendar != null)
118                 {
119                         pCalendar->__type = __type;
120                         pCalendar->__locale = __locale;
121                         pCalendar->__timezone = __timezone;
122
123                         pCalendar->_pCalendarImpl = pCalendar.get();
124                 }
125         }
126
127         return pCalendar.release();
128 }
129
130 result
131 _CalendarImpl::Construct(CalendarType calendarType)
132 {
133         Locale defaultLocale = _LocaleManagerImpl::GetSystemLocale();
134         return Construct( TimeZone::GetGmtTimeZone(), defaultLocale, calendarType);
135 }
136
137 result
138 _CalendarImpl::Construct(const TimeZone& timezone, CalendarType calendarType)
139 {
140         Locale defaultLocale = _LocaleManagerImpl::GetSystemLocale();
141         return Construct(timezone, defaultLocale, calendarType);
142 }
143
144 result
145 _CalendarImpl::Construct(const Locale& locale, CalendarType calendarType)
146 {
147         TimeZone defaultTimeZone = TimeZone::GetGmtTimeZone();
148         return Construct(defaultTimeZone, locale, calendarType);
149 }
150
151 result
152 _CalendarImpl::Construct(const TimeZone& timeZone, const Locale& locale, CalendarType calendarType)
153 {
154         // Object is not allowed to construct twice
155         SysAssertf(__pCalendar == null,
156                            "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
157
158         SysTryReturnResult(NID_LCL, _LocaleImpl::IsSupported(locale), E_INVALID_ARG, "Given locale is not supported");
159
160         std::unique_ptr< _IcuCalendarImpl > pCalendar(new (std::nothrow) _IcuCalendarImpl);
161         SysTryReturnResult(NID_LCL, pCalendar != null, E_OUT_OF_MEMORY, "Memory allocation failed");
162
163         result r = pCalendar->Construct(timeZone, locale, calendarType);
164         if (!IsFailed(r))
165         {
166                 __pCalendar = pCalendar.release();
167                 __type = calendarType;
168                 __locale = locale;
169                 __timezone = timeZone;
170
171                 _pCalendarImpl = this;
172                 return E_SUCCESS;
173         }
174
175         return E_SYSTEM;
176 }
177
178 result
179 _CalendarImpl::Construct(const Calendar& otherCalendar)
180 {
181         // Object is not allowed to construct twice
182         SysAssertf(__pCalendar == null,
183                            "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
184
185         result r = E_SYSTEM;
186         const _CalendarImpl* pOtherCalendar = dynamic_cast< const _CalendarImpl* >(&otherCalendar);
187         if ((pOtherCalendar != null) && (pOtherCalendar->__pCalendar != null))
188         {
189                 delete __pCalendar;
190
191                 __pCalendar = pOtherCalendar->__pCalendar->CloneN();
192                 if (__pCalendar != null)
193                 {
194                         __type = pOtherCalendar->__type;
195                         __locale = pOtherCalendar->__locale;
196                         __timezone = pOtherCalendar->__timezone;
197
198                         _pCalendarImpl = pOtherCalendar->_pCalendarImpl;
199                         return E_SUCCESS;
200                 }
201                 r = GetLastResult();
202         }
203         return r;
204 }
205
206 result
207 _CalendarImpl::SetTimeFieldImpl(TimeField field, int value)
208 {
209         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
210         SysTryReturnResult(NID_LCL, ValidateTimeField(field),
211                         E_INVALID_ARG, "Invalid argument is used. Timefield is less than 0 or grater than time field count.");
212         SysTryReturnResult(NID_LCL, ValidateTimeFieldValue(field, value), E_OUT_OF_RANGE, "value(%d) is out of range.", value);
213
214         return __pCalendar->SetTimeField(field, value);
215 }
216
217 result
218 _CalendarImpl::SetTimeInMillisecImpl(long long millisec)
219 {
220         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
221         return __pCalendar->SetTimeInMillisec(millisec - __timezone.GetRawOffset() * ONE_MINUTE_IN_MILLISEC);
222 }
223
224 result
225 _CalendarImpl::SetTimeImpl(const DateTime& dateTime)
226 {
227         return SetTimeImpl(dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(),
228                          dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond(), dateTime.GetMillisecond());
229 }
230
231 result
232 _CalendarImpl::SetTimeImpl(int year, int month, int day, int hour, int minute, int second, int millisecond)
233 {
234         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
235         return __pCalendar->SetTime(year, month, day, hour, minute, second, millisecond);
236 }
237
238 result
239 _CalendarImpl::SetFirstDayOfWeekImpl(DayOfWeek dayOfWeek)
240 {
241         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
242         SysTryReturnResult(NID_LCL, ValidateDaysOfWeek(dayOfWeek), E_INVALID_ARG, "Invalid argument is used. Unknown day of week");
243
244         return __pCalendar->SetFirstDayOfWeek(dayOfWeek);
245 }
246
247 result
248 _CalendarImpl::SetLenientImpl(bool lenient)
249 {
250         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
251         return __pCalendar->SetLenient(lenient);
252 }
253
254 result
255 _CalendarImpl::SetMinDaysInFirstWeekImpl(short value)
256 {
257         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
258         return __pCalendar->SetMinDaysInFirstWeek(value);
259 }
260
261 result
262 _CalendarImpl::SetTimeZoneImpl(const TimeZone& timeZone)
263 {
264         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
265
266         _timeZone = timeZone;
267         __timezone = timeZone;
268         return __pCalendar->SetTimeZone(__timezone);
269 }
270
271 result
272 _CalendarImpl::ClearImpl(void)
273 {
274         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
275         return __pCalendar->Clear();
276 }
277
278 result
279 _CalendarImpl::ClearImpl(TimeField field)
280 {
281         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
282         SysTryReturnResult(NID_LCL, ValidateTimeField(field), E_INVALID_ARG,
283                                 "Invalid argument is used. Timefield is less than 0 or grater than time field count.");
284
285         return __pCalendar->Clear(field);
286 }
287
288 result
289 _CalendarImpl::AddTimeField(TimeField field, int amount)
290 {
291         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
292
293         result r = E_INVALID_ARG;
294
295         if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
296         {
297                 r = E_INVALID_STATE;
298         }
299
300         SysTryReturnResult(NID_LCL, ValidateTimeField(field), r,
301                                 "Invalid argument is used. Timefield is less than 0 or grater than time field count.");
302
303         return __pCalendar->AddTimeField(field, amount);
304 }
305
306 result
307 _CalendarImpl::RollImpl(TimeField field, int amount)
308 {
309         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
310         result r = E_INVALID_ARG;
311         if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
312         {
313                 r = E_INVALID_STATE;
314         }
315
316         SysTryReturnResult(NID_LCL, ValidateTimeField(field), r,
317                                 "Invalid argument is used. Timefield is less than 0 or grater than time field count.");
318
319         return __pCalendar->Roll(field, amount);
320 }
321
322 result
323 _CalendarImpl::AfterImpl(const _CalendarImpl& otherInstance, bool& after)
324 {
325         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
326
327         result r = E_INVALID_ARG;
328         if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
329         {
330                 r = E_INVALID_STATE;
331         }
332
333         SysTryReturnResult(NID_LCL, otherInstance.__pCalendar, r, "Invalid argument is used. otherCalendar instance is invalid");
334
335         return __pCalendar->After(*(otherInstance.__pCalendar), after);
336 }
337
338 result
339 _CalendarImpl::BeforeImpl(const _CalendarImpl& otherInstance, bool& before)
340 {
341         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
342
343         result r = E_INVALID_ARG;
344         if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat())
345         {
346                 r = E_INVALID_STATE;
347         }
348
349         SysTryReturnResult(NID_LCL, otherInstance.__pCalendar, r, "Invalid argument is used. otherCalendar instance is invalid");
350
351         return __pCalendar->Before(*(otherInstance.__pCalendar), before);
352 }
353
354 bool
355 _CalendarImpl::EqualsImpl(const _CalendarImpl& otherInstance) const
356 {
357         if ((__pCalendar != null) && (otherInstance.__pCalendar != null))
358         {
359                 return __pCalendar->Equals(*(otherInstance.__pCalendar));
360         }
361         return (__pCalendar == otherInstance.__pCalendar);
362 }
363
364 int
365 _CalendarImpl::GetHashCodeImpl(void) const
366 {
367         Integer intValues = IsLenient() + GetFirstDayOfWeek() + GetMinDaysInFirstWeek();
368         int hashCode = intValues.GetHashCode();
369
370         long long myTicks = 0;
371         GetTimeInMillisec(myTicks);
372         hashCode = (hashCode << 5) - hashCode + LongLong(myTicks).GetHashCode()+__timezone.GetHashCode();
373
374         return hashCode;
375 }
376
377 CalendarType
378 _CalendarImpl::GetType(void) const
379 {
380         return __type;
381 }
382
383 int
384 _CalendarImpl::GetTimeFieldImpl(TimeField field) const
385 {
386         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
387         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
388                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
389
390         return __pCalendar->GetTimeField(field);
391 }
392
393 result
394 _CalendarImpl::GetTimeInMillisecImpl(long long& millisec) const
395 {
396         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
397         result r;
398         long long tempMillisec;
399
400         r =  __pCalendar->GetTimeInMillisec(tempMillisec);
401         SysTryReturnResult(NID_LCL, r == E_SUCCESS, r, "Unable to get time in milli sec");
402         millisec = tempMillisec + __timezone.GetRawOffset() * ONE_MINUTE_IN_MILLISEC;
403         return r;
404 }
405
406 DateTime
407 _CalendarImpl::GetTimeImpl(void) const
408 {
409         int year = __pCalendar->GetTimeField(TIME_FIELD_YEAR);
410         int month = __pCalendar->GetTimeField(TIME_FIELD_MONTH);
411         int date = __pCalendar->GetTimeField(TIME_FIELD_DAY_OF_MONTH);
412
413         int hour = __pCalendar->GetTimeField(TIME_FIELD_HOUR_OF_DAY);
414         int minute = __pCalendar->GetTimeField(TIME_FIELD_MINUTE);
415         int second = __pCalendar->GetTimeField(TIME_FIELD_SECOND);
416         int millisecond = __pCalendar->GetTimeField(TIME_FIELD_MILLISECOND);
417
418         DateTime dateTime;
419         result r = dateTime.SetValue(year, month, date, hour, minute, second, millisecond);
420         SysTryReturn(NID_LCL, r == E_SUCCESS, DateTime(), r, "[%s] Unable to set time in DateTime object", GetErrorMessage(r));
421
422         return dateTime;
423 }
424
425 int
426 _CalendarImpl::GetMinTimeFieldImpl(TimeField field) const
427 {
428         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
429         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
430                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
431
432         return __pCalendar->GetMinTimeField(field);
433 }
434
435 int
436 _CalendarImpl::GetActualMinTimeFieldImpl(TimeField field) const
437 {
438         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
439         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
440                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
441
442         return __pCalendar->GetActualMinTimeField(field);
443 }
444
445 int
446 _CalendarImpl::GetGreatestMinTimeFieldImpl(TimeField field) const
447 {
448         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
449         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
450                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
451
452         return __pCalendar->GetGreatestMinTimeField(field);
453 }
454
455 int
456 _CalendarImpl::GetLeastMaxTimeFieldImpl(TimeField field) const
457 {
458         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
459         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
460                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
461
462         return __pCalendar->GetLeastMaxTimeField(field);
463 }
464
465 int
466 _CalendarImpl::GetActualMaxTimeFieldImpl(TimeField field) const
467 {
468         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
469         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
470                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
471
472         return __pCalendar->GetActualMaxTimeField(field);
473 }
474
475 int
476 _CalendarImpl::GetMaxTimeFieldImpl(TimeField field) const
477 {
478         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
479         SysTryReturn(NID_LCL, ValidateTimeField(field), -1, E_INVALID_ARG,
480                                 "[%s] Invalid argument is used. Timefield is less than 0 or grater than time field count.", GetErrorMessage(E_INVALID_ARG));
481
482         return __pCalendar->GetMaxTimeField(field);
483 }
484
485 int
486 _CalendarImpl::GetFirstDayOfWeekImpl(void) const
487 {
488         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
489         return __pCalendar->GetFirstDayOfWeek();
490 }
491
492 int
493 _CalendarImpl::GetMinDaysInFirstWeekImpl(void) const
494 {
495         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
496         return __pCalendar->GetMinDaysInFirstWeek();
497 }
498
499 result
500 _CalendarImpl::IsInDst(bool& isInDst) const
501 {
502         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
503         return __pCalendar->IsInDst(isInDst);
504 }
505
506 bool
507 _CalendarImpl::IsLenientImpl(void) const
508 {
509         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
510         return __pCalendar->IsLenient();
511 }
512
513 bool
514 _CalendarImpl::IsSetImpl(TimeField field) const
515 {
516         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
517         return __pCalendar->IsSet(field);
518 }
519
520 TimeZone
521 _CalendarImpl::GetTimeZoneImpl(void) const
522 {
523         return __timezone;
524 }
525
526 bool
527 _CalendarImpl::IsLeapYear(int year) const
528 {
529         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
530         return __pCalendar->IsLeapYear(year);
531 }
532
533 result
534 _CalendarImpl::SetGregorianChange(long long change)
535 {
536         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
537         return __pCalendar->SetGregorianChange(change);
538 }
539
540 long long
541 _CalendarImpl::GetGregorianChange(void) const
542 {
543         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
544         return __pCalendar->GetGregorianChange();
545 }
546
547 result
548 _CalendarImpl::SetJulianDay(int julianDay)
549 {
550         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
551         return __pCalendar->SetJulianDay(julianDay);
552 }
553
554 int
555 _CalendarImpl::GetJulianDay(void) const
556 {
557         SysAssertf(__pCalendar != null, "Not yet constructed! Construct() should be called before use.");
558         return __pCalendar->GetJulianDay();
559 }
560
561 bool
562 _CalendarImpl::ValidateTimeField(TimeField field) const
563 {
564         if (field < 0 || field >= TIME_FIELD_FIELD_COUNT)
565         {
566                 return false;
567         }
568         return true;
569 }
570
571 bool
572 _CalendarImpl::ValidateTimeFieldValue(TimeField field, int value) const
573 {
574         if (IsLenientImpl() == false)
575         {
576                 if ((value < GetMinTimeField(field)) || (value > GetMaxTimeField(field)))
577                 {
578                         return false;
579                 }
580         }
581
582         return true;
583 }
584
585 bool
586 _CalendarImpl::ValidateDaysOfWeek(DayOfWeek dayOfWeek) const
587 {
588         if (dayOfWeek < SUNDAY || dayOfWeek > SATURDAY)
589         {
590                 return false;
591         }
592         return true;
593 }
594
595 // added for backward compatibility
596 result
597 _CalendarImpl::RollWithSingleUnit(TimeField field, bool up)
598 {
599         return E_UNSUPPORTED_OPERATION;
600 }
601
602 // added for backward compatibility
603 result
604 _CalendarImpl::ComputeTimeFields(void)
605 {
606         return E_UNSUPPORTED_OPERATION;
607 }
608
609 // added for backward compatibility
610 result
611 _CalendarImpl::ComputeTime(void)
612 {
613         return E_UNSUPPORTED_OPERATION;
614 }
615
616 // added for backward compatibility
617 int
618 _CalendarImpl::GetMonthLength(int extendedYear, int month) const
619 {
620         SetLastResult(E_UNSUPPORTED_OPERATION);
621         return -1;
622 }
623
624 // added for backward compatibility
625 int
626 _CalendarImpl::HandleGetLimit(TimeField field, CalendarLimitType limitType) const
627 {
628         SetLastResult(E_UNSUPPORTED_OPERATION);
629         return -1;
630 }
631
632 const _IcuCalendarImpl*
633 _CalendarImpl::GetImpl(const Calendar& calendar)
634 {
635         if (calendar._pCalendarImpl)
636         {
637                 return calendar._pCalendarImpl->__pCalendar;
638         }
639
640         return null;
641 }
642
643 };
644 };      // Tizen::Locales