• 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_BUNDLE_INFO_CREATOR_H
17 #define OHOS_BUNDLE_INFO_CREATOR_H
18 
19 #include <string>
20 
21 #include "bundle_common.h"
22 #include "bundle_info.h"
23 
24 namespace OHOS {
25 class BundleInfoCreator {
26 public:
27     BundleInfoCreator() = default;
28     ~BundleInfoCreator() = default;
29 
30     static BundleInfo *CreateBundleInfo(const BundleProfile &bundleProfile, const std::string &installDirPath,
31         const std::string &dataDirPath, const BundleRes &bundleRes);
32     static uint8_t SaveBundleInfo(const BundleProfile &bundleProfile, BundleInfo **bundleInfo);
33 private:
34     static bool SetBundleInfo(const BundleProfile &bundleProfile, const std::string &installDirPath,
35         const std::string &dataDirPath, BundleInfo *bundleInfo);
36     static bool SetModuleInfos(const BundleProfile &bundleProfile, BundleInfo *bundleInfo);
37     static bool SetAbilityInfos(const BundleProfile &bundleProfile, const std::string &codePath,
38         BundleInfo *bundleInfo);
39     static bool SetAbilityInfo(const BundleProfile &bundleProfile, const std::string &codePath,
40         BundleInfo *bundleInfo, uint32_t index);
41 }; // namespace OHOS
42 }
43 #endif  // OHOS_BUNDLE_INFO_CREATOR_H