1 /* 2 * Copyright (c) 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 #ifndef OHOS_FILEMGMT_BACKUP_B_JSON_SERVICE_DISPOSAL_CONFIG_H 17 #define OHOS_FILEMGMT_BACKUP_B_JSON_SERVICE_DISPOSAL_CONFIG_H 18 19 #include <iostream> 20 #include <fstream> 21 #include <string> 22 #include <vector> 23 24 #include "filemgmt_libhilog.h" 25 26 namespace OHOS::FileManagement::Backup { 27 class BJsonDisposalConfig { 28 public: 29 /** 30 * @brief 判断配置文件中是否存在bundlename 31 * 32 * @param bundlename 33 */ 34 bool IfBundleNameInDisposalConfigFile(const std::string& bundleName); 35 36 /** 37 * @brief 配置文件中写入bundlename 38 * 39 * @param bundlename 40 */ 41 bool AppendIntoDisposalConfigFile(const std::string& bundleName); 42 43 /** 44 * @brief 配置文件中删除bundlename 45 * 46 * @param bundlename 47 */ 48 bool DeleteFromDisposalConfigFile(const std::string& bundleName); 49 50 /** 51 * @brief 配置文件中获取bundlename 52 * 53 * 54 */ 55 std::vector<std::string> GetBundleNameFromConfigFile(); 56 57 /** 58 * @brief 删除配置文件 59 * 60 * 61 */ 62 bool DeleteConfigFile(); 63 public: 64 /** 65 * @brief 构造方法 66 * 67 * 68 */ 69 BJsonDisposalConfig(); 70 71 private: 72 std::mutex fileMutex_; 73 }; 74 } // namespace OHOS::FileManagement::Backup 75 #endif // OHOS_FILEMGMT_BACKUP_B_JSON_SERVICE_DISPOSAL_CONFIG_H