1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_BRIDGE_CODEC_FUNCTION_CALL_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_CODEC_FUNCTION_CALL_H 18 19 #include <string> 20 #include <vector> 21 22 #include "base/utils/noncopyable.h" 23 #include "frameworks/bridge/codec/codec_data.h" 24 25 namespace OHOS::Ace::Framework { 26 27 constexpr int32_t MAX_PARAMETERS_COUNT = UINT8_MAX; 28 29 class FunctionCall final { 30 public: FunctionCall(const std::string & funcName,const std::vector<CodecData> & args)31 FunctionCall(const std::string& funcName, const std::vector<CodecData>& args) : funcName_(funcName), args_(args) {} FunctionCall(std::string && funcName,std::vector<CodecData> && args)32 FunctionCall(std::string&& funcName, std::vector<CodecData>&& args) 33 : funcName_(std::move(funcName)), args_(std::move(args)) 34 {} 35 FunctionCall() = default; 36 ~FunctionCall() = default; 37 GetFuncName()38 const std::string& GetFuncName() const 39 { 40 return funcName_; 41 } 42 GetArgs()43 const std::vector<CodecData>& GetArgs() const 44 { 45 return args_; 46 } 47 SetFuncName(const std::string & funcName)48 void SetFuncName(const std::string& funcName) 49 { 50 funcName_ = funcName; 51 } 52 SetArgs(const std::vector<CodecData> & args)53 void SetArgs(const std::vector<CodecData>& args) 54 { 55 args_ = args; 56 } 57 SetFuncName(std::string && funcName)58 void SetFuncName(std::string&& funcName) 59 { 60 funcName_ = std::move(funcName); 61 } 62 SetArgs(std::vector<CodecData> && args)63 void SetArgs(std::vector<CodecData>&& args) 64 { 65 args_ = std::move(args); 66 } 67 68 private: 69 std::string funcName_; 70 std::vector<CodecData> args_; 71 72 ACE_DISALLOW_COPY_AND_MOVE(FunctionCall); 73 }; 74 75 } // namespace OHOS::Ace::Framework 76 77 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_CODEC_FUNCTION_CALL_H 78