epoc32/include/calendarconverter.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 calendarconverter.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 #include <e32std.h>
       
    20 #include <e32base.h>
       
    21 
       
    22 class TChineseDate  
       
    23 /** Chinese date.
       
    24 
       
    25 Its public member data is the year cycle, the year (1-60), the month (1-12), whether or 
       
    26 not the month is a leap month, and the day in the month (1-29 or 30). 
       
    27 @publishedAll
       
    28 @released */
       
    29 	{
       
    30 public:
       
    31 	IMPORT_C TChineseDate();
       
    32 	IMPORT_C TBool operator==(const TChineseDate& aDate) const;
       
    33 public:
       
    34 	/** The year cycle. */
       
    35 	TInt iCycle;
       
    36 	/** The year (1-60). */
       
    37 	TInt iYear;
       
    38 	/** The month (1-12). */
       
    39 	TInt iMonth;
       
    40 	/** Whether or not the month is a leap month. */
       
    41 	TBool iLeapMonth;
       
    42 	/** The day in the month (1-29 or 30). */
       
    43 	TInt iDay;
       
    44 	};
       
    45 
       
    46 
       
    47 class CChineseCalendarConverter : public CBase
       
    48 /** Converts between TDateTime and TChineseDate formats in both directions. Chinese dates 
       
    49 are calculated using the -2636 epoch. This is equivalent to 2637 BCE (Before Common Era). 
       
    50 @publishedAll
       
    51 @released */
       
    52 	{
       
    53 public:
       
    54 	IMPORT_C static CChineseCalendarConverter* NewL();
       
    55 
       
    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 
       
    89 #endif