import { formatType } from './common'; export class Method { readonly self: string; readonly shortName: string; readonly returnType: string; readonly args: string; readonly address: number; // Constructor constructor(self: string, name: string, returnType: string, args: string, address: number) { this.self = self; this.shortName = name; this.returnType = returnType; this.args = args; this.address = address; } // Get Type getName() { return `${this.self}_${this.shortName}`; } getType() { return `${this.getName()}_t`; } // Generate Type Definition generateTypedef() { const returnType = formatType(this.returnType); return `typedef ${returnType}(*${this.getType()})${this.args};\n`; } // Generate Variable Definition generateDefinition() { return `${this.getType()} ${this.getName()};\n`; } }