• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 OHOS_GLOBAL_I18N_NUMBER_FORMAT_ADDON_H
17 #define OHOS_GLOBAL_I18N_NUMBER_FORMAT_ADDON_H
18 
19 #include "ani.h"
20 #include "number_format.h"
21 
22 namespace OHOS {
23 namespace Global {
24 namespace I18n {
25 class NumberFormatAddon {
26 public:
27     static NumberFormatAddon* UnwrapAddon(ani_env *env, ani_object object, const std::string &name);
28     static ani_string NumberFormat_Format(ani_env *env, ani_object object, ani_double number);
29     static ani_string NumberFormat_FormatRange(ani_env *env, ani_object object,
30         ani_double startRange, ani_double endRange);
31     static ani_object NumberFormat_ResolvedOptions(ani_env *env, ani_object object);
32     static ani_object NumberFormat_Create(ani_env *env, [[maybe_unused]] ani_object object);
33     static ani_object NumberFormat_CreateWithParam(ani_env *env, [[maybe_unused]] ani_object object,
34         ani_object locale, ani_object options);
35     static ani_status BindContext_NumberFormat(ani_env *env);
CopyNumberFormat()36     std::shared_ptr<NumberFormat> CopyNumberFormat()
37     {
38         return numberfmt_;
39     }
40 private:
41     std::shared_ptr<NumberFormat> numberfmt_ = nullptr;
42 };
43 } // namespace I18n
44 } // namespace Global
45 } // namespace OHOS
46 #endif
47