1 /* 2 * Copyright (c) 2024 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_IDL_INTF_TYPE_CHECK_H 17 #define OHOS_IDL_INTF_TYPE_CHECK_H 18 19 #include "ast/ast.h" 20 #include "ast/ast_parameter.h" 21 #include "util/light_refcount_base.h" 22 23 namespace OHOS { 24 namespace Idl { 25 26 class IntfTypeChecker { 27 public: IntfTypeChecker(AutoPtr<AST> ast)28 IntfTypeChecker(AutoPtr<AST> ast) : ast_(ast){}; 29 30 ~IntfTypeChecker() = default; 31 32 bool CheckIntegrity(); 33 34 private: 35 bool CheckIntfSaAst(); 36 37 bool CheckIntfSaAstTypes(); 38 39 bool CheckIntfSaAstMethods(); 40 41 bool CheckIntfHdiAst(); 42 43 bool CheckIntfHdiAstFileType(); 44 45 bool CheckIntfHdiAstTypes(); 46 47 bool CheckIntfHdiAstParam(AutoPtr<ASTParameter> param, size_t methodIdx, size_t paramIdx); 48 49 bool CheckInterfaceAst(); 50 51 bool CheckCallbackAst(); 52 53 bool CheckSmInterfaceAst(); 54 55 bool CheckIntfSmAstFileType(); 56 57 bool CheckIntfSmAstTypes(); 58 59 bool CheckIntfSmAst(); 60 61 AutoPtr<AST> ast_; 62 }; 63 } // namespace Idl 64 } // namespace OHOS 65 66 67 #endif // OHOS_IDL_INTF_TYPE_CHECK_H