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_SA_CPP_CLIENT_PROXY_CODE_EMITTER_H 17 #define OHOS_IDL_SA_CPP_CLIENT_PROXY_CODE_EMITTER_H 18 19 #include "sa_cpp_code_emitter.h" 20 21 namespace OHOS { 22 namespace Idl { 23 class SaCppClientProxyCodeEmitter : public SACppCodeEmitter { 24 public: SaCppClientProxyCodeEmitter()25 SaCppClientProxyCodeEmitter() : SACppCodeEmitter() 26 { 27 isProxy = true; 28 } 29 30 ~SaCppClientProxyCodeEmitter() override = default; 31 32 private: 33 void EmitCode() override; 34 35 void EmitInterfaceProxyHeaderFile(); 36 37 void EmitInterfaceProxyInHeaderFile(StringBuilder &sb); 38 39 void EmitInterfaceProxyRegisterDeathRecipient(StringBuilder &sb, const std::string &prefix) const; 40 41 void EmitInterfaceProxyAddCacheApi(StringBuilder &sb, const std::string &prefix) const; 42 43 void EmitInterfaceProxyUnRegisterDeathRecipient(StringBuilder &sb, const std::string &prefix) const; 44 45 void EmitInterfaceProxyConstructor(StringBuilder &sb, const std::string &prefix) const; 46 47 void EmitInterfaceProxyMethodDecls(StringBuilder &sb, const std::string &prefix) const; 48 49 void EmitInterfaceProxyMethodDecl(AutoPtr<ASTMethod> &method, StringBuilder &sb, const std::string &prefix) const; 50 51 void EmitInterfaceProxyDeathRecipient(StringBuilder &sb, const std::string &prefix) const; 52 53 void EmitInterfaceProxyConstants(StringBuilder &sb, const std::string &prefix); 54 55 void EmitInterfaceProxyCppFile(); 56 57 void EmitInterfaceProxyMethodImpls(StringBuilder &sb, const std::string &prefix) const; 58 59 void EmitInterfaceProxyMethodImpl(AutoPtr<ASTMethod> &method, StringBuilder &sb, const std::string &prefix) const; 60 61 void EmitInterfaceProxyMethodBody(AutoPtr<ASTMethod> &method, StringBuilder &sb, const std::string &prefix) const; 62 63 void EmitInterfaceProxyMethodPreSendRequest(AutoPtr<ASTMethod> &method, StringBuilder &sb, 64 const std::string &prefix) const; 65 66 void EmitInterfaceProxyMethodPostSendRequest(AutoPtr<ASTMethod> &method, StringBuilder &sb, 67 const std::string &prefix) const; 68 69 void EmitInterfaceProxyMethodErrCode(AutoPtr<ASTMethod> &method, StringBuilder &sb, 70 const std::string &prefix) const; 71 72 void EmitInterfaceProxyMethodReply(AutoPtr<ASTMethod> &method, StringBuilder &sb, 73 const std::string &prefix) const; 74 75 void EmitInterfaceProxyMethodRetValue(AutoPtr<ASTMethod> &method, StringBuilder &sb, 76 const std::string &prefix) const; 77 78 void EmitInterfaceProxyIpcCapacityValues(StringBuilder &sb, const std::string &prefix); 79 80 void EmitInterfaceSetIpcCapacity(AutoPtr <ASTMethod> &method, StringBuilder &sb, const std::string &prefix) const; 81 }; 82 } // namespace SA 83 } // namespace OHOS 84 85 #endif // OHOS_IDL_CPP_CLIENT_PROXY_CODE_EMITTER_H