1 /* 2 * Copyright (c) 2020-2023 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_ABILITYINFO_UTILS_H 17 #define OHOS_ABILITYINFO_UTILS_H 18 19 #include "ability_info.h" 20 #ifdef _MINI_BMS_PARSE_METADATA_ 21 #include "bundle_common.h" 22 #endif 23 24 namespace OHOS { 25 struct AbilityInfoUtils { 26 static void CopyAbilityInfo(AbilityInfo *des, AbilityInfo src); 27 #ifdef _MINI_BMS_PARSE_METADATA_ 28 static void CopyBundleProfileToAbilityInfo(AbilityInfo *des, const BundleProfile &src); 29 #endif 30 static bool SetAbilityInfoBundleName(AbilityInfo *abilityInfo, const char *bundleName); 31 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 32 static bool SetAbilityInfoModuleName(AbilityInfo *abilityInfo, const char *moduleName); 33 static bool SetAbilityInfoName(AbilityInfo *abilityInfo, const char *name); 34 static bool SetAbilityInfoDescription(AbilityInfo *abilityInfo, const char *description); 35 static bool SetAbilityInfoIconPath(AbilityInfo *abilityInfo, const char *iconPath); 36 static bool SetAbilityInfoDeviceId(AbilityInfo *abilityInfo, const char *deviceId); 37 static bool SetAbilityInfoLabel(AbilityInfo *abilityInfo, const char *label); 38 #else 39 static bool SetAbilityInfoSrcPath(AbilityInfo *abilityInfo, const char *srcPath); 40 static bool SetAbilityInfoMetaData(AbilityInfo *abilityInfo, MetaData **metaData, uint32_t numOfMetaData); 41 static bool SetAbilityInfoSkill(AbilityInfo *abilityInfo, Skill * const skills[]); 42 static void ClearStringArray(char *array[], int count); 43 static void CopyStringArray(char *dst[], char * const src[], int count); 44 static void ClearExtendedInfo(AbilityInfo *abilityInfo); 45 static void ClearAbilityInfoMetaData(MetaData **metaData, uint32_t numOfMetaData); 46 #endif 47 private: 48 AbilityInfoUtils() = default; 49 ~AbilityInfoUtils() = default; 50 }; // AbilityInfoUtils 51 } // OHOS 52 #endif // OHOS_ABILITYINFO_UTILS_H