|
1 // Copyright (c) 2002-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 #ifndef __CALENDARCONVERTER_H__ |
|
17 #define __CALENDARCONVERTER_H__ |
|
18 |
|
19 // System includes |
|
20 #include <e32std.h> |
|
21 #include <e32base.h> |
|
22 |
|
23 class TChineseDate |
|
24 /** Chinese date. |
|
25 |
|
26 Its public member data is the year cycle, the year (1-60), the month (1-12), whether or |
|
27 not the month is a leap month, and the day in the month (1-29 or 30). |
|
28 @publishedAll |
|
29 @released */ |
|
30 { |
|
31 public: |
|
32 IMPORT_C TChineseDate(); |
|
33 IMPORT_C TBool operator==(const TChineseDate& aDate) const; |
|
34 public: |
|
35 /** The year cycle. */ |
|
36 TInt iCycle; |
|
37 /** The year (1-60). */ |
|
38 TInt iYear; |
|
39 /** The month (1-12). */ |
|
40 TInt iMonth; |
|
41 /** Whether or not the month is a leap month. */ |
|
42 TBool iLeapMonth; |
|
43 /** The day in the month (1-29 or 30). */ |
|
44 TInt iDay; |
|
45 }; |
|
46 |
|
47 |
|
48 class CChineseCalendarConverter : public CBase |
|
49 /** Converts between TDateTime and TChineseDate formats in both directions. Chinese dates |
|
50 are calculated using the -2636 epoch. This is equivalent to 2637 BCE (Before Common Era). |
|
51 @publishedAll |
|
52 @released */ |
|
53 { |
|
54 public: |
|
55 IMPORT_C static CChineseCalendarConverter* NewL(); |
|
56 /** Creates a Chinese date from a TDateTime value. |
|
57 |
|
58 @param aDateTime The date/time value to convert. |
|
59 @param aChineseDate On return, contains the Chinese date. If the supplied date |
|
60 is invalid, this contains KErrArgument. */ |
|
61 virtual void DateTimeToChineseL(const TDateTime& aDateTime, TChineseDate& aChineseDate)=0; |
|
62 |
|
63 /** Creates a TDateTime value from a Chinese date. |
|
64 |
|
65 @param aChineseDate A date in Chinese format. |
|
66 @param aDateTime On return, contains a date value. If the supplied date is |
|
67 invalid, this contains KErrArgument. */ |
|
68 virtual void ChineseToDateTimeL(const TChineseDate& aChineseDate, TDateTime& aDateTime)=0; |
|
69 |
|
70 /** Returns the range of dates, in standard date format, acceptable to the Chinese |
|
71 calendar converter. |
|
72 |
|
73 @param aLower On return, contains the lower limit of the converter. |
|
74 @param aUpper On return, contains the upper limit of the converter. */ |
|
75 virtual void DateRange(TDateTime& aLower, TDateTime& aUpper)=0; |
|
76 |
|
77 /** Returns the range of dates, in Chinese date format, acceptable to the Chinese |
|
78 calendar converter. |
|
79 |
|
80 @param aLower On return, contains the lower limit of the converter. |
|
81 @param aUpper On return, contains the upper limit of the converter. */ |
|
82 virtual void DateRange(TChineseDate& aLower, TChineseDate& aUpper)=0; |
|
83 /** Returns the result of the last calendar conversion as a Julian date. |
|
84 |
|
85 @return The Julian date. */ |
|
86 virtual TReal JulianDate() __SOFTFP =0; |
|
87 }; |
|
88 #endif |