williamr@2
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __CALENDARCONVERTER_H__
|
williamr@2
|
17 |
#define __CALENDARCONVERTER_H__
|
williamr@2
|
18 |
|
williamr@4
|
19 |
// System includes
|
williamr@2
|
20 |
#include <e32std.h>
|
williamr@2
|
21 |
#include <e32base.h>
|
williamr@2
|
22 |
|
williamr@2
|
23 |
class TChineseDate
|
williamr@2
|
24 |
/** Chinese date.
|
williamr@2
|
25 |
|
williamr@2
|
26 |
Its public member data is the year cycle, the year (1-60), the month (1-12), whether or
|
williamr@2
|
27 |
not the month is a leap month, and the day in the month (1-29 or 30).
|
williamr@2
|
28 |
@publishedAll
|
williamr@2
|
29 |
@released */
|
williamr@2
|
30 |
{
|
williamr@2
|
31 |
public:
|
williamr@2
|
32 |
IMPORT_C TChineseDate();
|
williamr@2
|
33 |
IMPORT_C TBool operator==(const TChineseDate& aDate) const;
|
williamr@2
|
34 |
public:
|
williamr@2
|
35 |
/** The year cycle. */
|
williamr@2
|
36 |
TInt iCycle;
|
williamr@2
|
37 |
/** The year (1-60). */
|
williamr@2
|
38 |
TInt iYear;
|
williamr@2
|
39 |
/** The month (1-12). */
|
williamr@2
|
40 |
TInt iMonth;
|
williamr@2
|
41 |
/** Whether or not the month is a leap month. */
|
williamr@2
|
42 |
TBool iLeapMonth;
|
williamr@2
|
43 |
/** The day in the month (1-29 or 30). */
|
williamr@2
|
44 |
TInt iDay;
|
williamr@2
|
45 |
};
|
williamr@2
|
46 |
|
williamr@2
|
47 |
|
williamr@2
|
48 |
class CChineseCalendarConverter : public CBase
|
williamr@2
|
49 |
/** Converts between TDateTime and TChineseDate formats in both directions. Chinese dates
|
williamr@2
|
50 |
are calculated using the -2636 epoch. This is equivalent to 2637 BCE (Before Common Era).
|
williamr@2
|
51 |
@publishedAll
|
williamr@2
|
52 |
@released */
|
williamr@2
|
53 |
{
|
williamr@2
|
54 |
public:
|
williamr@2
|
55 |
IMPORT_C static CChineseCalendarConverter* NewL();
|
williamr@2
|
56 |
/** Creates a Chinese date from a TDateTime value.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
@param aDateTime The date/time value to convert.
|
williamr@2
|
59 |
@param aChineseDate On return, contains the Chinese date. If the supplied date
|
williamr@2
|
60 |
is invalid, this contains KErrArgument. */
|
williamr@2
|
61 |
virtual void DateTimeToChineseL(const TDateTime& aDateTime, TChineseDate& aChineseDate)=0;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/** Creates a TDateTime value from a Chinese date.
|
williamr@2
|
64 |
|
williamr@2
|
65 |
@param aChineseDate A date in Chinese format.
|
williamr@2
|
66 |
@param aDateTime On return, contains a date value. If the supplied date is
|
williamr@2
|
67 |
invalid, this contains KErrArgument. */
|
williamr@2
|
68 |
virtual void ChineseToDateTimeL(const TChineseDate& aChineseDate, TDateTime& aDateTime)=0;
|
williamr@2
|
69 |
|
williamr@2
|
70 |
/** Returns the range of dates, in standard date format, acceptable to the Chinese
|
williamr@2
|
71 |
calendar converter.
|
williamr@2
|
72 |
|
williamr@2
|
73 |
@param aLower On return, contains the lower limit of the converter.
|
williamr@2
|
74 |
@param aUpper On return, contains the upper limit of the converter. */
|
williamr@2
|
75 |
virtual void DateRange(TDateTime& aLower, TDateTime& aUpper)=0;
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/** Returns the range of dates, in Chinese date format, acceptable to the Chinese
|
williamr@2
|
78 |
calendar converter.
|
williamr@2
|
79 |
|
williamr@2
|
80 |
@param aLower On return, contains the lower limit of the converter.
|
williamr@2
|
81 |
@param aUpper On return, contains the upper limit of the converter. */
|
williamr@2
|
82 |
virtual void DateRange(TChineseDate& aLower, TChineseDate& aUpper)=0;
|
williamr@2
|
83 |
/** Returns the result of the last calendar conversion as a Julian date.
|
williamr@2
|
84 |
|
williamr@2
|
85 |
@return The Julian date. */
|
williamr@2
|
86 |
virtual TReal JulianDate() __SOFTFP =0;
|
williamr@2
|
87 |
};
|
williamr@2
|
88 |
#endif
|