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 |
|
30 |
25 |
31 |
26 |
32 // --------------------------------------------------------- |
27 // --------------------------------------------------------- |
33 // CCalenCalanderConverter::CalculateCelestialIndex |
28 // CCalenCalanderConverter::CalculateCelestialIndex |
34 // Calculates a Heavenly stem's index and a Terrestrial branch's index |
29 // Calculates a Heavenly stem's index and a Terrestrial branch's index |
58 else |
54 else |
59 { |
55 { |
60 aTerrestrialIndex--; |
56 aTerrestrialIndex--; |
61 } |
57 } |
62 |
58 |
63 OstTraceFunctionExit0( _CELESTIALINDEX_EXIT ); |
59 TRACE_EXIT_POINT; |
64 } |
60 } |
65 |
61 |
66 // ----------------------------------------------------------------------------- |
62 // ----------------------------------------------------------------------------- |
67 // CCalenCalanderConverter::ChineseFestival |
63 // CCalenCalanderConverter::ChineseFestival |
68 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
69 // |
65 // |
70 static TCalenLunarInfo::TFestival ChineseFestival( |
66 static TCalenLunarInfo::TFestival ChineseFestival( |
71 const TChineseDate& aChineseDate, |
67 const TChineseDate& aChineseDate, |
72 const TChineseDate& aNextDate) |
68 const TChineseDate& aNextDate) |
73 { |
69 { |
74 OstTraceFunctionEntry0( _CHINESEFESTIVAL_ENTRY ); |
70 TRACE_ENTRY_POINT; |
|
71 |
75 TCalenLunarInfo::TFestival index = TCalenLunarInfo::ENoFestival; |
72 TCalenLunarInfo::TFestival index = TCalenLunarInfo::ENoFestival; |
76 |
73 |
77 if (!aChineseDate.iLeapMonth) |
74 if (!aChineseDate.iLeapMonth) |
78 { |
75 { |
79 if (aChineseDate.iMonth == 1 && aChineseDate.iDay == 1) |
76 if (aChineseDate.iMonth == 1 && aChineseDate.iDay == 1) |
117 aNextDate.iMonth == 1 && aNextDate.iDay == 1) |
114 aNextDate.iMonth == 1 && aNextDate.iDay == 1) |
118 { |
115 { |
119 index = TCalenLunarInfo::EFestivalNewYearEve; |
116 index = TCalenLunarInfo::EFestivalNewYearEve; |
120 } |
117 } |
121 |
118 |
122 OstTraceFunctionExit0( _CHINESEFESTIVAL_EXIT ); |
119 TRACE_EXIT_POINT; |
123 return index; |
120 return index; |
124 } |
121 } |
125 |
122 |
126 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
127 // CCalenLunarInfoProvider::NewL |
124 // CCalenLunarInfoProvider::NewL |
128 // ----------------------------------------------------------------------------- |
125 // ----------------------------------------------------------------------------- |
129 // |
126 // |
130 EXPORT_C CCalenLunarInfoProvider* CCalenLunarInfoProvider::NewL(RFs& aFs) |
127 EXPORT_C CCalenLunarInfoProvider* CCalenLunarInfoProvider::NewL(RFs& aFs) |
131 { |
128 { |
132 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_NEWL_ENTRY ); |
129 TRACE_ENTRY_POINT; |
|
130 |
133 CCalenLunarInfoProvider* self = new (ELeave) CCalenLunarInfoProvider(); |
131 CCalenLunarInfoProvider* self = new (ELeave) CCalenLunarInfoProvider(); |
134 CleanupStack::PushL(self); |
132 CleanupStack::PushL(self); |
135 self->ConstructL(aFs); |
133 self->ConstructL(aFs); |
136 CleanupStack::Pop(self); |
134 CleanupStack::Pop(self); |
137 |
135 |
138 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_NEWL_EXIT ); |
136 TRACE_EXIT_POINT; |
139 return self; |
137 return self; |
140 } |
138 } |
141 |
139 |
142 // ----------------------------------------------------------------------------- |
140 // ----------------------------------------------------------------------------- |
143 // CCalenLunarInfoProvider::~CCalenLunarInfoProvider |
141 // CCalenLunarInfoProvider::~CCalenLunarInfoProvider |
144 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
145 // |
143 // |
146 EXPORT_C CCalenLunarInfoProvider::~CCalenLunarInfoProvider() |
144 EXPORT_C CCalenLunarInfoProvider::~CCalenLunarInfoProvider() |
147 { |
145 { |
148 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_ENTRY ); |
146 TRACE_ENTRY_POINT; |
|
147 |
149 delete iSolarTerms; |
148 delete iSolarTerms; |
150 delete iConverter; |
149 delete iConverter; |
151 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_EXIT ); |
150 |
|
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 OstTraceFunctionEntry0( DUP1_CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_ENTRY ); |
160 TRACE_ENTRY_POINT; |
161 OstTraceFunctionExit0( DUP1_CCALENLUNARINFOPROVIDER_CCALENLUNARINFOPROVIDER_EXIT ); |
161 TRACE_EXIT_POINT; |
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 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_CONSTRUCTL_ENTRY ); |
170 TRACE_ENTRY_POINT; |
171 |
171 |
172 iConverter = CChineseCalendarConverter::NewL(); |
172 iConverter = CChineseCalendarConverter::NewL(); |
173 iSolarTerms = CCalenSolarTerms::NewL(aFs); |
173 iSolarTerms = CCalenSolarTerms::NewL(aFs); |
174 OstTraceFunctionExit0( CCALENLUNARINFOPROVIDER_CONSTRUCTL_EXIT ); |
174 |
|
175 TRACE_EXIT_POINT; |
175 } |
176 } |
176 |
177 |
177 // ----------------------------------------------------------------------------- |
178 // ----------------------------------------------------------------------------- |
178 // CCalenLunarInfoProvider::GetLunarInfoL |
179 // CCalenLunarInfoProvider::GetLunarInfoL |
179 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
180 // |
181 // |
181 EXPORT_C TCalenLunarInfo CCalenLunarInfoProvider::GetLunarInfoL( const TTime& aDay ) |
182 EXPORT_C TCalenLunarInfo CCalenLunarInfoProvider::GetLunarInfoL( const TTime& aDay ) |
182 { |
183 { |
183 OstTraceFunctionEntry0( CCALENLUNARINFOPROVIDER_GETLUNARINFOL_ENTRY ); |
184 TRACE_ENTRY_POINT; |
|
185 |
184 TDateTime dayDt = aDay.DateTime(); |
186 TDateTime dayDt = aDay.DateTime(); |
185 |
187 |
186 TTime nextDay = aDay + TTimeIntervalDays(1); |
188 TTime nextDay = aDay + TTimeIntervalDays(1); |
187 TDateTime nextDayDt = nextDay.DateTime(); |
189 TDateTime nextDayDt = nextDay.DateTime(); |
188 |
190 |