Skip to content

Commit

Permalink
feat: include base element as property
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianBirchler committed Aug 17, 2024
1 parent 0ff7b18 commit faf2699
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
24 changes: 10 additions & 14 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,18 @@ type TDataQualityRawData struct {

// TODO: Doc formatting needs to be implemented!
type THeader struct {
GeoReference THeaderGeoReference

Offset THeaderOffset

License TLicense

OpenDriveElement
GeoReference THeaderGeoReference
Offset THeaderOffset
License TLicense
DefaultRegulations THeaderDefaultRegulations
}

// TODO: Doc formatting needs to be implemented!
type THeaderDefaultRegulations struct {
RoadRegulations THeaderRoadRegulation

OpenDriveElement
RoadRegulations THeaderRoadRegulation
SignalRegulations THeaderSignalRegulation

OpenDriveElement OpenDriveElement
}

// TODO: Doc formatting needs to be implemented!
Expand All @@ -89,19 +85,18 @@ type THeaderGeoReference struct {

// TODO: Doc formatting needs to be implemented!
type THeaderOffset struct {
OpenDriveElement
}

// TODO: Doc formatting needs to be implemented!
type THeaderRoadRegulation struct {
OpenDriveElement OpenDriveElement

OpenDriveElement
Semantics TSignalsSemantics
}

// TODO: Doc formatting needs to be implemented!
type THeaderSignalRegulation struct {
OpenDriveElement OpenDriveElement

OpenDriveElement
Semantics TSignalsSemantics
}

Expand All @@ -112,6 +107,7 @@ type TInclude struct {

// TODO: Doc formatting needs to be implemented!
type TLicense struct {
OpenDriveElement
}

// TODO: Doc formatting needs to be implemented!
Expand Down
17 changes: 13 additions & 4 deletions templates/core.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ package xodr
{{range .ComplexType}}
// {{ formatStructDocumentation .Annotation.Documentation.Text }}
type {{ toCamel .Name }} struct {
{{$base := toCamel .ComplexContent.Extension.Base}}
{{toCamel $base}}


{{- range .Attribute}}
{{ toCamel .Name}} {{mapPrimitives .Type}}
{{- if ne $base (toCamel .Type)}}
{{toCamel .Name}} {{mapPrimitives .Type}}
{{- end}}
{{- end }}

{{range .ComplexContent.Extension.Sequence.Element}}
{{ toCamel .Name}} {{mapPrimitives .Type}}
{{end}}

{{- range .ComplexContent.Extension.Sequence.Element}}
{{- if ne $base (toCamel .Type)}}
{{toCamel .Name}} {{mapPrimitives .Type}}
{{- end}}
{{- end}}
}
{{end}}

0 comments on commit faf2699

Please sign in to comment.