(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, ClassIdentifier string, ExplicitLinking bool)
| 1082 | |
| 1083 | |
| 1084 | func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace string, BaseName string, ClassIdentifier string, ExplicitLinking bool) error { |
| 1085 | useCPPTypes := true |
| 1086 | |
| 1087 | global := component.Global |
| 1088 | |
| 1089 | cppClassPrefix := "C" |
| 1090 | baseClass := component.baseClass() |
| 1091 | cppBaseClassName := cppClassPrefix + ClassIdentifier + baseClass.ClassName |
| 1092 | |
| 1093 | sIncludeGuard := ""; |
| 1094 | |
| 1095 | if ExplicitLinking { |
| 1096 | sIncludeGuard = "__" + strings.ToUpper(NameSpace) + "_CPPHEADER_DYNAMIC" |
| 1097 | } else { |
| 1098 | sIncludeGuard = "__" + strings.ToUpper(NameSpace) + "_CPPHEADER_IMPLICIT" |
| 1099 | } |
| 1100 | |
| 1101 | if useCPPTypes { |
| 1102 | sIncludeGuard += "_CPP" |
| 1103 | } |
| 1104 | w.Writeln("#ifndef %s", sIncludeGuard) |
| 1105 | w.Writeln("#define %s", sIncludeGuard) |
| 1106 | w.Writeln("") |
| 1107 | |
| 1108 | w.Writeln("#include \"%s_types.hpp\"", BaseName) |
| 1109 | |
| 1110 | if ExplicitLinking { |
| 1111 | w.Writeln("#include \"%s_dynamic.h\"", BaseName) |
| 1112 | } else { |
| 1113 | w.Writeln("#include \"%s_abi.hpp\"", BaseName) |
| 1114 | } |
| 1115 | |
| 1116 | w.Writeln("") |
| 1117 | for _, subComponent := range(component.ImportedComponentDefinitions) { |
| 1118 | w.Writeln("#include \"%s_dynamic.hpp\"", subComponent.BaseName) |
| 1119 | } |
| 1120 | w.Writeln("") |
| 1121 | |
| 1122 | w.Writeln("#ifdef _WIN32") |
| 1123 | w.Writeln("#include <windows.h>") |
| 1124 | w.Writeln("#else // _WIN32") |
| 1125 | w.Writeln("#include <dlfcn.h>") |
| 1126 | w.Writeln("#endif // _WIN32") |
| 1127 | w.Writeln("#include <string>") |
| 1128 | w.Writeln("#include <memory>") |
| 1129 | w.Writeln("#include <vector>") |
| 1130 | w.Writeln("#include <exception>") |
| 1131 | w.Writeln("") |
| 1132 | |
| 1133 | w.Writeln("namespace %s {", NameSpace) |
| 1134 | w.Writeln("") |
| 1135 | |
| 1136 | buildBindingCPPAllForwardDeclarations(component, w, NameSpace, cppClassPrefix, ClassIdentifier) |
| 1137 | |
| 1138 | w.Writeln("") |
| 1139 | w.Writeln("/*************************************************************************************************************************") |
| 1140 | w.Writeln(" Class E%sException ", NameSpace) |
| 1141 | w.Writeln("**************************************************************************************************************************/") |
no test coverage detected