• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 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 #include "b_jsonutil_mock.h"
17 
18 namespace OHOS::FileManagement::Backup {
19 using namespace std;
20 
ParseBundleNameIndexStr(const std::string & bundleNameStr)21 BJsonUtil::BundleDetailInfo BJsonUtil::ParseBundleNameIndexStr(const std::string &bundleNameStr)
22 {
23     return BBJsonUtil::jsonUtil->ParseBundleNameIndexStr(bundleNameStr);
24 }
25 
BuildBundleInfos(const std::vector<std::string> & bundleNames,const std::vector<std::string> & bundleInfos,std::vector<std::string> & bundleNamesOnly,int32_t userId,std::map<std::string,bool> & isClearDataFlags)26 std::map<std::string, std::vector<BJsonUtil::BundleDetailInfo>> BJsonUtil::BuildBundleInfos(
27     const std::vector<std::string> &bundleNames, const std::vector<std::string> &bundleInfos,
28     std::vector<std::string> &bundleNamesOnly, int32_t userId,
29     std::map<std::string, bool> &isClearDataFlags)
30 {
31     return BBJsonUtil::jsonUtil->BuildBundleInfos(bundleNames, bundleInfos, bundleNamesOnly, userId, isClearDataFlags);
32 }
33 
ParseBundleInfoJson(const std::string & bundleInfo,std::vector<BundleDetailInfo> & bundleDetails,BJsonUtil::BundleDetailInfo bundleDetailInfo,bool & isClearData,int32_t userId)34 void BJsonUtil::ParseBundleInfoJson(const std::string &bundleInfo, std::vector<BundleDetailInfo> &bundleDetails,
35     BJsonUtil::BundleDetailInfo bundleDetailInfo, bool &isClearData, int32_t userId)
36 {
37     BBJsonUtil::jsonUtil->ParseBundleInfoJson(bundleInfo, bundleDetails, bundleDetailInfo, isClearData, userId);
38 }
39 
FindBundleInfoByName(std::map<std::string,std::vector<BundleDetailInfo>> & bundleNameDetailsMap,std::string & bundleName,const std::string & jobType,BundleDetailInfo & bundleDetail)40 bool BJsonUtil::FindBundleInfoByName(std::map<std::string, std::vector<BundleDetailInfo>> &bundleNameDetailsMap,
41     std::string &bundleName, const std::string &jobType, BundleDetailInfo &bundleDetail)
42 {
43     return BBJsonUtil::jsonUtil->FindBundleInfoByName(bundleNameDetailsMap, bundleName, jobType, bundleDetail);
44 }
45 
BuildExtensionErrInfo(std::string & jsonStr,int errCode,std::string errMsg)46 bool BJsonUtil::BuildExtensionErrInfo(std::string &jsonStr, int errCode, std::string errMsg)
47 {
48     return BBJsonUtil::jsonUtil->BuildExtensionErrInfo(jsonStr, errCode, errMsg);
49 }
50 
BuildBundleNameIndexInfo(const std::string & bundleName,int appIndex)51 std::string BJsonUtil::BuildBundleNameIndexInfo(const std::string &bundleName, int appIndex)
52 {
53     return BBJsonUtil::jsonUtil->BuildBundleNameIndexInfo(bundleName, appIndex);
54 }
55 
BuildExtensionErrInfo(std::string & jsonStr,std::map<std::string,std::vector<int>> errFileInfo)56 bool BJsonUtil::BuildExtensionErrInfo(std::string &jsonStr, std::map<std::string, std::vector<int>> errFileInfo)
57 {
58     return BBJsonUtil::jsonUtil->BuildExtensionErrInfo(jsonStr, errFileInfo);
59 }
60 
BuildOnProcessRetInfo(std::string & jsonStr,std::string onProcessRet)61 bool BJsonUtil::BuildOnProcessRetInfo(std::string &jsonStr, std::string onProcessRet)
62 {
63     return BBJsonUtil::jsonUtil->BuildOnProcessRetInfo(jsonStr, onProcessRet);
64 }
65 
BuildOnProcessErrInfo(std::string & reportInfo,std::string path,int err)66 bool BJsonUtil::BuildOnProcessErrInfo(std::string &reportInfo, std::string path, int err)
67 {
68     return BBJsonUtil::jsonUtil->BuildOnProcessErrInfo(reportInfo, path, err);
69 }
70 
BuildBundleInfoJson(int32_t userId,string & detailInfo)71 bool BJsonUtil::BuildBundleInfoJson(int32_t userId, string &detailInfo)
72 {
73     return BBJsonUtil::jsonUtil->BuildBundleInfoJson(userId, detailInfo);
74 }
75 
BuildInitSessionErrInfo(int32_t userId,string callerName,string activeTime)76 std::string BJsonUtil::BuildInitSessionErrInfo(int32_t userId, string callerName, string activeTime)
77 {
78     return BBJsonUtil::jsonUtil->BuildInitSessionErrInfo(userId, callerName, activeTime);
79 }
80 
WriteToStr(std::vector<BundleDataSize> & bundleDataList,size_t listSize,std::string scanning,std::string & jsonStr)81 bool BJsonUtil::WriteToStr(std::vector<BundleDataSize> &bundleDataList, size_t listSize, std::string scanning,
82     std::string &jsonStr)
83 {
84     return BBJsonUtil::jsonUtil->WriteToStr(bundleDataList, listSize, scanning, jsonStr);
85 }
86 }