(structdefinition ComponentDefinitionStruct, implw io.Writer, NameSpace string)
| 556 | } |
| 557 | |
| 558 | func buildNodeStructConversion(structdefinition ComponentDefinitionStruct, implw io.Writer, NameSpace string) error { |
| 559 | |
| 560 | hasRowVariable := false; |
| 561 | hasColumnVariable := false; |
| 562 | |
| 563 | for i := 0; i < len(structdefinition.Members); i++ { |
| 564 | |
| 565 | member := structdefinition.Members[i]; |
| 566 | if (member.Rows > 0) { |
| 567 | hasRowVariable = true; |
| 568 | |
| 569 | if (member.Columns > 0) { |
| 570 | hasColumnVariable = true; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | } |
| 575 | |
| 576 | |
| 577 | fmt.Fprintf(implw, "/*************************************************************************************************************************\n") |
| 578 | fmt.Fprintf(implw, " Class s%s%s Conversion\n", NameSpace, structdefinition.Name) |
| 579 | fmt.Fprintf(implw, "**************************************************************************************************************************/\n") |
| 580 | |
| 581 | fmt.Fprintf(implw, ""); |
| 582 | fmt.Fprintf(implw, "s%s%s convertObjectTo%s%s (Isolate* isolate, const Local<Value> & pParamValue)\n", NameSpace, structdefinition.Name, NameSpace, structdefinition.Name); |
| 583 | fmt.Fprintf(implw, "{\n"); |
| 584 | fmt.Fprintf(implw, " s%s%s s%s;\n", NameSpace, structdefinition.Name, structdefinition.Name); |
| 585 | fmt.Fprintf(implw, " Local<Context> context = isolate->GetCurrentContext();\n"); |
| 586 | |
| 587 | if (hasRowVariable) { |
| 588 | fmt.Fprintf(implw, " int rowIndex;\n"); |
| 589 | } |
| 590 | if (hasColumnVariable) { |
| 591 | fmt.Fprintf(implw, " int columnIndex;\n"); |
| 592 | } |
| 593 | |
| 594 | fmt.Fprintf(implw, "\n"); |
| 595 | |
| 596 | for i := 0; i < len(structdefinition.Members); i++ { |
| 597 | |
| 598 | member := structdefinition.Members[i]; |
| 599 | defaultValue, err := GetCMemberDefaultValue (member.Type, member.Class, NameSpace); |
| 600 | if err != nil { |
| 601 | return err; |
| 602 | } |
| 603 | |
| 604 | defaultValueAssignment := " = " + defaultValue; |
| 605 | if (member.Type == "enum") { |
| 606 | defaultValueAssignment = ".m_code = " + defaultValue; |
| 607 | } |
| 608 | |
| 609 | if (member.Rows > 0) { |
| 610 | if (member.Columns > 0) { |
| 611 | fmt.Fprintf(implw, " for (columnIndex = 0; columnIndex < %d; columnIndex++)\n", member.Columns); |
| 612 | fmt.Fprintf(implw, " for (rowIndex = 0; rowIndex < %d; rowIndex++)\n", member.Rows); |
| 613 | fmt.Fprintf(implw, " s%s.m_%s[columnIndex][rowIndex]%s;\n", structdefinition.Name, member.Name, defaultValueAssignment); |
| 614 | } else { |
| 615 | fmt.Fprintf(implw, " for (rowIndex = 0; rowIndex < %d; rowIndex++)\n", member.Rows); |
no test coverage detected