script param "constructors" to add the _Construct version of constructors issue #278

This commit is contained in:
sonoro1234
2024-09-18 14:36:22 +02:00
parent 0c7f67607d
commit 411924f104
5 changed files with 15 additions and 1 deletions

View File

@@ -2421,6 +2421,12 @@ local function func_implementation(FP)
table.insert(outtab,"{\n")
table.insert(outtab," return IM_NEW("..def.stname..")"..def.call_args..";\n")
table.insert(outtab,"}\n")
if FP.CONSTRUCTORS_GENERATION then
table.insert(outtab,"CIMGUI_API void "..def.ov_cimguiname.."_Construct("..def.stname.."* self"..(empty and "" or ","..def.args:sub(2,-2))..")\n")
table.insert(outtab,"{\n")
table.insert(outtab," IM_PLACEMENT_NEW(self)"..def.stname..def.call_args..";\n")
table.insert(outtab,"}\n")
end
elseif def.destructor then
local args = "("..def.stname.."* self)"
local fname = def.stname.."_destroy"
@@ -2491,6 +2497,9 @@ local function func_header_generate_funcs(FP)
if def.constructor then
assert(def.stname ~= "","constructor without struct")
table.insert(outtab,"CIMGUI_API "..def.stname.."* "..def.ov_cimguiname ..(empty and "(void)" or def.args)..";"..addcoment.."\n")
if FP.CONSTRUCTORS_GENERATION then
table.insert(outtab,"CIMGUI_API void "..def.ov_cimguiname.."_Construct("..def.stname.."* self"..(empty and "" or ","..def.args:sub(2,-2))..")\n")
end
elseif def.destructor then
table.insert(outtab,"CIMGUI_API void "..def.ov_cimguiname..def.args..";"..addcoment.."\n")
else --not constructor