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_CPP_INTERFACE_CODE_EMITTER_H 10 #define OHOS_HDI_CPP_INTERFACE_CODE_EMITTER_H 11 12 #include "codegen/cpp_code_emitter.h" 13 14 namespace OHOS { 15 namespace HDI { 16 class CppInterfaceCodeEmitter : public CppCodeEmitter { 17 public: CppInterfaceCodeEmitter()18 CppInterfaceCodeEmitter() : CppCodeEmitter() {} 19 20 virtual ~CppInterfaceCodeEmitter() = default; 21 private: 22 bool ResolveDirectory(const String& targetDirectory) override; 23 24 void EmitCode() override; 25 26 void EmitInterfaceHeaderFile(); 27 28 void EmitInterfaceInclusions(StringBuilder& sb); 29 30 void GetHeaderOtherLibInclusions(HeaderFile::HeaderFileSet& headerFiles); 31 32 void EmitInterfaceVersionMacro(StringBuilder& sb); 33 34 void EmitInterfaceDefinition(StringBuilder& sb); 35 36 void EmitInterfaceDescriptor(StringBuilder& sb, const String& prefix); 37 38 void EmitGetMethodDecl(StringBuilder& sb, const String& prefix); 39 40 void EmitGetInstanceMethodDecl(StringBuilder& sb, const String& prefix); 41 42 void EmitInterfaceDestruction(StringBuilder& sb, const String& prefix); 43 44 void EmitInterfaceMethodsDecl(StringBuilder& sb, const String& prefix); 45 46 void EmitInterfaceMethodDecl(const AutoPtr<ASTMethod>& method, StringBuilder& sb, const String& prefix); 47 48 void EmitInterfaceMethodParameter(const AutoPtr<ASTParameter>& param, StringBuilder& sb, const String& prefix); 49 }; 50 } // namespace HDI 51 } // namespace OHOS 52 53 #endif // OHOS_HDI_CPP_INTERFACE_CODE_EMITTER_H