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_ASTPARAMETER_H
17#define OHOS_IDL_ASTPARAMETER_H
18
19#include "ast/ast_attribute.h"
20#include "ast/ast_node.h"
21#include "ast/ast_type.h"
22#include "util/autoptr.h"
23
24namespace OHOS {
25namespace Idl {
26class ASTParameter : public ASTNode {
27public:
28    ASTParameter(const std::string &name, ASTParamAttr::ParamAttr attribute, const AutoPtr<ASTType> &type)
29        : ASTNode(), name_(name), attr_(new ASTParamAttr(attribute)), type_(type)
30    {
31    }
32
33    ASTParameter(const std::string &name, const AutoPtr<ASTParamAttr> &attribute, const AutoPtr<ASTType> &type)
34        : ASTNode(), name_(name), attr_(attribute), type_(type)
35    {
36    }
37
38    inline std::string GetName()
39    {
40        return name_;
41    }
42
43    inline AutoPtr<ASTType> GetType()
44    {
45        return type_;
46    }
47
48    inline ASTParamAttr::ParamAttr GetAttribute()
49    {
50        return attr_->value_;
51    }
52
53    std::string Dump(const std::string &prefix) override;
54
55private:
56    std::string name_;
57    AutoPtr<ASTParamAttr> attr_;
58    AutoPtr<ASTType> type_;
59};
60} // namespace Idl
61} // namespace OHOS
62
63#endif // OHOS_IDL_ASTPARAMETER_H