• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RESOURCE_MODULE_H
17 #define OHOS_RESTOOL_RESOURCE_MODULE_H
18 
19 #include "resource_item.h"
20 #include "resource_directory.h"
21 
22 namespace OHOS {
23 namespace Global {
24 namespace Restool {
25 class ResourceModule {
26 public:
27     ResourceModule(const std::string &modulePath, const std::string &moduleOutput, const std::string &moduleName);
~ResourceModule()28     virtual ~ResourceModule() {};
29     uint32_t ScanResource();
30     const std::map<int32_t, std::vector<ResourceItem>> &GetOwner() const;
31     const std::map<ResType, std::vector<DirectoryInfo>> &GetScanDirectorys() const;
32     static uint32_t MergeResourceItem(std::map<int32_t, std::vector<ResourceItem>> &alls,
33         const std::map<int32_t, std::vector<ResourceItem>> &other, bool tipError = false);
SetPreviewMode(bool enable)34     void SetPreviewMode(bool enable)
35     {
36         previewMode_ = enable;
37     };
38 
39 protected:
40     const std::string &modulePath_;
41     const std::string &moduleOutput_;
42     const std::string &moduleName_;
43     std::map<int32_t, std::vector<ResourceItem>> owner_;
44     std::map<ResType, std::vector<DirectoryInfo>> scanDirs_;
45     bool previewMode_ = false;
46 private:
47     void Push(const std::map<int32_t, std::vector<ResourceItem>> &other);
48     static const std::vector<ResType> SCAN_SEQ;
49 };
50 }
51 }
52 }
53 #endif