|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "chinesecalendarconverterimpl.h" |
|
17 #include "gregoriancalendar.h" |
|
18 |
|
19 CChineseCalendarConverter* CChineseCalendarConverterImpl::NewL() |
|
20 { |
|
21 return new(ELeave) CChineseCalendarConverterImpl(); |
|
22 } |
|
23 |
|
24 void CChineseCalendarConverterImpl::DateTimeToChineseL(const TDateTime& aDateTime, TChineseDate& aChineseDate) |
|
25 { |
|
26 iCalendar.DateTimeToChinese(aDateTime); |
|
27 User::LeaveIfError(iCalendar.GetDate(aChineseDate)); |
|
28 } |
|
29 |
|
30 void CChineseCalendarConverterImpl::ChineseToDateTimeL(const TChineseDate& aChineseDate, TDateTime& aDateTime) |
|
31 { |
|
32 User::LeaveIfError(iCalendar.SetDate(aChineseDate)); |
|
33 iCalendar.ChineseToDateTime(aDateTime); |
|
34 } |
|
35 |
|
36 void CChineseCalendarConverterImpl::DateRange(TDateTime& aLower, TDateTime& aUpper) |
|
37 { |
|
38 TGregorianCalendar greg1(KFirstJulianDate); |
|
39 greg1.GregorianToDateTime(aLower); |
|
40 TGregorianCalendar greg2(KLastJulianDate); |
|
41 greg2.GregorianToDateTime(aUpper); |
|
42 } |
|
43 |
|
44 void CChineseCalendarConverterImpl::DateRange(TChineseDate& aLower, TChineseDate& aUpper) |
|
45 { |
|
46 iCalendar.ChineseFromFixed(aLower, KFirstJulianDate); |
|
47 iCalendar.ChineseFromFixed(aUpper, KLastJulianDate); |
|
48 } |
|
49 |
|
50 TReal CChineseCalendarConverterImpl::JulianDate() __SOFTFP |
|
51 { |
|
52 return iCalendar.JulianDate(); |
|
53 } |