calendarui/regionalplugins/KoreanLunar/inc/CalenSolarTerms.h
branchRCL_3
changeset 31 97232defd20e
equal deleted inserted replaced
30:bd7edf625bdd 31:97232defd20e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 *  Description : Class looking after alarm fields for forms.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CALENSOLARTERMS_H
       
    20 #define C_CALENSOLARTERMS_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <badesca.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 class RFs;
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KSolarTermCount( 24 );
       
    31 
       
    32 
       
    33 /**
       
    34  * Provides Solar term dates for Lunar Calendar. 
       
    35  *
       
    36  * Solar term dates are listed in special binary format file. 
       
    37  * CCalenSolarTerms reads and caches this file one year at a time.
       
    38  *
       
    39  *  @lib CalenLunar.dll
       
    40  *  @since S60 v3.1
       
    41  */
       
    42 NONSHARABLE_CLASS( CCalenSolarTerms ) : public CBase
       
    43     {
       
    44 public:
       
    45     static CCalenSolarTerms* NewL( RFs& aFs );
       
    46 
       
    47     virtual ~CCalenSolarTerms();
       
    48 
       
    49     /**
       
    50      * Checks if date is solar term date. If it is, returns index to particular solar term, otherwise returns error code
       
    51      * Index can be then passed to GetSolarTermNameL function. 
       
    52      *
       
    53      * @since S60 v3.1
       
    54      * @param aDateTime date that is checked 
       
    55      * @return index of solar term, if date is solar term date.
       
    56      *         KErrNone, if date is not solar term date
       
    57      *         KErrNotSupported, if date is outside of supported 
       
    58      *                           range for solar term data.
       
    59      */
       
    60     TInt CheckSolarTermDateL( const TDateTime& aDateTime ); 
       
    61 
       
    62 
       
    63 private:
       
    64     CCalenSolarTerms( RFs& aFs );
       
    65 
       
    66     void ConstructL();
       
    67 
       
    68     /** 
       
    69      * Returns ETrue, if date fits into date range of available solar item 
       
    70      * data.
       
    71      * @since 3.0
       
    72      */
       
    73     TBool HasSolarTermDataAvailable( const TDateTime& aDate ) const;
       
    74 
       
    75     /**
       
    76      * Reads and caches 24 solar term dates from "SolarItems" file
       
    77      */
       
    78     void ReadSolarTermsL( TDateTime aDate );
       
    79 
       
    80 private: // data
       
    81     /**
       
    82      * File server handle.
       
    83      */
       
    84     RFs& iFs;
       
    85 
       
    86     /**
       
    87      * Year that is currently cached from file to memory
       
    88      */
       
    89     TInt iCachedYear;
       
    90 
       
    91     /**
       
    92      * Table of solar term dates for currently cached year
       
    93      */
       
    94     TDateTime iSolarTermDates[KSolarTermCount];
       
    95 
       
    96     };
       
    97 
       
    98 #endif // C_CALENSOLARTERMS_H