pimappsupport/chinesecalendaralg/tsrc/ConvertDates.h
branchRCL_3
changeset 12 38571fd2a704
equal deleted inserted replaced
5:42814f902fe6 12:38571fd2a704
       
     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 #ifndef __CONVERTDATES_H__
       
    17 #define __CONVERTDATES_H__
       
    18 
       
    19 // System includes
       
    20 #include <e32base.h>
       
    21 #include <s32strm.h>
       
    22 #include <f32file.h>
       
    23 #include <calendarconverter.h>
       
    24 #include <flogger.h>
       
    25 #include <e32test.h>
       
    26 
       
    27 class TArithmeticalDate  
       
    28 	{
       
    29 public:
       
    30 	TArithmeticalDate();
       
    31 	TBool operator==(const TArithmeticalDate& aDate) const;
       
    32 
       
    33 public:
       
    34 	TInt iDay;
       
    35 	TInt iMonth;
       
    36 	TInt iYear;
       
    37 	};
       
    38 
       
    39 // Constants
       
    40 const TInt KDateLen = 60;
       
    41 
       
    42 // Enumerations
       
    43 enum TCalTypes
       
    44 	{
       
    45 	EGreg,
       
    46 	EHebr,
       
    47 	EChin
       
    48 	};
       
    49 
       
    50 // Classes
       
    51 class CConvertDates : public CBase 
       
    52 	{
       
    53 public:
       
    54 	CConvertDates();
       
    55 	static CConvertDates* NewLC();
       
    56 	static CConvertDates* NewL();
       
    57 	~CConvertDates();
       
    58 	TBool IntegrityTestL();
       
    59 	TBool CompareL();
       
    60 private:
       
    61 	void ConstructL();
       
    62 	void NextDate(TChineseDate& aDate);
       
    63 
       
    64 public:
       
    65 	void ConvertL(TInt aInputFile);
       
    66 
       
    67 public:
       
    68 	RTest iTest;
       
    69 
       
    70 private:
       
    71 	TBool Cal1ToCal2();
       
    72 	void GetCalL(TDes8& aDateToConvert);
       
    73 	void SetCalL(TDes8& aDate, TBool aSuccess=ETrue);
       
    74 	void SetCal16L(TDes& aDate, TBool aSuccess=ETrue);
       
    75 	void OpenFilesL();
       
    76 	TInt ReadLine(RFile& aInputFile, TBuf8<KDateLen>& aDateLine);
       
    77 	enum TNextDateState {EChangeDay, EChangeMonth, EChangeYear, EChangeCycle};
       
    78 	TNextDateState iState;
       
    79 
       
    80 
       
    81 private:
       
    82 	TInt iInputFileNumber;
       
    83 	CChineseCalendarConverter*	iCalendarConverter;
       
    84 	TCalTypes					iCalTypeFrom;
       
    85 	TCalTypes					iCalTypeTo;
       
    86 	TArithmeticalDate			iArithDateOut;
       
    87 	TArithmeticalDate			iArithDateIn;
       
    88 	TChineseDate				iChinDateOut;
       
    89 	TChineseDate				iChinDateIn;
       
    90 //	TGregorianCalendar			iGreg;
       
    91 //	TChineseCalendar			iChin;
       
    92 
       
    93 	RFs							iRFSession;
       
    94 	RFile						iInputFile;
       
    95 	RFile						iOutputFile;
       
    96 	RFile						iOutputFileRef;
       
    97 
       
    98 	RFileLogger					iLogger;
       
    99 
       
   100 	TBuf8<KDateLen>				iDateLine;
       
   101 	};
       
   102 
       
   103 #endif