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_EXT_MANAGE_H 17 #define OHOS_FILEMGMT_BACKUP_B_JSON_ENTITY_EXT_MANAGE_H 18 19 #include <map> 20 #include <set> 21 #include <string> 22 #include <sys/stat.h> 23 24 #include "b_json/b_json_cached_entity.h" 25 #include "json/json.h" 26 27 namespace OHOS::FileManagement::Backup { 28 class BJsonEntityExtManage : public BJsonEntity { 29 public: 30 /** 31 * @brief 设置索引文件 32 * 33 * @param info std::map<string, pair<string, struct stat>> 34 */ 35 void SetExtManage(const map<string, pair<string, struct stat>> &info) const; 36 37 /** 38 * @brief 获取索引文件 39 * 40 * @return std::set<std::string> 41 */ 42 std::set<std::string> GetExtManage() const; 43 44 /** 45 * @brief 获取索引文件及详细信息 46 * 47 * @return map<string, pair<string, struct stat>> 48 */ 49 std::map<std::string, std::pair<std::string, struct stat>> GetExtManageInfo() const; 50 51 /** 52 * @brief Set the hard link Information 53 * 54 * @param origin 原始文件名 55 * @param hardLinks 硬链接文件名 56 * @return true 设置成功 57 * @return false 设置失败 58 */ 59 bool SetHardLinkInfo(const std::string origin, const std::set<std::string> hardLinks); 60 61 /** 62 * @brief Get the hard link Information 63 * 64 * @param origin 原始文件名 65 * @return const 硬链接集合 66 */ 67 const std::set<std::string> GetHardLinkInfo(const string origin); 68 69 public: 70 /** 71 * @brief 构造方法,具备T(Json::Value&, std::any)能力的构造函数 72 * 73 * @param obj Json对象引用 74 * @param option 任意类型对象 75 */ BJsonEntity(obj,option)76 explicit BJsonEntityExtManage(Json::Value &obj, std::any option = std::any()) : BJsonEntity(obj, option) {} 77 }; 78 } // namespace OHOS::FileManagement::Backup 79 80 #endif // OHOS_FILEMGMT_BACKUP_B_JSON_ENTITY_EXT_MANAGE_H