Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created March 22, 2025 11:05
Show Gist options
  • Save trikitrok/2ae1bca2d70fb42bb1cd62dc51527965 to your computer and use it in GitHub Desktop.
Save trikitrok/2ae1bca2d70fb42bb1cd62dc51527965 to your computer and use it in GitHub Desktop.
Used to illustrate Effect Sketches
export class CppClass {
private readonly name: string;
private readonly declarations: Declaration[];
constructor(name: string, declarations: Declaration[]) {
this.name = name;
this.declarations = declarations;
}
public getDeclarationCount(): number {
return this.declarations.length;
}
public getName(): string {
return this.name;
}
public getDeclaration(index: number): Declaration {
return this.declarations[index];
}
public getInterface(interfaceName: string, indices: number[]): string {
let result = "class " + interfaceName + " {\n public:\n";
for (const index of indices) {
const virtualFunction = this.declarations[index];
result += "\t" + virtualFunction.asAbstract() + "\n";
}
result += "};\n";
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment