1fb299fa2Sopenharmony_ci/*
2fb299fa2Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3fb299fa2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb299fa2Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb299fa2Sopenharmony_ci * You may obtain a copy of the License at
6fb299fa2Sopenharmony_ci *
7fb299fa2Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
8fb299fa2Sopenharmony_ci *
9fb299fa2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb299fa2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb299fa2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb299fa2Sopenharmony_ci * See the License for the specific language governing permissions and
13fb299fa2Sopenharmony_ci * limitations under the License.
14fb299fa2Sopenharmony_ci */
15fb299fa2Sopenharmony_ci#ifndef USCRIPT_PARAM_H
16fb299fa2Sopenharmony_ci#define USCRIPT_PARAM_H
17fb299fa2Sopenharmony_ci
18fb299fa2Sopenharmony_ci#include <cstdint>
19fb299fa2Sopenharmony_ci#include <string>
20fb299fa2Sopenharmony_ci#include <vector>
21fb299fa2Sopenharmony_ci#include "script_context.h"
22fb299fa2Sopenharmony_ci
23fb299fa2Sopenharmony_cinamespace Uscript {
24fb299fa2Sopenharmony_ci/**
25fb299fa2Sopenharmony_ci * 定义函数的参数,使用vector保存函数参数
26fb299fa2Sopenharmony_ci * 在定义函数时,实参,对应标识符表达式
27fb299fa2Sopenharmony_ci * 函数调用时,可能是标识符,也可能是字符串、整数、浮点数或者函数调用
28fb299fa2Sopenharmony_ci */
29fb299fa2Sopenharmony_ciclass UScriptExpression;
30fb299fa2Sopenharmony_ci
31fb299fa2Sopenharmony_ciclass ScriptParams {
32fb299fa2Sopenharmony_cipublic:
33fb299fa2Sopenharmony_ci    friend class ScriptFunction;
34fb299fa2Sopenharmony_ci    static const int32_t g_maxParamNumber = 5;
35fb299fa2Sopenharmony_ci
36fb299fa2Sopenharmony_ci    ScriptParams() {}
37fb299fa2Sopenharmony_ci    ~ScriptParams();
38fb299fa2Sopenharmony_ci    void AddParams(UScriptExpression *expression);
39fb299fa2Sopenharmony_ci    const std::vector<UScriptExpression*> GetParams() const
40fb299fa2Sopenharmony_ci    {
41fb299fa2Sopenharmony_ci        return expressionList_;
42fb299fa2Sopenharmony_ci    }
43fb299fa2Sopenharmony_ci
44fb299fa2Sopenharmony_ci    static ScriptParams* CreateParams(UScriptExpression *expression);
45fb299fa2Sopenharmony_ci    static ScriptParams* AddParams(ScriptParams *params, UScriptExpression *expression);
46fb299fa2Sopenharmony_ci
47fb299fa2Sopenharmony_ciprivate:
48fb299fa2Sopenharmony_ci    std::vector<UScriptExpression*> expressionList_ {};
49fb299fa2Sopenharmony_ci};
50fb299fa2Sopenharmony_ci} // namespace Uscript
51fb299fa2Sopenharmony_ci#endif // HS_PARAM_H
52