• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef INTERFACES_CJ_INCLUDE_I18N_CALENDAR_IMPL_H_
17 #define INTERFACES_CJ_INCLUDE_I18N_CALENDAR_IMPL_H_
18 
19 #include <string>
20 #include <vector>
21 #include "i18n_struct.h"
22 #include "i18n_calendar.h"
23 #include "ffi_remote_data.h"
24 
25 namespace OHOS {
26 namespace Global {
27 namespace I18n {
28 class CCalendar : public OHOS::FFI::FFIData {
29     DECL_TYPE(CCalendar, FFIData)
30 public:
31     explicit CCalendar(std::string localeTag, CalendarType type);
32     ~CCalendar() = default;
33     void SetTime(double time);
34     void Set(int32_t year, int32_t month, int32_t date);
35     void Set(UCalendarDateFields field, int32_t value);
36     std::string GetTimeZone();
37     void SetTimeZone(std::string timezoneId);
38     int32_t Get(UCalendarDateFields field) const;
39     void Add(UCalendarDateFields field, int32_t amount);
40     void SetMinimalDaysInFirstWeek(int32_t value);
41     void SetFirstDayOfWeek(int32_t value);
42     UDate GetTimeInMillis(void);
43     int32_t GetMinimalDaysInFirstWeek(void);
44     int32_t GetFirstDayOfWeek(void);
45     bool IsWeekend(int64_t date, UErrorCode &status);
46     bool IsWeekend(void);
47     std::string GetDisplayName(std::string &displayLocaleTag);
48     int32_t CompareDays(UDate date);
49 
50 private:
51     std::unique_ptr<I18nCalendar> calendar_;
52 };
53 
54 }  // namespace I18n
55 }  // namespace Global
56 }  // namespace OHOS
57 
58 #endif  // INTERFACES_CJ_INCLUDE_I18N_CALENDAR_IMPL_H_
59