|
1 /* |
|
2 * Copyright (c) 2006 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: Provides Solar Term dates for Lunar Calendar. Reads and caches |
|
15 * binary data file that lists solar term dates. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_CALENSOLARTERMS_H |
|
22 #define C_CALENSOLARTERMS_H |
|
23 |
|
24 #include <badesca.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 class RFs; |
|
28 |
|
29 const TInt KSolarTermCount(24); |
|
30 |
|
31 |
|
32 /** |
|
33 * Provides Solar term dates for Lunar Calendar. |
|
34 * |
|
35 * Solar term dates are listed in special binary format file. |
|
36 * CCalenSolarTerms reads and caches this file one year at a time. |
|
37 * |
|
38 * @lib CalenLunar.dll |
|
39 * @since S60 v3.1 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CCalenSolarTerms ) : public CBase |
|
42 { |
|
43 public: |
|
44 IMPORT_C static CCalenSolarTerms* NewL(RFs& aFs); |
|
45 |
|
46 IMPORT_C virtual ~CCalenSolarTerms(); |
|
47 |
|
48 /** |
|
49 * Checks if date is solar term date. If it is, returns index to particular solar term, otherwise returns error code |
|
50 * Index can be then passed to GetSolarTermNameL function. |
|
51 * |
|
52 * @since S60 v3.1 |
|
53 * @param aDateTime date that is checked |
|
54 * @return index of solar term, if date is solar term date. |
|
55 * KErrNone, if date is not solar term date |
|
56 * KErrNotSupported, if date is outside of supported |
|
57 * range for solar term data. |
|
58 */ |
|
59 IMPORT_C TInt CheckSolarTermDateL( const TDateTime& aDateTime ); |
|
60 |
|
61 |
|
62 private: |
|
63 CCalenSolarTerms(RFs& aFs); |
|
64 |
|
65 void ConstructL(); |
|
66 |
|
67 /** |
|
68 * Returns ETrue, if date fits into date range of available solar item |
|
69 * data. |
|
70 * @since 3.0 |
|
71 */ |
|
72 TBool HasSolarTermDataAvailable(const TDateTime& aDate) const; |
|
73 |
|
74 /** |
|
75 * Reads and caches 24 solar term dates from "SolarItems" file |
|
76 */ |
|
77 void ReadSolarTermsL(TDateTime aDate); |
|
78 |
|
79 private: // data |
|
80 /** |
|
81 * File server handle. |
|
82 */ |
|
83 RFs& iFs; |
|
84 |
|
85 /** |
|
86 * Year that is currently cached from file to memory |
|
87 */ |
|
88 TInt iCachedYear; |
|
89 |
|
90 /** |
|
91 * Table of solar term dates for currently cached year |
|
92 */ |
|
93 TDateTime iSolarTermDates[KSolarTermCount]; |
|
94 |
|
95 }; |
|
96 |
|
97 #endif // C_CALENSOLARTERMS_H |