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 #ifndef OHOS_COMMON_PRINT_ANI_UTIL_H 16 #define OHOS_COMMON_PRINT_ANI_UTIL_H 17 18 #include <ani.h> 19 #include <string> 20 #include <vector> 21 namespace OHOS::Print { 22 ani_object CreateInt(ani_env *env, ani_int value); 23 ani_object CreateBoolean(ani_env *env, ani_boolean value); 24 ani_string CreateAniString(ani_env *env, const std::string &str); 25 ani_object CreateAniStringArray(ani_env *env, const std::vector<std::string>& strs); 26 ani_enum_item CreateEnumByIndex(ani_env *env, const std::string &enumDescriptor, ani_size enumIndex); 27 ani_object CreateEnumArray(ani_env *env, const std::string &enumDescriptor, std::vector<uint32_t> enumIndexArray); 28 ani_object CreateObject(ani_env *env, const char *signature, const char* className); 29 30 bool GetStdString(ani_env *env, ani_string str, std::string &res); 31 bool GetStdStringArray(ani_env *env, ani_object param, std::vector<std::string> &res); 32 bool GetEnumValueInt(ani_env *env, ani_enum_item enumObj, uint32_t& enumValue); 33 } // namespace OHOS::Print 34 #endif // OHOS_COMMON_PRINT_ANI_UTIL_H