rokojori-godot/rokojori-cpp-generator/source/cpp-creation/members/Signal.ts

42 lines
1.0 KiB
TypeScript

import { GodotTypes } from "../GodotTypes";
import { MemberInitializer } from "../MemberInitializer";
import { MemberType } from "../MemberType";
import { Member } from "./Member";
export class Signal extends Member
{
constructor( memberInitializer:MemberInitializer )
{
super( MemberType.Signal, memberInitializer );
}
parseBody( body:any )
{
return this.parseMethodParameters( body );
}
getHeaderDefinition():string
{
return "\n " + this.info();
}
getBindings( className:string )
{
//ADD_SIGNAL(MethodInfo("session_supported", PropertyInfo(Variant::STRING, "session_mode"), PropertyInfo(Variant::BOOL, "supported")));
let parameterInfos = "";
for ( let i = 0; i < this.parameters.length; i++ )
{
let type = GodotTypes.stringToVariantType( this.parameters[ i ].type );
let name = this.parameters[ i ].name;
let pi = `, PropertyInfo(Variant::${type}, "${name}")`;
parameterInfos += pi;
}
return `ADD_SIGNAL (MethodInfo( "${this.name}" ${parameterInfos}) );`;
}
}