• 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 void CopyBundleInfoNoReplication(int32_t flags, BundleInfo *des, BundleInfo src);
25     static bool SetBundleInfoBundleName(BundleInfo *bundleInfo, const char *bundleName);
26     static bool SetBundleInfoVendor(BundleInfo *bundleInfo, const char *vendor);
27     static bool SetBundleInfoLabel(BundleInfo *bundleInfo, const char *label);
28     static bool SetBundleInfoVersionName(BundleInfo *bundleInfo, const char *versionName);
29     static bool SetBundleInfoBigIconPath(BundleInfo *bundleInfo, const char *bigIconPath);
30     static bool SetBundleInfoCodePath(BundleInfo *bundleInfo, const char *codePath);
31     static bool SetBundleInfoDataPath(BundleInfo *bundleInfo, const char *dataPath);
32     static bool SetBundleInfoModuleInfos(BundleInfo *bundleInfo, const ModuleInfo *moduleInfos, uint32_t numOfModule);
33     static void ClearModuleInfos(ModuleInfo *moduleInfos, uint32_t numOfModule);
34     static void FreeBundleInfos(BundleInfo *bundleInfos, uint32_t len);
35     static void FreeBundleInfo(BundleInfo *bundleInfo);
36     static bool SetBundleInfoAppId(BundleInfo *bundleInfo, const char *appId);
37 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER
38     static bool SetBundleInfoAbilityInfos(BundleInfo *bundleInfo, const AbilityInfo *abilityInfos,
39         uint32_t numOfAbility);
40     static void ClearAbilityInfos(AbilityInfo *abilityInfos, uint32_t numOfAbility);
41 #else
42     static bool SetBundleInfoSmallIconPath(BundleInfo *bundleInfo, const char *smallIconPath);
43     static bool SetBundleInfoAbilityInfo(BundleInfo *bundleInfo, AbilityInfo abilityInfo);
44 #endif
45 private:
46     BundleInfoUtils() = default;
47     ~BundleInfoUtils() = default;
48 }; // BundleInfoUtils
49 } // OHOS
50 #endif // OHOS_BUNDLEINFO_UTILS_H