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#include "resource_util.h"
22
23namespace OHOS {
24namespace Global {
25namespace Restool {
26class ResourceModule {
27public:
28    ResourceModule(const std::string &modulePath, const std::string &moduleOutput, const std::string &moduleName);
29    virtual ~ResourceModule() {};
30    uint32_t ScanResource();
31    const std::map<int64_t, std::vector<ResourceItem>> &GetOwner() const;
32    const std::map<ResType, std::vector<DirectoryInfo>> &GetScanDirectorys() const;
33    static uint32_t MergeResourceItem(std::map<int64_t, std::vector<ResourceItem>> &alls,
34        const std::map<int64_t, std::vector<ResourceItem>> &other, bool tipError = false);
35
36protected:
37    const std::string &modulePath_;
38    const std::string &moduleOutput_;
39    const std::string &moduleName_;
40    std::map<int64_t, std::vector<ResourceItem>> owner_;
41    std::map<ResType, std::vector<DirectoryInfo>> scanDirs_;
42private:
43    void Push(const std::map<int64_t, std::vector<ResourceItem>> &other);
44    static const std::vector<ResType> SCAN_SEQ;
45};
46}
47}
48}
49#endif