1 /*
2  * Copyright (c) 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 UDMF_UTD_CFGS_CHERCKER_H
17 #define UDMF_UTD_CFGS_CHERCKER_H
18 #include "utd_common.h"
19 #include "visibility.h"
20 namespace OHOS {
21 namespace UDMF {
22 class API_EXPORT UtdCfgsChecker {
23 public:
24     static UtdCfgsChecker &GetInstance();
25     bool CheckTypeDescriptors(CustomUtdCfgs &typeCfgs, const std::vector<TypeDescriptorCfg> &presetCfgs,
26         const std::vector<TypeDescriptorCfg> &customCfgs, const std::string &bundleName);
27     bool CheckBelongingToTypes(const std::vector<TypeDescriptorCfg> &typeCfgs,
28         const std::vector<TypeDescriptorCfg> &presetCfgs);
29 
30 private:
31     UtdCfgsChecker();
32     ~UtdCfgsChecker();
33     UtdCfgsChecker(const UtdCfgsChecker &obj) = delete;
34     UtdCfgsChecker &operator=(const UtdCfgsChecker &obj) = delete;
35     bool CheckTypesFormat(CustomUtdCfgs &typeCfgs, const std::string &bundleName);
36     bool CheckTypesRelation(CustomUtdCfgs &typeCfgs, const std::vector<TypeDescriptorCfg> &presetCfgs,
37         const std::vector<TypeDescriptorCfg> &customCfgs);
38     bool CanConstructDAG(CustomUtdCfgs &typeCfgs, const std::vector<TypeDescriptorCfg> &presetCfgs,
39         const std::vector<TypeDescriptorCfg> &customCfgs);
40 };
41 }
42 }
43 #endif // UDMF_UTD_CFGS_CHERCKER_H
44