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