1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef OHOS_HDI_ASTMETHOD_H 10 #define OHOS_HDI_ASTMETHOD_H 11 12 #include <vector> 13 #include "ast/ast_node.h" 14 #include "ast/ast_parameter.h" 15 #include "util/autoptr.h" 16 #include "util/string.h" 17 18 namespace OHOS { 19 namespace HDI { 20 class ASTMethod : public ASTNode { 21 public: 22 SetName(const String & name)23 inline void SetName(const String& name) 24 { 25 name_ = name; 26 } 27 GetName()28 inline String GetName() 29 { 30 return name_; 31 } 32 SetOneWay(bool oneway)33 inline void SetOneWay(bool oneway) 34 { 35 isOneWay_ = oneway; 36 } 37 IsOneWay()38 inline bool IsOneWay() 39 { 40 return isOneWay_; 41 } 42 SetFull(bool full)43 inline void SetFull(bool full) 44 { 45 isFull_ = full; 46 } 47 IsFull()48 inline bool IsFull() 49 { 50 return isFull_; 51 } 52 SetLite(bool lite)53 inline void SetLite(bool lite) 54 { 55 isLite_ = lite; 56 } 57 IsLite()58 inline bool IsLite() 59 { 60 return isLite_; 61 } 62 63 void AddParameter(const AutoPtr<ASTParameter>& parameter); 64 65 AutoPtr<ASTParameter> GetParameter(size_t index); 66 GetParameterNumber()67 inline size_t GetParameterNumber() 68 { 69 return parameters_.size(); 70 } 71 72 String Dump(const String& prefix) override; 73 74 private: 75 String name_; 76 bool isOneWay_ = false; 77 bool isFull_ = false; 78 bool isLite_ = false; 79 80 std::vector<AutoPtr<ASTParameter>> parameters_; 81 }; 82 } // namespace HDI 83 } // namespace OHOS 84 85 #endif // OHOS_HDI_ASTMETHOD_H