1 /* 2 * Copyright (c) 2022 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_ASTPARAMETER_H 17 #define OHOS_IDL_ASTPARAMETER_H 18 19 #include "ast/ast_node.h" 20 #include "ast/ast_type.h" 21 #include "util/autoptr.h" 22 #include "util/string.h" 23 24 namespace OHOS { 25 namespace Idl { 26 class ASTParameter : public ASTNode { 27 public: SetName(const String & name)28 void SetName(const String& name) 29 { 30 name_ = name; 31 } 32 GetName()33 String GetName() 34 { 35 return name_; 36 } 37 SetType(ASTType * type)38 void SetType(ASTType* type) 39 { 40 type_ = type; 41 } 42 GetType()43 AutoPtr<ASTType> GetType() 44 { 45 return type_; 46 } 47 SetInParameter(bool inParameter)48 void SetInParameter(bool inParameter) 49 { 50 isInParameter_ = inParameter; 51 } 52 IsInParameter()53 bool IsInParameter() 54 { 55 return isInParameter_; 56 } 57 SetOutParameter(bool outParameter)58 void SetOutParameter(bool outParameter) 59 { 60 isOutParameter_ = outParameter; 61 } 62 IsOutParameter()63 bool IsOutParameter() 64 { 65 return isOutParameter_; 66 } 67 68 String Dump(const String& prefix) override; 69 70 private: 71 String name_; 72 AutoPtr<ASTType> type_; 73 bool isInParameter_ = false; 74 bool isOutParameter_ = false; 75 }; 76 } // namespace Idl 77 } // namespace OHOS 78 #endif // OHOS_IDL_ASTPARAMETER_H 79