• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "lexer/token.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     static bool CheckBasicType(Token token);
35 
36     static bool CheckUserDefType(Token token);
37 
38     static bool CheckMessageOption(std::string &messageOption);
39 
40 private:
41     bool CheckIntfSaAst();
42 
43     bool CheckIntfSaAstTypes();
44 
45     bool CheckIntfSaAstMethods();
46 
47     bool CheckIntfHdiAst();
48 
49     bool CheckIntfHdiAstFileType();
50 
51     bool CheckIntfHdiAstTypes();
52 
53     bool CheckIntfHdiAstParam(AutoPtr<ASTParameter> param, size_t methodIdx, size_t paramIdx);
54 
55     bool CheckInterfaceAst();
56 
57     bool CheckCallbackAst();
58 
59     bool CheckSmInterfaceAst();
60 
61     bool CheckIntfSmAstFileType();
62 
63     bool CheckIntfSmAstTypes();
64 
65     bool CheckIntfSmAst();
66 
67     AutoPtr<AST> ast_;
68 };
69 } // namespace Idl
70 } // namespace OHOS
71 
72 
73 #endif // OHOS_IDL_INTF_TYPE_CHECK_H