15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include "calendarui_debug.h" |
19 #include "calendarui_debug.h" |
20 #include "calenlunarinfoprovider.h" |
20 #include "CalenLunarInfoProvider.h" |
21 #include "calenlunarinfo.h" |
21 #include "CalenLunarInfo.h" |
22 #include "calensolarterms.h" |
22 #include "CalenSolarTerms.h" |
23 |
23 |
24 #include <calendarconverter.h> |
24 #include <calendarconverter.h> |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "calenlunarinfoproviderTraces.h" |
|
28 #endif |
|
29 |
25 |
30 |
26 |
31 |
27 // --------------------------------------------------------- |
32 // --------------------------------------------------------- |
28 // CCalenCalanderConverter::CalculateCelestialIndex |
33 // CCalenCalanderConverter::CalculateCelestialIndex |
29 // Calculates a Heavenly stem's index and a Terrestrial branch's index |
34 // Calculates a Heavenly stem's index and a Terrestrial branch's index |
54 else |
58 else |
55 { |
59 { |
56 aTerrestrialIndex--; |
60 aTerrestrialIndex--; |
57 } |
61 } |
58 |
62 |
59 TRACE_EXIT_POINT; |
63 OstTraceFunctionExit0( _CELESTIALINDEX_EXIT ); |
60 } |
64 } |
61 |
65 |
62 // ----------------------------------------------------------------------------- |
66 // ----------------------------------------------------------------------------- |
63 // CCalenCalanderConverter::ChineseFestival |
67 // CCalenCalanderConverter::ChineseFestival |
64 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
65 // |
69 // |
66 static TCalenLunarInfo::TFestival ChineseFestival( |
70 static TCalenLunarInfo::TFestival ChineseFestival( |
67 const TChineseDate& aChineseDate, |
71 const TChineseDate& aChineseDate, |
68 const TChineseDate& aNextDate) |
72 const TChineseDate& aNextDate) |
69 { |
73 { |
70 TRACE_ENTRY_POINT; |
74 OstTraceFunctionEntry0( _CHINESEFESTIVAL_ENTRY ); |
71 |
|
72 TCalenLunarInfo::TFestival index = TCalenLunarInfo::ENoFestival; |
75 TCalenLunarInfo::TFestival index = TCalenLunarInfo::ENoFestival; |
73 |
76 |
74 if (!aChineseDate.iLeapMonth) |
77 if (!aChineseDate.iLeapMonth) |
75 { |
78 { |
76 if (aChineseDate.iMonth == 1 && aChineseDate.iDay == 1) |
79 if (aChineseDate.iMonth == 1 && aChineseDate.iDay == 1) |
114 aNextDate.iMonth == 1 && aNextDate.iDay == 1) |
117 aNextDate.iMonth == 1 && aNextDate.iDay == 1) |
115 { |
118 { |
116 index = TCalenLunarInfo::EFestivalNewYearEve; |
119 index = TCalenLunarInfo::EFestivalNewYearEve; |
117 } |
120 } |
118 |
121 |
119 TRACE_EXIT_POINT; |
122 OstTraceFunctionExit0( _CHINESEFESTIVAL_EXIT ); |
120 return index; |
123 return index; |
121 } |
124 } |
122 |
125 |
123 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
124 // CCalenLunarInfoProvider::NewL |
127 // CCalenLunarInfoProvider::NewL |
125 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
126 // |
129 // |
127 EXPORT_C CCalenLunarInfoProvider* CCalenLunarInfoProvider::NewL(RFs& aFs) |
130 EXPORT_C CCalenLunarInfoProvider* CCalenLunarInfoProvider::NewL(RFs& aFs) |
128 { |
131 { |
129 TRACE_ENTRY_POINT; |
132 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_NEWL_ENTRY ); |
130 |
|
131 CCalenLunarInfoProvider* self = new (ELeave) CCalenLunarInfoProvider(); |
133 CCalenLunarInfoProvider* self = new (ELeave) CCalenLunarInfoProvider(); |
132 CleanupStack::PushL(self); |
134 CleanupStack::PushL(self); |
133 self->ConstructL(aFs); |
135 self->ConstructL(aFs); |
134 CleanupStack::Pop(self); |
136 CleanupStack::Pop(self); |
135 |
137 |
136 TRACE_EXIT_POINT; |
138 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_NEWL_EXIT ); |
137 return self; |
139 return self; |
138 } |
140 } |
139 |
141 |
140 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
141 // CCalenLunarInfoProvider::~CCalenLunarInfoProvider |
143 // CCalenLunarInfoProvider::~CCalenLunarInfoProvider |
142 // ----------------------------------------------------------------------------- |
144 // ----------------------------------------------------------------------------- |
143 // |
145 // |
144 EXPORT_C CCalenLunarInfoProvider::~CCalenLunarInfoProvider() |
146 EXPORT_C CCalenLunarInfoProvider::~CCalenLunarInfoProvider() |
145 { |
147 { |
146 TRACE_ENTRY_POINT; |
148 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_ENTRY ); |
147 |
|
148 delete iSolarTerms; |
149 delete iSolarTerms; |
149 delete iConverter; |
150 delete iConverter; |
150 |
151 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_EXIT ); |
151 TRACE_EXIT_POINT; |
|
152 } |
152 } |
153 |
153 |
154 // ----------------------------------------------------------------------------- |
154 // ----------------------------------------------------------------------------- |
155 // CCalenLunarInfoProvider::CCalenLunarInfoProvider |
155 // CCalenLunarInfoProvider::CCalenLunarInfoProvider |
156 // ----------------------------------------------------------------------------- |
156 // ----------------------------------------------------------------------------- |
157 // |
157 // |
158 CCalenLunarInfoProvider::CCalenLunarInfoProvider() |
158 CCalenLunarInfoProvider::CCalenLunarInfoProvider() |
159 { |
159 { |
160 TRACE_ENTRY_POINT; |
160 OstTraceFunctionEntry0( DUP1_CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_ENTRY ); |
161 TRACE_EXIT_POINT; |
161 OstTraceFunctionExit0( DUP1_CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_EXIT ); |
162 } |
162 } |
163 |
163 |
164 // ----------------------------------------------------------------------------- |
164 // ----------------------------------------------------------------------------- |
165 // CCalenLunarInfoProvider::ConstructL |
165 // CCalenLunarInfoProvider::ConstructL |
166 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
167 // |
167 // |
168 void CCalenLunarInfoProvider::ConstructL(RFs& aFs) |
168 void CCalenLunarInfoProvider::ConstructL(RFs& aFs) |
169 { |
169 { |
170 TRACE_ENTRY_POINT; |
170 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_CONSTRUCTL_ENTRY ); |
171 |
171 |
172 iConverter = CChineseCalendarConverter::NewL(); |
172 iConverter = CChineseCalendarConverter::NewL(); |
173 iSolarTerms = CCalenSolarTerms::NewL(aFs); |
173 iSolarTerms = CCalenSolarTerms::NewL(aFs); |
174 |
174 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_CONSTRUCTL_EXIT ); |
175 TRACE_EXIT_POINT; |
|
176 } |
175 } |
177 |
176 |
178 // ----------------------------------------------------------------------------- |
177 // ----------------------------------------------------------------------------- |
179 // CCalenLunarInfoProvider::GetLunarInfoL |
178 // CCalenLunarInfoProvider::GetLunarInfoL |
180 // ----------------------------------------------------------------------------- |
179 // ----------------------------------------------------------------------------- |
181 // |
180 // |
182 EXPORT_C TCalenLunarInfo CCalenLunarInfoProvider::GetLunarInfoL( const TTime& aDay ) |
181 EXPORT_C TCalenLunarInfo CCalenLunarInfoProvider::GetLunarInfoL( const TTime& aDay ) |
183 { |
182 { |
184 TRACE_ENTRY_POINT; |
183 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_GETLUNARINFOL_ENTRY ); |
185 |
|
186 TDateTime dayDt = aDay.DateTime(); |
184 TDateTime dayDt = aDay.DateTime(); |
187 |
185 |
188 TTime nextDay = aDay + TTimeIntervalDays(1); |
186 TTime nextDay = aDay + TTimeIntervalDays(1); |
189 TDateTime nextDayDt = nextDay.DateTime(); |
187 TDateTime nextDayDt = nextDay.DateTime(); |
190 |
188 |