webImplStarterContent function
Content for a NEW web/src/Hybrid<Class>.cpp: the generator's starter
(<lib>.impl.g.cpp — every method with its signature) when generate has
produced one, the bare class otherwise. Both carry the shared-impl marker.
Implementation
String webImplStarterContent(String baseDir, String lib) {
final className = _toPascalCase(lib);
final starter = File(p.join(baseDir, 'lib', 'src', 'generated', 'cpp', '$lib.impl.g.cpp'));
if (!starter.existsSync()) return t.webCppStubContent(lib: lib, className: className);
final body = starter.readAsStringSync();
final implClass = RegExp(r'class (\w+) final : public Hybrid').firstMatch(body)?.group(1) ?? '${className}Impl';
final keepFrom = body.indexOf('// Ownership conventions:');
final include = body.indexOf('#include');
final kept = body.substring(keepFrom >= 0 ? keepFrom : (include >= 0 ? include : 0));
return t.webCppSeededContent(lib: lib, className: className, implClass: implClass, starterBody: kept);
}