1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "i18n_holiday_impl.h"
17 #include <string>
18 #include <vector>
19 #include "i18n_hilog.h"
20
21 namespace OHOS {
22 namespace Global {
23 namespace I18n {
CHolidayManager(char * icsPath)24 CHolidayManager::CHolidayManager(char* icsPath)
25 {
26 holidayManager_ = std::make_unique<HolidayManager>(icsPath);
27 if (holidayManager_ == nullptr) {
28 HILOG_ERROR_I18N("Create HolidayManager fail");
29 }
30 }
31
getHolidayInfoItemArray(int32_t year)32 std::vector<HolidayInfoItem> CHolidayManager::getHolidayInfoItemArray(int32_t year)
33 {
34 std::vector<HolidayInfoItem> itemList = holidayManager_->GetHolidayInfoItemArray(year);
35 return itemList;
36 }
37
getHolidayInfoItemArray()38 std::vector<HolidayInfoItem> CHolidayManager::getHolidayInfoItemArray()
39 {
40 std::vector<HolidayInfoItem> itemList = holidayManager_->GetHolidayInfoItemArray();
41 return itemList;
42 }
43
isHoliday()44 bool CHolidayManager::isHoliday()
45 {
46 return holidayManager_->IsHoliday();
47 }
48
isHoliday(int32_t year,int32_t month,int32_t day)49 bool CHolidayManager::isHoliday(int32_t year, int32_t month, int32_t day)
50 {
51 return holidayManager_->IsHoliday(year, month, day);
52 }
53 } // namespace I18n
54 } // namespace Global
55 } // namespace OHOS