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 public: 52 std::string GetJSonSource(std::string_view jsonFromRealWorld, std::any option); 53 54 public: 55 /** 56 * @brief 构造方法,具备T(Json::Value&, std::any)能力的构造函数 57 * 58 * @param obj Json对象引用 59 * @param option 任意类型对象 60 */ BJsonEntity(obj,option)61 explicit BJsonEntityExtensionConfig(Json::Value &obj, std::any option = std::any()) : BJsonEntity(obj, option) {} 62 }; 63 } // namespace OHOS::FileManagement::Backup 64 65 #endif // OHOS_FILEMGMT_BACKUP_B_JSON_ENTITY_EXTENSION_CONFIG_H