(
&self,
module: &ModuleDef,
table: &TableDef,
_schema: TableSchema,
)
| 479 | |
| 480 | impl Lang for Cpp<'_> { |
| 481 | fn generate_table_file_from_schema( |
| 482 | &self, |
| 483 | module: &ModuleDef, |
| 484 | table: &TableDef, |
| 485 | _schema: TableSchema, |
| 486 | ) -> OutputFile { |
| 487 | let mut output = String::new(); |
| 488 | self.write_header_comment(&mut output); |
| 489 | self.write_standard_includes(&mut output); |
| 490 | |
| 491 | // Add includes for dependencies |
| 492 | if let Some(AlgebraicTypeDef::Product(product)) = module.typespace_for_generate().get(table.product_type_ref) { |
| 493 | let deps = self.collect_product_dependencies(module, product); |
| 494 | for dep in deps { |
| 495 | if dep != table.name.to_string() { |
| 496 | writeln!(output, "#include \"{}.g.h\"", dep).unwrap(); |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | writeln!(output).unwrap(); |
| 502 | writeln!(output, "namespace {} {{", self.namespace).unwrap(); |
| 503 | writeln!(output).unwrap(); |
| 504 | |
| 505 | // Generate table as a product type |
| 506 | if let Some(AlgebraicTypeDef::Product(product)) = module.typespace_for_generate().get(table.product_type_ref) { |
| 507 | self.write_product_type(&mut output, module, &table.name, product); |
| 508 | } |
| 509 | |
| 510 | writeln!(output, "}} // namespace {}", self.namespace).unwrap(); |
| 511 | |
| 512 | OutputFile { |
| 513 | filename: format!("{}.g.h", table.name), |
| 514 | code: output, |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | fn generate_type_files(&self, module: &ModuleDef, type_def: &TypeDef) -> Vec<OutputFile> { |
| 519 | let mut output = String::new(); |
no test coverage detected