1 /* 2 * Copyright (c) 2022-2023 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_ENTITY_EXTENSION_CONFIG_H 17 #define OHOS_FILEMGMT_BACKUP_B_JSON_ENTITY_EXTENSION_CONFIG_H 18 19 #include <string> 20 #include <vector> 21 22 #include "b_json/b_json_cached_entity.h" 23 #include "json/json.h" 24 25 namespace OHOS::FileManagement::Backup { 26 class BJsonEntityExtensionConfig : public BJsonEntity { 27 public: 28 /** 29 * @brief 从JSon对象中通过includes字段获取待备份目录模式串清单 30 * 31 * @return 待备份目录模式串清单 32 * @note 如果用户没有配置该字段,则返回默认打包目录{@link BConstants::PATHES_TO_BACKUP} 33 * @note 如果用户配置了空数组,则返回""表示生成空打包文件 34 */ 35 std::vector<std::string> GetIncludes() const; 36 37 /** 38 * @brief 从JSon对象中获取排除目录列表 39 * 40 * @return 排除目录 41 */ 42 std::vector<std::string> GetExcludes() const; 43 44 /** 45 * @brief 从JSon对象中获取备份恢复权限 46 * 47 * @return 备份权限 48 */ 49 bool GetAllowToBackupRestore() const; 50 51 /** 52 * @brief 从JSon对象中获取备份标志 53 * 54 * @return 备份标志: 是否恢复到根目录进行覆盖 55 */ 56 bool GetFullBackupOnly() const; 57 58 /** 59 * @brief 从JSon对象中获取应用依赖项 60 * 61 * @return 应用依赖项: 该应用恢复依赖的应用 62 */ 63 std::string GetRestoreDeps() const; 64 65 /** 66 * @brief Get the Support Scene object 67 * 68 * @return std::string 69 */ 70 std::string GetSupportScene() const; 71 72 /** 73 * @brief Get the ExtraInfo object 74 * 75 * @return Json::Value 76 */ 77 Json::Value GetExtraInfo() const; 78 79 public: 80 std::string GetJSonSource(std::string_view jsonFromRealWorld, std::any option); 81 82 public: 83 /** 84 * @brief 构造方法,具备T(Json::Value&, std::any)能力的构造函数 85 * 86 * @param obj Json对象引用 87 * @param option 任意类型对象 88 */ 89 explicit BJsonEntityExtensionConfig(Json::Value &obj, std::any option = std::any()) : BJsonEntity(obj, option) {} 90 }; 91 } // namespace OHOS::FileManagement::Backup 92 93 #endif // OHOS_FILEMGMT_BACKUP_B_JSON_ENTITY_EXTENSION_CONFIG_H 94