1 /* 2 * Copyright (c) 2021 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_RESTOOL_FILE_MANAGER_H 17 #define OHOS_RESTOOL_FILE_MANAGER_H 18 19 #include <vector> 20 #include "resource_data.h" 21 #include "resource_item.h" 22 #include "singleton.h" 23 24 namespace OHOS { 25 namespace Global { 26 namespace Restool { 27 class FileManager : public Singleton<FileManager> { 28 public: 29 uint32_t ScanModules(const std::vector<std::string> &inputs, const std::string &output); GetResources()30 const std::map<int32_t, std::vector<ResourceItem>> &GetResources() const 31 { 32 return items_; 33 }; SetModuleName(const std::string & moduleName)34 void SetModuleName(const std::string &moduleName) 35 { 36 moduleName_ = moduleName; 37 }; 38 uint32_t MergeResourceItem(const std::map<int32_t, std::vector<ResourceItem>> &resourceInfos); 39 40 private: 41 uint32_t ScanModule(const std::string &input, const std::string &output, 42 std::map<ResType, std::vector<DirectoryInfo>> &resTypeOfDirs); 43 uint32_t ParseReference(const std::string &output); 44 45 // id, resource items 46 std::map<int32_t, std::vector<ResourceItem>> items_; 47 std::string moduleName_; 48 }; 49 } 50 } 51 } 52 #endif 53