• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 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_BUNDLEINFO_UTILS_H
17 #define OHOS_BUNDLEINFO_UTILS_H
18 
19 #include "bundle_info.h"
20 
21 namespace OHOS {
22 struct BundleInfoUtils {
23     static void CopyBundleInfo(int32_t flags, BundleInfo *des, BundleInfo src);
24     static bool SetBundleInfoBundleName(BundleInfo *bundleInfo, const char *bundleName);
25     static bool SetBundleInfoVendor(BundleInfo *bundleInfo, const char *vendor);
26     static bool SetBundleInfoLabel(BundleInfo *bundleInfo, const char *label);
27     static bool SetBundleInfoVersionName(BundleInfo *bundleInfo, const char *versionName);
28     static bool SetBundleInfoBigIconPath(BundleInfo *bundleInfo, const char *bigIconPath);
29     static bool SetBundleInfoCodePath(BundleInfo *bundleInfo, const char *codePath);
30     static bool SetBundleInfoDataPath(BundleInfo *bundleInfo, const char *dataPath);
31     static bool SetBundleInfoModuleInfos(BundleInfo *bundleInfo, const ModuleInfo *moduleInfos, uint32_t numOfModule);
32     static void ClearModuleInfos(ModuleInfo *moduleInfos, uint32_t numOfModule);
33     static void FreeBundleInfos(BundleInfo *bundleInfos, uint32_t len);
34     static void FreeBundleInfo(BundleInfo *bundleInfo);
35     static bool SetBundleInfoAppId(BundleInfo *bundleInfo, const char *appId);
36 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
37     static bool SetBundleInfoAbilityInfos(BundleInfo *bundleInfo, const AbilityInfo *abilityInfos,
38         uint32_t numOfAbility);
39     static void ClearAbilityInfos(AbilityInfo *abilityInfos, uint32_t numOfAbility);
40 #else
41     static bool SetBundleInfoSmallIconPath(BundleInfo *bundleInfo, const char *smallIconPath);
42     static bool SetBundleInfoAbilityInfo(BundleInfo *bundleInfo, AbilityInfo abilityInfo);
43 #endif
44 private:
45     BundleInfoUtils() = default;
46     ~BundleInfoUtils() = default;
47 }; // BundleInfoUtils
48 } // OHOS
49 #endif // OHOS_BUNDLEINFO_UTILS_H